Skip to content

Commit

Permalink
Convert to Uintarray (#412)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <marrcooos@gmail.com>
  • Loading branch information
mcandeia authored Feb 20, 2024
1 parent cc93af1 commit 494211b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion website/utils/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ const getOrGenerateKey = (): Promise<AESKey> => {
return key;
}
if (hasLocalCryptoKey()) {
return fromSavedAESKey(JSON.parse(atob(Deno.env.get(CRYPTO_KEY_ENV_VAR)!)));
const parsedAESKey: SavedAESKey = JSON.parse(
atob(Deno.env.get(CRYPTO_KEY_ENV_VAR)!),
);
return fromSavedAESKey({
key: new Uint8Array(Object.values(parsedAESKey.key)),
iv: new Uint8Array(Object.values(parsedAESKey.iv)),
});
}
if (!kv) {
throw new Error("could not generate keys, kv is not available.");
Expand Down

0 comments on commit 494211b

Please sign in to comment.