HomePhabricator
Diffusion Comm b1ecdd8e60c5

[native] Add utils to encrypt/decrypt base64 string

Description

[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

Details

Provenance
bartekAuthored on May 3 2023, 2:29 AM
Reviewer
atul
Differential Revision
D7761: [native] Add utils to encrypt/decrypt base64 string
Parents
rCOMMde5bbb31d640: [native] Add base64 decode to CommUtilsModule
Branches
Unknown
Tags
Unknown