ezjs_crypto

Bindings for SubtleCrypto
Module Ezjs_crypto
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 =
| P256
| P384
| P521
type sha_algo =
| SHA1
| SHA256
| SHA384
| SHA512
type rsa_kind =
| PKCS
| PSS
| OAEP
type aes_kind =
| CTR
| CBC
| GCM
type ec_kind =
| DSA
| DH
type sign_usage = [
| `Sign
| `Verify
]
type crypt_usage = [
| `Encrypt
| `Decrypt
| `WrapKey
| `UnwrapKey
]
type derive_usage = [
| `DeriveKey
| `DeriveBits
]
type usage = [
| sign_usage
| crypt_usage
| derive_usage
]
type sign_params =
| RSA_PKCS
| RSA_PSS of int
| ECDSA of sha_algo
| HMAC
type crypt_params =
| RSA_OAEP of Ezjs_min.Typed_array.Bigstring.t option
| AES_CTR of Ezjs_min.Typed_array.Bigstring.t * int
| AES_CBC of Ezjs_min.Typed_array.Bigstring.t
| AES_GCM of Ezjs_min.Typed_array.Bigstring.t * Ezjs_min.Typed_array.Bigstring.t option * int option
type keygen_params =
| GRSA of rsa_kind * int * sha_algo * int list option
| GEC of ec_kind * ec_curve
| GHMAC of sha_algo * int option
| GAES of aes_kind * int
type import_params =
| IRSA of rsa_kind * sha_algo
| IEC of ec_kind * ec_curve
| IHMAC of sha_algo
| IAES of aes_kind
| IHKDF
| IPBKDF2
type key_format =
| Raw
| PKCS8
| SPKI
| JWK
type 'usage crypto_key = {
kind : string;
extractable : bool;
algorithm : keygen_params;
usages : 'usage list;
}
type 'usage crypto_keypair = {
public_key : 'usage crypto_key;
private_key : 'usage crypto_key;
}
type 'usage crypto_key_all =
| CKey of 'usage crypto_key
| 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 encrypt : algo:crypt_params -> key:crypt_usage crypto_key -> Ezjs_min.Typed_array.Bigstring.t -> ( ( Ezjs_min.Typed_array.Bigstring.t, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val decrypt : algo:crypt_params -> key:crypt_usage crypto_key -> Ezjs_min.Typed_array.Bigstring.t -> ( ( Ezjs_min.Typed_array.Bigstring.t, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val sign : algo:sign_params -> key:sign_usage crypto_key -> Ezjs_min.Typed_array.Bigstring.t -> ( ( Ezjs_min.Typed_array.Bigstring.t, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val verify : algo:sign_params -> key:sign_usage crypto_key -> Ezjs_min.Typed_array.Bigstring.t -> Ezjs_min.Typed_array.Bigstring.t -> ( ( bool, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val digest : algo:sha_algo -> Ezjs_min.Typed_array.Bigstring.t -> ( ( Ezjs_min.Typed_array.Bigstring.t, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val generate_symmetric_key : ?extractable:bool -> algo:keygen_params -> usages:[< usage ] list -> ( ( usage crypto_key, Ezjs_min__Js.error Ezjs_min__Js.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, Ezjs_min__Js.error Ezjs_min__Js.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, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val derive_bits : algo:derive_algo -> key:derive_usage crypto_key -> length:int -> ( ( Ezjs_min.Typed_array.Bigstring.t, Ezjs_min__Js.error Ezjs_min__Js.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, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val export_key : ?format:key_format -> [< usage ] crypto_key -> ( ( Ezjs_min.Typed_array.Bigstring.t, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit
val wrap_key : ?format:key_format -> key:[< usage ] crypto_key -> wkey:crypt_usage crypto_key -> algo:crypt_params -> ( ( Ezjs_min.Typed_array.Bigstring.t, Ezjs_min__Js.error Ezjs_min__Js.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, Ezjs_min__Js.error Ezjs_min__Js.t ) Ezjs_min.result -> unit ) -> unit