SubtleCrypto
Types
algorithm
type algorithm = WebAPI.WebCryptoTypes.algorithmRecord fields
name
string
hash
option<keyAlgorithm>
length
option<int>
namedCurve
option<string>
iv
counter
additionalData
tagLength
option<int>
salt
iterations
option<int>
info
publicKey
option<cryptoKey>
saltLength
option<int>
modulusLength
option<int>
publicExponent
option<Uint8Array.t>
primeLength
option<int>
subprimeLength
option<int>
generator
label
algorithmIdentifier
type algorithmIdentifier = WebAPI.WebCryptoTypes.algorithmIdentifierbinaryData
type binaryData = WebAPI.ArrayBufferTypedArrayOrDataView.tbinaryKeyFormat
type binaryKeyFormat = | @as("raw") Raw | @as("pkcs8") Pkcs8 | @as("spki") SpkicryptoKey
type cryptoKey = WebAPI.WebCryptoTypes.cryptoKeyRecord fields
cryptoKeyPair
type cryptoKeyPair = WebAPI.WebCryptoTypes.cryptoKeyPairRecord fields
privateKey
publicKey
jwkKeyFormat
type jwkKeyFormat = @as("jwk") JwkkeyAlgorithm
type keyAlgorithm = WebAPI.WebCryptoTypes.keyAlgorithmRecord fields
name
string
keyFormat
type keyFormat = WebAPI.WebCryptoTypes.keyFormatkeyType
type keyType = WebAPI.WebCryptoTypes.keyTypekeyUsage
type keyUsage = WebAPI.WebCryptoTypes.keyUsaget
type t = WebAPI.WebCryptoTypes.subtleCryptoValues
algorithmObject
let algorithmObject: algorithm => algorithmIdentifieralgorithmString
let algorithmString: string => algorithmIdentifierbinaryDataFromArrayBuffer
let binaryDataFromArrayBuffer: ArrayBuffer.t => binaryDatabinaryDataFromDataView
let binaryDataFromDataView: DataView.t => binaryDatabinaryDataFromUint8Array
let binaryDataFromUint8Array: Uint8Array.t => binaryDatadecrypt
let decrypt: ( t, ~algorithm: algorithmIdentifier, ~key: cryptoKey, ~data: WebAPI.ArrayBufferTypedArrayOrDataView.t,) => promise<ArrayBuffer.t>decryptUsage
let decryptUsage: WebAPI.WebCryptoTypes.keyUsagederiveBits
let deriveBits: ( t, ~algorithm: algorithmIdentifier, ~baseKey: cryptoKey, ~length: int=?,) => promise<ArrayBuffer.t>Parameters
~algorithm: algorithmIdentifier
~baseKey: cryptoKey
~length: int=?
Return type
promise<ArrayBuffer.t>deriveBits2
let deriveBits2: ( t, ~algorithm: string, ~baseKey: cryptoKey, ~length: int=?,) => promise<ArrayBuffer.t>deriveBitsUsage
let deriveBitsUsage: WebAPI.WebCryptoTypes.keyUsagederiveKey
let deriveKey: ( t, ~algorithm: algorithmIdentifier, ~baseKey: cryptoKey, ~derivedKeyType: algorithmIdentifier, ~extractable: bool, ~keyUsages: array<keyUsage>,) => promise<cryptoKey>Parameters
~algorithm: algorithmIdentifier
~baseKey: cryptoKey
~derivedKeyType: algorithmIdentifier
~extractable: bool
~keyUsages: array<keyUsage>
Return type
promise<cryptoKey>deriveKeyUsage
let deriveKeyUsage: WebAPI.WebCryptoTypes.keyUsagedigest
let digest: ( t, ~algorithm: algorithmIdentifier, ~data: WebAPI.ArrayBufferTypedArrayOrDataView.t,) => promise<ArrayBuffer.t>encrypt
let encrypt: ( t, ~algorithm: algorithmIdentifier, ~key: cryptoKey, ~data: WebAPI.ArrayBufferTypedArrayOrDataView.t,) => promise<ArrayBuffer.t>encryptUsage
let encryptUsage: WebAPI.WebCryptoTypes.keyUsageexportKey
let exportKey: (t, ~format: keyFormat, ~key: cryptoKey) => promise<unknown>exportKeyBinary
let exportKeyBinary: ( t, ~format: binaryKeyFormat, ~key: cryptoKey,) => promise<ArrayBuffer.t>exportKeyJwk
let exportKeyJwk: ( t, ~format: jwkKeyFormat, ~key: cryptoKey,) => promise<JSON.t>generateEcdsaKeyPair
Generates an ECDSA public/private key pair. The fixed algorithm guarantees the native result shape.
let generateEcdsaKeyPair: ( t, ~namedCurve: string, ~extractable: bool, ~keyUsages: array<keyUsage>,) => promise<cryptoKeyPair>Parameters
~namedCurve: string
~extractable: bool
~keyUsages: array<keyUsage>
Return type
promise<cryptoKeyPair>generateKey
let generateKey: ( t, ~algorithm: algorithmIdentifier, ~extractable: bool, ~keyUsages: array<keyUsage>,) => promise<unknown>Parameters
~algorithm: algorithmIdentifier
~extractable: bool
~keyUsages: array<keyUsage>
Return type
promise<unknown>generateKey2
let generateKey2: ( t, ~algorithm: string, ~extractable: bool, ~keyUsages: array<keyUsage>,) => promise<unknown>generateKeySymmetric
let generateKeySymmetric: ( t, ~hash: algorithmIdentifier, ~length: int, ~extractable: bool, ~keyUsages: array<keyUsage>,) => promise<cryptoKey>Parameters
~hash: algorithmIdentifier
~length: int
~extractable: bool
~keyUsages: array<keyUsage>
Return type
promise<cryptoKey>importKey
let importKey: ( t, ~format: keyFormat, ~keyData: WebAPI.ArrayBufferTypedArrayOrDataView.t, ~algorithm: algorithmIdentifier, ~extractable: bool, ~keyUsages: array<keyUsage>,) => promise<cryptoKey>Parameters
~format: keyFormat
~keyData: WebAPI.ArrayBufferTypedArrayOrDataView.t
~algorithm: algorithmIdentifier
~extractable: bool
~keyUsages: array<keyUsage>
Return type
promise<cryptoKey>jwkFormat
let jwkFormat: WebAPI.WebCryptoTypes.keyFormatpkcs8KeyFormat
let pkcs8KeyFormat: WebAPI.WebCryptoTypes.keyFormatrawKeyFormat
let rawKeyFormat: WebAPI.WebCryptoTypes.keyFormatsign
let sign: ( t, ~algorithm: algorithmIdentifier, ~key: cryptoKey, ~data: WebAPI.ArrayBufferTypedArrayOrDataView.t,) => promise<ArrayBuffer.t>signUsage
let signUsage: WebAPI.WebCryptoTypes.keyUsagespkiKeyFormat
let spkiKeyFormat: WebAPI.WebCryptoTypes.keyFormatunwrapKey
let unwrapKey: ( t, ~format: keyFormat, ~wrappedKey: WebAPI.ArrayBufferTypedArrayOrDataView.t, ~unwrappingKey: cryptoKey, ~unwrapAlgorithm: algorithmIdentifier, ~unwrappedKeyAlgorithm: algorithmIdentifier, ~extractable: bool, ~keyUsages: array<keyUsage>,) => promise<cryptoKey>Parameters
~format: keyFormat
~wrappedKey: WebAPI.ArrayBufferTypedArrayOrDataView.t
~unwrappingKey: cryptoKey
~unwrapAlgorithm: algorithmIdentifier
~unwrappedKeyAlgorithm: algorithmIdentifier
~extractable: bool
~keyUsages: array<keyUsage>
Return type
promise<cryptoKey>unwrapKeyUsage
let unwrapKeyUsage: WebAPI.WebCryptoTypes.keyUsageverify
let verify: ( t, ~algorithm: algorithmIdentifier, ~key: cryptoKey, ~signature: WebAPI.ArrayBufferTypedArrayOrDataView.t, ~data: WebAPI.ArrayBufferTypedArrayOrDataView.t,) => promise<bool>Parameters
~algorithm: algorithmIdentifier
~key: cryptoKey
~signature: WebAPI.ArrayBufferTypedArrayOrDataView.t
Return type
promise<bool>verifyUsage
let verifyUsage: WebAPI.WebCryptoTypes.keyUsagewrapKey
let wrapKey: ( t, ~format: keyFormat, ~key: cryptoKey, ~wrappingKey: cryptoKey, ~wrapAlgorithm: algorithmIdentifier,) => promise<ArrayBuffer.t>Parameters
~format: keyFormat
~key: cryptoKey
~wrappingKey: cryptoKey
~wrapAlgorithm: algorithmIdentifier
Return type
promise<ArrayBuffer.t>wrapKey2
let wrapKey2: ( t, ~format: keyFormat, ~key: cryptoKey, ~wrappingKey: cryptoKey, ~wrapAlgorithm: string,) => promise<ArrayBuffer.t>wrapKeyUsage
let wrapKeyUsage: WebAPI.WebCryptoTypes.keyUsage