MCPcopy Index your code
hub / github.com/Sathvik-Rao/ClipCascade / encrypt

Function encrypt

ClipCascade_Mobile/src/StartForegroundService.js:97–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96 // encrption
97 const encrypt = async plainText => {
98 try {
99 const encryptedData = await AesGcmCrypto.encrypt(
100 plainText,
101 false,
102 await getDataFromAsyncStorage('hashed_password'),
103 );
104 return JSON.stringify({
105 nonce: Buffer.from(encryptedData.iv, 'hex').toString('base64'),
106 ciphertext: encryptedData.content,
107 tag: Buffer.from(encryptedData.tag, 'hex').toString('base64'),
108 });
109 } catch (e) {
110 throw new Error('Failed to encrypt: ' + e);
111 }
112 };
113
114 // decryption
115 const decrypt = async encryptedData => {

Callers 1

Calls 3

getDataFromAsyncStorageFunction · 0.90
encryptMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected