How to use the @polkadot/keyring/pair function in @polkadot/keyring

To help you get started, we’ve selected a few @polkadot/keyring 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 vue-polkadot / vue-ui / packages / vue-keyring / src / Keyring.ts View on Github external
public restoreAccount(json: KeyringPair$Json, password: string): KeyringPair {
    const type = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519';
    const pair = createPair(
      type,
      {
        // FIXME Just for the transition period (ignoreChecksum)
        publicKey: this.decodeAddress(json.address, true)
      },
      json.meta,
      hexToU8a(json.encoded)
    );

    // unlock, save account and then lock (locking cleans secretKey, so needs to be last)
    pair.decodePkcs8(password);
    this.addPair(pair, password);
    pair.lock();

    return pair;
  }
github polkadot-js / ui / packages / ui-keyring / src / Keyring.ts View on Github external
public restoreAccount (json: KeyringPair$Json, password: string): KeyringPair {
    const type = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519';
    const pair = createPair(
      type,
      {
        // FIXME Just for the transition period (ignoreChecksum)
        publicKey: this.decodeAddress(json.address, true)
      },
      json.meta,
      hexToU8a(json.encoded)
    );

    // unlock, save account and then lock (locking cleans secretKey, so needs to be last)
    pair.decodePkcs8(password);
    this.addPair(pair, password);
    pair.lock();

    return pair;
  }
github vue-polkadot / vue-ui / packages / vue-keyring / src / Keyring.ts View on Github external
public restoreAccount(json: KeyringPair$Json, password: string): KeyringPair {
    const type = Array.isArray(json.encoding.content) ? json.encoding.content[1] : 'ed25519';
    const pair = createPair(
      type,
      {
        // FIXME Just for the transition period (ignoreChecksum)
        publicKey: this.decodeAddress(json.address, true)
      },
      json.meta,
      hexToU8a(json.encoded)
    );

    // unlock, save account and then lock (locking cleans secretKey, so needs to be last)
    pair.decodePkcs8(password);
    this.addPair(pair, password);
    pair.lock();

    return pair;
  }

@polkadot/keyring

Keyring management

Apache-2.0
Latest version published 1 month ago

Package Health Score

87 / 100
Full package analysis

Similar packages