How to use the borc.encode function in borc

To help you get started, we’ve selected a few borc 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 vacuumlabs / cardano-crypto.js / index.js View on Github external
function getAddressHash(input) {
  // eslint-disable-next-line camelcase
  const firstHash = sha3_256(cbor.encode(input))
  return blake2b(firstHash, 28)
}
github zbo14 / constellate / src / dag-cbor.js View on Github external
return cb(new Error('the object passed has circular references'))
    }
    seen.push(val)
    if (!(cid = val['/'])) {
      return val
    }
    if (typeof cid === 'string') {
      cid = new CID(cid.split('/')[0]).buffer
    }
    return new cbor.Tagged(CID_CBOR_TAG, Buffer.concat([
      Buffer.from('00', 'hex'), cid
    ]))
  })
  if (!stop) {
    try {
      const data = cbor.encode(tagged)
      cb(null, data)
    } catch (err) {
      cb(err)
    }
  }
}
github BitbossIO / keyring / packages / cbor-plugin / lib / transaction.js View on Github external
tx.data().forEach((datum) => {
          if(
            datum
            && datum[0].toString() === '19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut'
            && datum[2].toString() == 'application/cbor'
          ) {
            try {
              results.push(cbor.decode(datum[1]));
            } catch (err) {}
          }
        });
        return results;
      } else {
        return tx.data(
          '19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut',
          cbor.encode(data),
          'application/cbor',
          'binary'
        );
      }
    };
  }
github vacuumlabs / adalite / app / frontend / wallet / transaction.ts View on Github external
function getId() {
    return blake2b(encode(TxAux(inputs, outputs, attributes)), 32).toString('hex')
  }
github vacuumlabs / adalite / app / frontend / wallet / keypass-json.ts View on Github external
function getRandomSaltForPasswordHash() {
  const randBytes = Buffer.alloc(32)
  window.crypto.getRandomValues(randBytes)

  return encode(randBytes)
}
github vacuumlabs / adalite / app / frontend / wallet / helpers / cbor-parsers.ts View on Github external
const parseAddress = (val) => {
  return base58.encode(encode(val))
}
github vacuumlabs / cardano-crypto.js / index.js View on Github external
function encryptDerivationPath(derivationPath, hdPassphrase) {
  const serializedDerivationPath = cbor.encode(new CborIndefiniteLengthArray(derivationPath))

  return chacha20poly1305Encrypt(
    serializedDerivationPath,
    hdPassphrase,
    Buffer.from('serokellfore')
  )
}

borc

Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049).

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis