How to use the @liskhq/lisk-client.passphrase function in @liskhq/lisk-client

To help you get started, we’ve selected a few @liskhq/lisk-client 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-mobile / src / utilities / passphrase.js View on Github external
export const validatePassphrase = passphrase => {
  if (passphrase.trim().length === 0) {
    return [{ code: 'empty_value', message: 'Invalid Passphrase' }];
  }
  const numberOfWords = Math.ceil(passphrase.trim().split(' ').length / 3) * 3;
  const validPassLength = Math.max(Math.min(numberOfWords, 24), 12);
  return Lisk.passphrase.validation.getPassphraseValidationErrors(
    passphrase,
    undefined,
    validPassLength
  );
};
github LiskHQ / lisk-desktop / src / utils / api / btc / account.js View on Github external
export const getDerivedPathFromPassphrase = (passphrase, config) => {
  const seed = Lisk.passphrase.Mnemonic.mnemonicToSeed(passphrase);
  return bip32.fromSeed(seed, config.network).derivePath(config.derivationPath);
};
github LiskHQ / lisk-mobile / src / utilities / api / btc / account.js View on Github external
export const getDerivedPathFromPassphrase = passphrase => {
  const seed = Lisk.passphrase.Mnemonic.mnemonicToSeed(passphrase);
  return bip32.fromSeed(seed, config.network).derivePath(config.derivationPath);
};
github LiskHQ / lisk-mobile / src / utilities / passphrase.js View on Github external
import Lisk from '@liskhq/lisk-client';
import * as Keychain from 'react-native-keychain';
import FingerprintScanner from 'react-native-fingerprint-scanner';
import { Platform } from 'react-native';
import { extractAddress } from './api/lisk/account';

const fullWordsList = Lisk.passphrase.Mnemonic.wordlists.EN;

/**
 * Checks validity of passphrase using to mnemonic
 *
 * detects validity of each word individually
 * the result consist of [multiple] object[s]
 * which have a member with a 'code' key whose value
 * is one of the below
 * INVALID_AMOUNT_OF_WORDS
 * INVALID_AMOUNT_OF_WHITESPACES
 * INVALID_AMOUNT_OF_UPPERCASE_CHARACTER
 * INVALID_MNEMONIC
 *
 * and a message which indicates the issue
 * in a more human readable fashion
 *