diff --git a/src/pages/sign/index.tsx b/src/pages/sign/index.tsx index 0f906bf..cbbe6f8 100644 --- a/src/pages/sign/index.tsx +++ b/src/pages/sign/index.tsx @@ -51,7 +51,7 @@ enum SignedStatus { } export const SignPage = () => { - const [searchParams] = useSearchParams() + const [searchParams, setSearchParams] = useSearchParams() const [displayInput, setDisplayInput] = useState(false) @@ -123,7 +123,7 @@ export const SignPage = () => { const fileName = fileUrl.split('/').pop() const file = new File([res.data], fileName!) - decrypt(file, key).then((arrayBuffer) => { + decrypt(file, decodeURIComponent(key)).then((arrayBuffer) => { if (arrayBuffer) handleDecryptedArrayBuffer(arrayBuffer) }) }) @@ -376,6 +376,14 @@ export const SignPage = () => { setAuthUrl ) } + + // when user is the last signer and has sent + // the final document to all the signers and viewers + // update search params with updated file url and encryption key + setSearchParams({ + file: fileUrl, + key: encryptionKey + }) } else { const nextSigner = meta.signers[signerIndex + 1] await sendDM(