[native] Add utils to encrypt/decrypt base64 string
Summary:
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
Test Plan:
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);
Reviewers: atul, marcin
Reviewed By: atul
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D7761