How to use the @zilliqa-js/crypto.verifyPrivateKey function in @zilliqa-js/crypto

To help you get started, we’ve selected a few @zilliqa-js/crypto 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 zilpay / zil-pay / tests / unit / packages / background / services / account.spec.js View on Github external
it('Should be able init wallet', async() => {
    await accountControl.auth.setPassword(password)

    currentAccount = await accountControl.initWallet(SEED)

    expect(currentAccount.index).toBe(0)
    expect(currentAccount.publicKey).toBeTruthy()
    expect(verifyPrivateKey(currentAccount.privateKey)).toBeTruthy()
    expect(currentAccount.balance).not.toBeNull()
    expect(toChecksumAddress(currentAccount.address)).toBeTruthy()
  })
github zilpay / zil-pay / packages / background / services / blockchain / zilliqa.js View on Github external
async getAccountByPrivateKey(importPrivateKey, index = 0) {
    if (!verifyPrivateKey(importPrivateKey)) {
      throw new Error(errorsCode.WrongPrivateKey)
    }

    const account = {
      privateKey: importPrivateKey,
      publicKey: getPubKeyFromPrivateKey(importPrivateKey),
      address: getAddressFromPrivateKey(importPrivateKey)
    }
    const { result } = await this.getBalance(account.address)

    account.address = toChecksumAddress(account.address)

    return {
      ...account,
      index,
      balance: result