Options
All
  • Public
  • Public/Protected
  • All
Menu

@notabene/crypto

Index

Variables

Const ASYM_CIPHER_VERSION

ASYM_CIPHER_VERSION: "x25519-xsalsa20-poly1305" = "x25519-xsalsa20-poly1305"

Let randomBytes

randomBytes: RandomBytesSource = naclRandomBytes

Functions

createEncriptionKeyPair

  • Create a new pair of keys

    Returns NaCLKeyPair

decrypt

  • decrypt(encPrivateKey: Uint8Array, __namedParameters: { ciphertext: string; fromPublicKey: string; nonce: string }): string
  • Parameters

    • encPrivateKey: Uint8Array
    • __namedParameters: { ciphertext: string; fromPublicKey: string; nonce: string }
      • ciphertext: string
      • fromPublicKey: string
      • nonce: string

    Returns string

encrypt

  • encrypt(encKeyPair: NaCLKeyPair, toPubKey: Uint8Array, data: string | Uint8Array): Promise<Encrypted>
  • Parameters

    • encKeyPair: NaCLKeyPair
    • toPubKey: Uint8Array

      their public key

    • data: string | Uint8Array

      message to encrypt

    Returns Promise<Encrypted>

naclRandomBytes

  • naclRandomBytes(length: number): Promise<Uint8Array>
  • Parameters

    • length: number

    Returns Promise<Uint8Array>

normalizeClearData

  • normalizeClearData(data: string | Uint8Array): Uint8Array
  • Takes data which could be a string or a Uint8Array and normalizes it into a Uint8Array

    Parameters

    • data: string | Uint8Array

    Returns Uint8Array

setRandomBytesSource

  • Sets a system wide random byte source

    Parameters

    Returns void

Generated using TypeDoc