Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getPacketCredentials = () => {
const passphrase = Mnemonic.generateMnemonic();
const keys = cryptography.getPrivateAndPublicKeyFromPassphrase(
passphrase
);
const credentials = {
address: cryptography.getAddressFromPublicKey(keys.publicKey),
passphrase: passphrase,
publicKey: keys.publicKey,
privateKey: keys.privateKey
};
return credentials;
};
const getPacketCredentials = () => {
const passphrase = Mnemonic.generateMnemonic();
const keys = cryptography.getPrivateAndPublicKeyFromPassphrase(
passphrase
);
const credentials = {
address: cryptography.getAddressFromPublicKey(keys.publicKey),
passphrase: passphrase,
publicKey: keys.publicKey,
privateKey: keys.privateKey
};
return credentials;
};
const getPacketCredentials = () => {
const passphrase = Mnemonic.generateMnemonic();
const keys = cryptography.getPrivateAndPublicKeyFromPassphrase(
passphrase
);
const credentials = {
address: cryptography.getAddressFromPublicKey(keys.publicKey),
passphrase: passphrase,
publicKey: keys.publicKey,
privateKey: keys.privateKey
};
return credentials;
};
static createAccount() {
const passphrase = Mnemonic.generateMnemonic();
const keys = getPrivateAndPublicKeyFromPassphrase(passphrase);
const address = getAddressFromPrivateKey(keys.privateKey);
return {
passphrase,
privateKey: keys.privateKey,
publicKey: keys.publicKey,
address,
balance: '0',
};
}
}
* See the LICENSE file at the top-level directory of this distribution
* for licensing information.
*
* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,
* no part of this software, including this file, may be copied, modified,
* propagated, or distributed except according to the terms contained in the
* LICENSE file.
*
* Removal or modification of this copyright notice is prohibited.
*
*/
import { Mnemonic } from '@liskhq/lisk-passphrase';
export const createMnemonicPassphrase = Mnemonic.generateMnemonic;
export const isValidMnemonicPassphrase = Mnemonic.validateMnemonic;
.map(pass =>
passphraseModule.validation
.getPassphraseValidationErrors(pass as string)
.filter((error: MnemonicError) => error.message),
);
const onPasshraseChange = (evt) => {
const { value } = evt.target;
const errors = validation.getPassphraseValidationErrors(value);
setState({
passphrase: value,
error: errors[0] ? errors[0].message : '',
});
};