Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should call decryptMessageWithPassphrase', () => {
cryptography.decryptMessage(input);
return expect(
cryptographyModule.decryptMessageWithPassphrase,
).to.be.calledWithExactly(
input.cipher,
input.nonce,
input.passphrase,
input.senderPublicKey,
);
});
export const decryptMessage = ({
cipher,
nonce,
passphrase,
senderPublicKey,
}: DecryptMessageInputs) => ({
message: cryptography.decryptMessageWithPassphrase(
cipher,
nonce,
passphrase,
senderPublicKey,
),
});
) => ({ passphrase, data }: InputFromSourceOutput) => {
const targetMessage = message || data;
if (!targetMessage) {
throw new ValidationError('No message was provided.');
}
if (!passphrase) {
throw new ValidationError('No passphrase was provided.');
}
return decryptMessageWithPassphrase(
targetMessage,
nonce,
passphrase,
senderPublicKey,
);
};