diff options
Diffstat (limited to 'lib/passkey.ts')
-rw-r--r-- | lib/passkey.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/passkey.ts b/lib/passkey.ts index b03ecf5..581da26 100644 --- a/lib/passkey.ts +++ b/lib/passkey.ts @@ -323,12 +323,10 @@ export async function pkEncryptXOR(dataBytes: Uint8Array): Promise<string> { console.log({ key: key.byteLength, data: encrypted.byteLength }); // XOR with derived key (repeat key if data is longer) - const hash = Uint8Array.from(key, (v, i) => v ^ encrypted[i]); for (let i = 0; i < dataBytes.length; i++) { encrypted[i] = dataBytes[i] ^ key[i % key.length]; } - console.log({ hash, encrypted }); // Return nonce + encrypted data as base64 const result = new Uint8Array(nonce.length + encrypted.length); result.set(nonce); @@ -351,9 +349,9 @@ export async function pkDecryptXOR(encryptedData: string): Promise<string> { for (let i = 0; i < encrypted.length; i++) { decrypted[i] = encrypted[i] ^ key[i % key.length]; } - const hash = Uint8Array.from(key, (v, i) => v ^ encrypted[i]); const one = bytes2hex(decrypted); - const two = bytes2hex(hash); + // const hash = Uint8Array.from(key, (v, i) => v ^ encrypted[i]); + // const two = bytes2hex(hash); return one; } |