How to use the @cityofzion/neon-js.wallet.isWIF function in @cityofzion/neon-js

To help you get started, we’ve selected a few @cityofzion/neon-js 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 be-neo / neoblog / packages / sdk / src / helpers / neo.js View on Github external
export const determineKey = key => {
  if (wallet.isNEP2(key)) return "NEP2";
  if (wallet.isWIF(key)) return "WIF";
  return false;
};
github CityOfZion / neon-wallet / app / containers / Encrypt / index.js View on Github external
const encryptPrivateKey = (privateKey, passphrase, confirmPassphrase) => {
  if (passphrase !== confirmPassphrase) {
    throw new Error('Passphrases do not match')
  }
  if (!validatePassphraseLength(passphrase)) {
    throw new Error('Please choose a longer passphrase')
  }
  if (privateKey && !wallet.isWIF(privateKey)) {
    throw new Error('The private key is not valid')
  }
  return wallet.encrypt(privateKey, passphrase)
}
github CityOfZion / neon-wallet / app / components / CreateImportSplitWalletForm / CreateImportSplitWalletForm.jsx View on Github external
.then(() => {
            if (keypart2 && !wallet.isWIF(keypart2)) {
              showErrorNotification({
                message: 'Invalid secondary private key WIF',
              })
            } else {
              this.setState({ step: 2 })
            }
          })
          .catch(err => showErrorNotification({ message: err.message }))
github CityOfZion / neon-wallet / app / modules / generateEncryptedWIF.js View on Github external
export const generateNewEncryptedWIF = (
  wif: string,
  passphrase: string,
  confirmPassphrase: string,
) => {
  if (passphrase !== confirmPassphrase) {
    throw new Error('Passphrases do not match')
  }
  if (!validatePassphraseLength(passphrase)) {
    throw new Error('Please choose a longer passphrase')
  }
  if (wif && !wallet.isWIF(wif)) {
    throw new Error('The private key is not valid')
  }

  const encryptedWIF = wallet.encrypt(wif, passphrase)
  return {
    type: NEW_ENCRYPTED_WIF,
    payload: { encryptedWIF },
  }
}