njs/crypto

Types

pub type CryptoKey
pub type EncryptAlgorithm {
  RsaOaep(name: String)
  AesCtr(name: String, counter: ArrayBuffer, length: Int)
  AesCbc(name: String, iv: ArrayBuffer)
  AesGcm(
    name: String,
    iv: ArrayBuffer,
    additional_data: ArrayBuffer,
    tag_length: Int,
  )
}

Constructors

  • RsaOaep(name: String)
  • AesCtr(name: String, counter: ArrayBuffer, length: Int)
  • AesCbc(name: String, iv: ArrayBuffer)
  • AesGcm(
      name: String,
      iv: ArrayBuffer,
      additional_data: ArrayBuffer,
      tag_length: Int,
    )
pub type KeyAlgorithm {
  RsaOaepKey(name: String, hash: String)
  HMACKey(name: String, hash: String, length: Int)
  AesKey(name: String)
}

Constructors

  • RsaOaepKey(name: String, hash: String)

    RSA-OAEP

  • HMACKey(name: String, hash: String, length: Int)

    HMAC

  • AesKey(name: String)

    AES-CTR AES-CBC ASE-GCM

Functions

pub fn encrypt(
  algorithm a: EncryptAlgorithm,
  key k: CryptoKey,
  data d: ArrayBuffer,
) -> Promise(ArrayBuffer)
pub fn get_random_values(typedarray a: TypedArray) -> TypedArray
Search Document