Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.authCrypt = async function (myDid, theirDid, message) {
let myVerkey = await sdk.keyForLocalDid(await indy.wallet.get(), myDid);
let theirVerkey = await sdk.keyForLocalDid(await indy.wallet.get(), theirDid);
let buffer = await sdk.cryptoAuthCrypt(await indy.wallet.get(), myVerkey, theirVerkey, Buffer.from(message, 'utf8'));
return Buffer.from(buffer).toString('base64')
};
exports.anonDecrypt = async function (did, message) {
let verKey = await sdk.keyForLocalDid(await indy.wallet.get(), did);
let decryptedMessageBuffer = await sdk.cryptoAnonDecrypt(await indy.wallet.get(), verKey, message);
let buffer = Buffer.from(decryptedMessageBuffer).toString('utf8');
return JSON.parse(buffer);
};
exports.authDecrypt = async function (myDid, message) {
let myVerkey = await sdk.keyForLocalDid(await indy.wallet.get(), myDid);
let [, decryptedMessageBuffer] = await sdk.cryptoAuthDecrypt(await indy.wallet.get(), myVerkey, Buffer.from(message, 'base64'));
let buffer = Buffer.from(decryptedMessageBuffer).toString('utf8');
return JSON.parse(buffer);
};