Thumbhash (base64-encoded) is going to be encrypted, so we need to add utils to encrypt/decrypt base64 string.
These functions unwrap the base64-encoded, encrypt/decrypt it and then again base64-encode the result.
Depends on D7760
Differential D7761
[native] Add utils to encrypt/decrypt base64 string bartek on May 9 2023, 6:27 AM. Authored by Tags None Referenced Files
Details Thumbhash (base64-encoded) is going to be encrypted, so we need to add utils to encrypt/decrypt base64 string. These functions unwrap the base64-encoded, encrypt/decrypt it and then again base64-encode the result. Depends on D7760 const data = new Uint8Array([1,2,3,4,5]); const b64 = commUtilsModule.base64EncodeBuffer(data.buffer); const { base64: encryptedB64, keyHex } = encryptBase64(b64); const decrypted = decryptBase64(encryptedB64, keyHex); const unwrapped = commUtilsModule.base64DecodeBuffer(decrypted); console.log(unwrapped);
Diff Detail
Event TimelineComment Actions I'm guessing these utilities are going to be used widely, so it'd be good to make sure they're as robust as possible. Left some notes inline. Accepting to unblock, but would be great to hear your thoughts before landing. (Guessing that we can't easily write tests via Jest because there's no way to access commUtilsModule)
|