dashhive / DashJoin.js

Dash CoinJoin JavaScript (Browser & Node) SDK
MIT License
2 stars 0 forks source link

Thoughts on signing #24

Closed coolaj86 closed 2 months ago

coolaj86 commented 2 months ago

My small test case should:

Resources

/** @type {PubKeyHashToAddress} */
    _DashKeys.pkhToAddr = async function (shaRipeBytes, opts) {
      let pubKeyHash = Utils.bytesToHex(shaRipeBytes);
      let version = opts?.version;

      switch (version) {
        case null:
              /* fallsthrough */
        case undefined:
              break;
        case "testnet":
          version = DASH_PKH_TESTNET;
              break;
          default:
              throw new Error('bad version');
      }

/** @type {PrivateKeyToWif} */
    _DashKeys.privKeyToWif = async function (privBytes, opts) {
      let privateKey = Utils.bytesToHex(privBytes);
      let version = opts?.version;

      switch (version) {
        case null:
              /* fallsthrough */
        case undefined:
              break;
        case "testnet":
          version = DASH_PRIV_KEY_TESTNET;
              break;
          default:
              throw new Error('bad version');
      }