How to use @stablelib/chacha20poly1305 - 3 common examples

To help you get started, we’ve selected a few @stablelib/chacha20poly1305 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 elevenyellow / coinfy / src / api / coins / ADA.js View on Github external
function encryptDerivationPath(derivationPath, hdPassphrase) {
    const serializedDerivationPath = cbor.encode(
        new CborIndefiniteLengthArray(derivationPath)
    )

    const cipher = new chacha20.ChaCha20Poly1305(hdPassphrase)

    return Buffer.from(
        cipher.seal(Buffer.from('serokellfore'), serializedDerivationPath)
    )
}
github vacuumlabs / adalite / withNode / address.js View on Github external
exports.encryptDerivationPath = function(derivationPath, hdPassphrase) {
  const serializedDerivationPath = cbor.encode(new CBORIndefiniteLengthArray(derivationPath))

  const cipher = new chacha20.ChaCha20Poly1305(hdPassphrase)

  return new Buffer(cipher.seal(new Buffer('serokellfore'), serializedDerivationPath))
}
github vacuumlabs / adalite / withNode / address.js View on Github external
function decryptDerivationPathOrFail(addressPayload, hdPassphrase) {
  const cipher = new chacha20.ChaCha20Poly1305(hdPassphrase)
  const decipheredDerivationPath = cipher.open(new Buffer('serokellfore'), addressPayload)

  try {
    return cbor.decode(new Buffer(decipheredDerivationPath))
  } catch (err) {
    throw new AddressDecodingException('incorrect address or passphrase')
  }
}

@stablelib/chacha20poly1305

ChaCha20-Poly1305 AEAD (RFC 7539)

MIT
Latest version published 6 months ago

Package Health Score

70 / 100
Full package analysis

Popular @stablelib/chacha20poly1305 functions

Similar packages