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 encryptMessageWithPassphrase', () => {
cryptography.encryptMessage(input);
return expect(
cryptographyModule.encryptMessageWithPassphrase,
).to.be.calledWithExactly(
input.message,
input.passphrase,
input.recipient,
);
});
const processInputs = (recipientPublicKey: string, message?: string) => ({
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 {
...encryptMessageWithPassphrase(
targetMessage,
passphrase,
recipientPublicKey,
),
recipientPublicKey,
};
};
export const encryptMessage = ({
message,
passphrase,
recipient,
}: EncryptMessageInputs) =>
cryptography.encryptMessageWithPassphrase(message, passphrase, recipient);