Brr_webcrypto.Subtle_cryptoSubtleCrypto objects
The type for SubtleCrypto objects.
val encrypt :
t ->
Crypto_algo.t ->
Crypto_key.t ->
('a, 'b) Brr.Tarray.t ->
Brr.Tarray.Buffer.t Fut.or_errorencrypt s a k data is data encrypted with key k and algorithm a.
val decrypt :
t ->
Crypto_algo.t ->
Crypto_key.t ->
('a, 'b) Brr.Tarray.t ->
Brr.Tarray.Buffer.t Fut.or_errordecrypt s a k data is data decrypted with key k and algorithm a.
val digest :
t ->
Crypto_algo.t ->
('a, 'b) Brr.Tarray.t ->
Brr.Tarray.Buffer.t Fut.or_errordigest s a data is the digest of data according to algorithm a.
val sign :
t ->
Crypto_algo.t ->
Crypto_key.t ->
('a, 'b) Brr.Tarray.t ->
Brr.Tarray.Buffer.t Fut.or_errorsign s a k data is the signature of data with key k and algorithm a.
val verify :
t ->
Crypto_algo.t ->
Crypto_key.t ->
sig':('a, 'b) Brr.Tarray.t ->
('c, 'd) Brr.Tarray.t ->
bool Fut.or_errorverify s a k ~sig' data is true iff the signature of data with key k and algorithm a matches sig'.
val generate_key :
t ->
Crypto_algo.t ->
extractable:bool ->
usages:Crypto_key.Usage.t list ->
Crypto_key.t Fut.or_errorgenerate_key s a ~extractable ~usage is a key generated for algorithm a and usages usages. Warning if the algorithm generates a key pair use generate_key_pair.
val generate_key_pair :
t ->
Crypto_algo.t ->
extractable:bool ->
usages:Crypto_key.Usage.t list ->
Crypto_key.pair Fut.or_errorgenerate_key s a ~extractable ~usage is a key generated of type and parameters a and usages usages. Warning if the algorithm generates a single key use generate_key.
val derive_bits :
t ->
Crypto_algo.t ->
Crypto_key.t ->
int ->
Brr.Tarray.Buffer.t Fut.or_errorderive_bits s a k l are l bits derived from k with algorithm a.
val derive_key :
t ->
Crypto_algo.t ->
Crypto_key.t ->
derived:Crypto_algo.t ->
extractable:bool ->
usages:Crypto_key.Usage.t list ->
Crypto_key.t Fut.or_errorderive_key s a k ~derived_type ~extractable ~usages is a key of type and parameters ~derived and usages usages derived from key k of type and parameters a.
val export_key :
t ->
Crypto_key.Format.t ->
Crypto_key.t ->
[ `Buffer of Brr.Tarray.Buffer.t | `Json_web_key of Brr.Json.t ] Fut.or_errorexport_key s f k is the key k exported in format f. `Json_web_key is only returned if Crypto_key.Format.jwk is specified.
val import_key :
t ->
Crypto_key.Format.t ->
[ `Buffer of Brr.Tarray.Buffer.t | `Json_web_key of Brr.Json.t ] ->
Crypto_algo.t ->
extractable:bool ->
usages:Crypto_key.Usage.t list ->
Crypto_key.t Fut.or_errorimport_key s f k a ~extractable ~usage is the key k imported from format f and type a used for usages.
val wrap_key :
t ->
Crypto_key.Format.t ->
Crypto_key.t ->
wrap_key:Crypto_key.t ->
wrapper:Crypto_algo.t ->
Brr.Tarray.Buffer.t Fut.or_errorwrap_key s f k ~wrap_key ~wrapper is like export_key but encrypts the result with wrap_key ad algorithm wrapper.
val unwrap_key :
t ->
Crypto_key.Format.t ->
('a, 'b) Brr.Tarray.t ->
wrap_key:Crypto_key.t ->
wrapper:Crypto_algo.t ->
unwrapped:Crypto_algo.t ->
extractable:bool ->
usages:Crypto_key.Usage.t list ->
Crypto_key.t Fut.or_errorunwrap_key s f b ~wrap_key ~wrapper ~unwrapped ~extractable ~usages is like import_key but unwraps the wrapper of b made wtih wrap_key and algorithm wrapped.