How to use the @cityofzion/neon-js.wallet.isPrivateKey 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 snowypowers / ansy / src / components / Form.js View on Github external
genWallet () {
    if (this.private.value === '') {
      this.setState({ error: 'Empty Field!' })
      return
    }
    if (!wallet.isNEP2(this.private.value) && !wallet.isWIF(this.private.value) && !wallet.isPrivateKey(this.private.value)) {
      this.setState({ error: 'Wrong Private Key Length!' })
      return
    }

    let newWallet = {}
    try {
      const acct = new wallet.Account(this.private.value)
      if (wallet.isNEP2(this.private.value)) {
        if (this.conPassword.value.length > 0) {
          newWallet.nep2 = acct.encrypted
          acct.decrypt(this.conPassword.value)
        } else {
          this.setState({error: "Encrypted key provided without password!"})
        }
      }
      newWallet.private = acct.privateKey
github CityOfZion / neon-wallet / app / actions / authActions.js View on Github external
({ wif }: WifLoginProps) => async (): Promise => {
    if (!wallet.isWIF(wif) && !wallet.isPrivateKey(wif)) {
      throw new Error('Invalid private key entered')
    }

    const account = new wallet.Account(wif)
    const hasInternetConnectivity = await checkForInternetConnectivity()

    return {
      wif: account.WIF,
      publicKey: account.publicKey,
      address: account.address,
      isHardwareLogin: false,
      hasInternetConnectivity,
    }
  },
)
github nos / client / src / renderer / login / actions / authActions.js View on Github external
const wifAuthenticate = (wif) => {
  if (!wallet.isWIF(wif) && !wallet.isPrivateKey(wif)) {
    throw new Error('That is not a valid private key.');
  }

  const account = new wallet.Account(wif);

  return { wif: account.WIF, address: account.address };
};
github nos / client / src / renderer / login / components / LoginFormWalletFile / LoginFormWalletFile.js View on Github external
renderDescription = () => {
    const { encryptedWIF } = this.props;

    if (isEmpty(encryptedWIF)) {
      return null;
    }

    if (wallet.isPrivateKey(encryptedWIF)) {
      return 'Private key detected.';
    } else {
      return 'Encrypted key detected, please type passphrase.';
    }
  };
github nos / client / src / renderer / login / components / LoginFormWalletFile / LoginFormWalletFile.js View on Github external
isValid = () => {
    const { encryptedWIF, passphrase } = this.props;
    return !(isEmpty(encryptedWIF) || (!wallet.isPrivateKey(encryptedWIF) && isEmpty(passphrase)));
  };
github nos / client / src / renderer / login / components / LoginFormWalletFile / LoginFormWalletFile.js View on Github external
renderPassphraseInput = () => {
    const { encryptedWIF, passphrase, disabled } = this.props;

    if (isEmpty(encryptedWIF) || wallet.isPrivateKey(encryptedWIF)) {
      return null;
    }

    return (
      
    );
  };