How to use the urbit-key-generation/dist.deriveNetworkKeys function in urbit-key-generation

To help you get started, we’ve selected a few urbit-key-generation 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 urbit / bridge / src / views / SetKeys.js View on Github external
createUnsignedTxn() {
    const { state, props } = this;

    const validContracts = need.contracts(props.contracts);
    const validPoint = need.point(props.pointCursor);

    // TODO: move this to a lib for validating things
    const hexRegExp = /[0-9A-Fa-f]{64}/g;

    if (hexRegExp.test(state.newNetworkSeed)) {
      // derive network keys
      const pair = kg.deriveNetworkKeys(state.newNetworkSeed);

      const pencr = addHexPrefix(pair.crypt.public);
      const pauth = addHexPrefix(pair.auth.public);

      const txn = azimuth.ecliptic.configureKeys(
        validContracts,
        validPoint,
        pencr,
        pauth,
        1,
        state.discontinuity
      );

      return Just(txn);
    }
github urbit / bridge / src / views / GenKeyfile.js View on Github external
checkKeysMatch(networkSeed, pointDetails) {
    const crypub = pointDetails.encryptionKey;
    const sgnpub = pointDetails.authenticationKey;

    const { crypt, auth } = kg.deriveNetworkKeys(networkSeed);

    const keysmatch =
      crypub === addHexPrefix(crypt.public) &&
      sgnpub === addHexPrefix(auth.public);

    return keysmatch;
  }