How to use the lisk-elements.default.cryptography function in lisk-elements

To help you get started, we’ve selected a few lisk-elements 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 / integration / transactions / 0.0.address_collision.js View on Github external
it('both passphrases should have the same address', done => {
		expect(lisk.cryptography.getAddressFromPublicKey(publicKeys[0])).to.equal(
			lisk.cryptography.getAddressFromPublicKey(publicKeys[1])
		);
		done();
	});
github LiskHQ / lisk-sdk / test / common / utils / random.js View on Github external
random.account = function() {
	var account = {
		balance: '0',
	};

	account.passphrase = random.password();
	account.secondPassphrase = random.password();
	account.username = random.delegateName();
	account.publicKey = lisk.cryptography.getKeys(account.passphrase).publicKey;
	account.address = lisk.cryptography.getAddressFromPublicKey(
		account.publicKey
	);
	account.secondPublicKey = lisk.cryptography.getKeys(
		account.secondPassphrase
	).publicKey;

	return account;
};
github LiskHQ / lisk-sdk / test / common / utils / random.js View on Github external
random.account = function() {
	var account = {
		balance: '0',
	};

	account.passphrase = random.password();
	account.secondPassphrase = random.password();
	account.username = random.delegateName();
	account.publicKey = lisk.cryptography.getKeys(account.passphrase).publicKey;
	account.address = lisk.cryptography.getAddressFromPublicKey(
		account.publicKey
	);
	account.secondPublicKey = lisk.cryptography.getKeys(
		account.secondPassphrase
	).publicKey;

	return account;
};
github LiskHQ / lisk-sdk-examples / test / unit / logic / vote.js View on Github external
).map(() => {
				return `+${lisk.cryptography.getKeys(randomUtil.password()).publicKey}`;
			});
			return expect(() => {
github LiskHQ / lisk-sdk / test / integration / transactions / 0.0.address_collision.js View on Github external
describe('system test (type 0) - address collision', () => {
	let library;
	localCommon.beforeBlock('system_0_0_address_collision', lib => {
		library = lib;
	});

	const collision = {
		address: '13555181540209512417L',
		passphrases: [
			'merry field slogan sibling convince gold coffee town fold glad mix page',
			'annual youth lift quote off olive uncle town chief poverty extend series',
		],
	};

	const publicKeys = [
		lisk.cryptography.getPrivateAndPublicKeyFromPassphrase(
			collision.passphrases[0]
		).publicKey,
		lisk.cryptography.getPrivateAndPublicKeyFromPassphrase(
			collision.passphrases[1]
		).publicKey,
	];

	const firstTransaction = lisk.transaction.transfer({
		amount: 10 * NORMALIZER,
		passphrase: collision.passphrases[0],
		recipientId: accountFixtures.genesis.address,
	});

	const secondTransaction = lisk.transaction.transfer({
		amount: 10 * NORMALIZER,
		passphrase: collision.passphrases[1],
github LiskHQ / lisk-sdk-examples / test / unit / logic / multisignature.js View on Github external
const keysgroup = Array(...Array(10)).map(() => {
				return `${lisk.cryptography.getKeys(randomUtil.password()).publicKey}`;
			});
github LiskHQ / lisk-sdk-examples / test / unit / logic / multisignature.js View on Github external
beforeEach(() => {
		transactionMock = {
			verifySignature: sinonSandbox.stub().returns(1),
		};
		accountMock = {
			merge: sinonSandbox.mock().callsArg(2),
		};
		accountsMock = {
			generateAddressByPublicKey: sinonSandbox
				.stub()
				.returns(lisk.cryptography.getKeys(randomUtil.password()).publicKey),
			setAccountAndGet: sinonSandbox.stub().callsArg(1),
		};
		transaction = _.cloneDeep(validTransaction);
		rawTransaction = _.cloneDeep(rawValidTransaction);
		sender = _.cloneDeep(validSender);
		dummyBlock = {
			id: '9314232245035524467',
			height: 1,
		};
		multisignature = new Multisignature(
			modulesLoader.scope.schema,
			modulesLoader.scope.network,
			transactionMock,
			accountMock,
			modulesLoader.logger
		);