signData
signData
Signs data with a WebCrypto private key and returns the signature beside the resolved AlgorithmIdentifier material for embedding in a signed structure.
The algorithm is inferred from the key (RSASSA-PKCS1-v1_5, ECDSA, Ed25519); RSA-PSS keys require an explicit { kind: 'rsa-pss' } profile. ECDSA signatures are returned DER-encoded. Throws on unsupported key algorithms.
ts
function signData(
privateKey: CryptoKey,
data: Uint8Array,
profile?: SignatureProfileInput,
): Promise<SignDataResult>Parameters
privateKey:CryptoKeydata:Uint8Arrayprofile?:SignatureProfileInput