package ezjs_crypto

  1. Overview
  2. Docs
class type keygenParams = object ... end
class type cryptoKey = object ... end
class type cryptoKeyPair = object ... end
class type signParams = object ... end
class type deriveParams = object ... end
class type cryptParams = object ... end
class type importParams0 = object ... end
type importParams = Ezjs_min.Unsafe.top
class type subtle = object ... end
class type crypto = object ... end
val crypto : crypto Ezjs_min.t
val subtle : subtle Ezjs_min.t
val random_values : int -> Ezjs_min.Typed_array.Bigstring.t
type ec_curve =
  1. | P256
  2. | P384
  3. | P521
type sha_algo =
  1. | SHA1
  2. | SHA256
  3. | SHA384
  4. | SHA512
type rsa_kind =
  1. | PKCS
  2. | PSS
  3. | OAEP
type aes_kind =
  1. | CTR
  2. | CBC
  3. | GCM
type ec_kind =
  1. | DSA
  2. | DH
type sign_usage = [
  1. | `Sign
  2. | `Verify
]
type crypt_usage = [
  1. | `Encrypt
  2. | `Decrypt
  3. | `WrapKey
  4. | `UnwrapKey
]
type derive_usage = [
  1. | `DeriveKey
  2. | `DeriveBits
]
type usage = [
  1. | sign_usage
  2. | crypt_usage
  3. | derive_usage
]
type sign_params =
  1. | RSA_PKCS
  2. | RSA_PSS of int
  3. | ECDSA of sha_algo
  4. | HMAC
type crypt_params =
  1. | RSA_OAEP of Ezjs_min.Typed_array.Bigstring.t option
  2. | AES_CTR of Ezjs_min.Typed_array.Bigstring.t * int
  3. | AES_CBC of Ezjs_min.Typed_array.Bigstring.t
  4. | AES_GCM of Ezjs_min.Typed_array.Bigstring.t * Ezjs_min.Typed_array.Bigstring.t option * int option
type keygen_params =
  1. | GRSA of rsa_kind * int * sha_algo * int list option
  2. | GEC of ec_kind * ec_curve
  3. | GHMAC of sha_algo * int option
  4. | GAES of aes_kind * int
type import_params =
  1. | IRSA of rsa_kind * sha_algo
  2. | IEC of ec_kind * ec_curve
  3. | IHMAC of sha_algo
  4. | IAES of aes_kind
  5. | IHKDF
  6. | IPBKDF2
type key_format =
  1. | Raw
  2. | PKCS8
  3. | SPKI
  4. | JWK
type 'usage crypto_key = {
  1. kind : string;
  2. extractable : bool;
  3. algorithm : keygen_params;
  4. usages : 'usage list;
}
type 'usage crypto_keypair = {
  1. public_key : 'usage crypto_key;
  2. private_key : 'usage crypto_key;
}
type 'usage crypto_key_all =
  1. | CKey of 'usage crypto_key
  2. | CKeyPair of 'usage crypto_keypair
val str_of_rsa : rsa_kind -> string
val str_of_ec : ec_kind -> string
val str_of_aes : aes_kind -> string
val str_of_format : key_format -> string
val str_of_usage : [< usage ] -> Ezjs_min.js_string Ezjs_min.t
val pub_expo : int list option -> Ezjs_min.Typed_array.uint8Array Js_of_ocaml.Js.t
val to_keygen_params0 : ?mod_length:int -> ?exponent:int list option -> ?sha:sha_algo -> ?length:int -> ?curve:ec_curve -> string -> keygenParams Ezjs_min.t
val to_keygen_params : keygen_params -> keygenParams Ezjs_min.t
val to_crypto_key : [< usage ] crypto_key -> cryptoKey Ezjs_min.t
val to_crypto_keypair : [< usage ] crypto_keypair -> cryptoKeyPair Ezjs_min.t
val to_sign_params0 : ?length:int -> ?sha:sha_algo -> string -> signParams Ezjs_min.t
val to_sign_params : sign_params -> signParams Ezjs_min.t
val to_derive_params0 : ?public:cryptoKey Ezjs_min.t -> ?sha:sha_algo -> ?salt:Ezjs_min.Typed_array.Bigstring.t -> ?info:Ezjs_min.Typed_array.Bigstring.t -> ?iterations:int -> string -> deriveParams Ezjs_min.t
val to_derive_params : derive_algo -> deriveParams Ezjs_min.t
val to_crypt_params0 : ?label:Ezjs_min.Typed_array.Bigstring.t -> ?counter:Ezjs_min.Typed_array.Bigstring.t -> ?length:int -> ?iv:Ezjs_min.Typed_array.Bigstring.t -> ?data:Ezjs_min.Typed_array.Bigstring.t -> ?tag_length:int -> string -> cryptParams Ezjs_min.t
val to_crypt_params : crypt_params -> cryptParams Ezjs_min.t
val to_import_params_base : ?sha:sha_algo -> ?curve:ec_curve -> string -> importParams0 Ezjs_min.t
val to_import_params0 : import_params -> importParams0 Ezjs_min.t option
val to_import_params : import_params -> importParams Ezjs_min.t
val of_sha : 'a Js_of_ocaml__Js.t Ezjs_min.Optdef.t -> sha_algo
val of_exponent : 'a -> 'b option
val of_keygen_params : keygenParams Ezjs_min.t -> keygen_params
val str_to_usage : Ezjs_min.js_string Ezjs_min.t -> usage
val str_error : string -> ('a, Ezjs_min.error Js_of_ocaml.Js.t) Ezjs_min.result
val to_bigstring : ((Ezjs_min.Typed_array.Bigstring.t, 'a) Ezjs_min.result -> 'b) -> (Js_of_ocaml__Typed_array.arrayBuffer Js_of_ocaml.Js.t, 'c) Ezjs_min.result -> 'd
val generate_symmetric_key : ?extractable:bool -> algo:keygen_params -> usages:[< usage ] list -> ((usage crypto_key, Js_of_ocaml.Js.Js_error.error_t) Ezjs_min.result -> unit) -> unit
val generate_asymmetric_key : ?extractable:bool -> algo:keygen_params -> usages:[< usage ] list -> ((usage crypto_keypair, Ezjs_min.error Js_of_ocaml.Js.t) Ezjs_min.result -> unit) -> unit
val generate_key : ?extractable:bool -> algo:keygen_params -> usages:[< usage ] list -> ((usage crypto_key_all, Js_of_ocaml.Js.Js_error.error_t) Ezjs_min.result -> unit) -> unit
val derive_key : ?extractable:bool -> algo:derive_algo -> dalgo:keygen_params -> key:derive_usage crypto_key -> usages:[< usage ] list -> ((usage crypto_key, Js_of_ocaml.Js.Js_error.error_t) Ezjs_min.result -> unit) -> unit
val import_key : ?extractable:bool -> ?format:key_format -> data:Ezjs_min.Typed_array.Bigstring.t -> algo:import_params -> usages:[< usage ] list -> ((usage crypto_key, Js_of_ocaml.Js.Js_error.error_t) Ezjs_min.result -> unit) -> unit
val unwrap_key : ?extractable:bool -> ?format:key_format -> wkey:Ezjs_min.Typed_array.Bigstring.t -> ukey:crypt_usage crypto_key -> ualgo:crypt_params -> ukeyalgo:import_params -> usages:[< usage ] list -> ((usage crypto_key, Js_of_ocaml.Js.Js_error.error_t) Ezjs_min.result -> unit) -> unit