How to use the @liskhq/lisk-cryptography.encryptPassphraseWithPassword 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 encryptPassphraseWithPassword', () => {
			const input = {
				passphrase: 'random-passphrase',
				password: 'password',
			};
			cryptography.encryptPassphrase(input);

			return expect(
				cryptographyModule.encryptPassphraseWithPassword,
			).to.be.calledWithExactly(input.passphrase, input.password);
		});
github LiskHQ / lisk-core / scripts / update_config.js View on Github external
config.forging.secret.forEach(secret => {
						console.info('.......');
						config.forging.delegates.push({
							encryptedPassphrase: stringifyEncryptedPassphrase(
								encryptPassphraseWithPassword(secret, password)
							),
							publicKey: getPrivateAndPublicKeyFromPassphrase(secret).publicKey,
						});
					});
github LiskHQ / lisk-sdk-examples / lisk / scripts / update_config.js View on Github external
config.forging.secret.forEach(secret => {
						console.info('.......');
						config.forging.delegates.push({
							encryptedPassphrase: stringifyEncryptedPassphrase(
								encryptPassphraseWithPassword(secret, password)
							),
							publicKey: getPrivateAndPublicKeyFromPassphrase(secret).publicKey,
						});
					});
github LiskHQ / lisk-sdk / commander / src / utils / cryptography.ts View on Github external
export const encryptPassphrase = ({
	passphrase,
	password,
}: EncryptPassphraseInputs) => {
	const encryptedPassphraseObject = cryptography.encryptPassphraseWithPassword(
		passphrase,
		password,
	);
	const encryptedPassphrase = cryptography.stringifyEncryptedPassphrase(
		encryptedPassphraseObject,
	);

	return { encryptedPassphrase };
};
github LiskHQ / lisk-sdk / commander / src / commands / passphrase / encrypt.ts View on Github external
const processInputs = (outputPublicKey: boolean) => ({
	passphrase,
	password,
}: InputFromSourceOutput) => {
	if (!passphrase) {
		throw new ValidationError('No passphrase was provided');
	}
	if (!password) {
		throw new ValidationError('No password was provided');
	}

	const encryptedPassphraseObject = encryptPassphraseWithPassword(
		passphrase,
		password,
	);
	const encryptedPassphrase = stringifyEncryptedPassphrase(
		encryptedPassphraseObject,
	);

	return outputPublicKey
		? {
				encryptedPassphrase,
				publicKey: getKeys(passphrase).publicKey,
		  }
		: { encryptedPassphrase };
};