How to use the @liskhq/lisk-cryptography.encryptMessageWithPassphrase function in @liskhq/lisk-cryptography

To help you get started, we’ve selected a few @liskhq/lisk-cryptography examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-sdk / test / utils / cryptography.ts View on Github external
it('should call encryptMessageWithPassphrase', () => {
			cryptography.encryptMessage(input);
			return expect(
				cryptographyModule.encryptMessageWithPassphrase,
			).to.be.calledWithExactly(
				input.message,
				input.passphrase,
				input.recipient,
			);
		});
github LiskHQ / lisk-sdk / commander / src / commands / message / encrypt.ts View on Github external
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,
	};
};
github LiskHQ / lisk-sdk / commander / src / utils / cryptography.ts View on Github external
export const encryptMessage = ({
	message,
	passphrase,
	recipient,
}: EncryptMessageInputs) =>
	cryptography.encryptMessageWithPassphrase(message, passphrase, recipient);