MCPcopy
hub / github.com/panva/jose / sign

Function sign

src/lib/signing.ts:66–75  ·  view source on GitHub ↗
(alg: string, key: types.CryptoKey | Uint8Array, data: Uint8Array)

Source from the content-addressed store, hash-verified

64}
65
66export async function sign(alg: string, key: types.CryptoKey | Uint8Array, data: Uint8Array) {
67 const cryptoKey = await getSigKey(alg, key, 'sign')
68 checkKeyLength(alg, cryptoKey)
69 const signature = await crypto.subtle.sign(
70 subtleAlgorithm(alg, cryptoKey.algorithm),
71 cryptoKey,
72 data as Uint8Array<ArrayBuffer>,
73 )
74 return new Uint8Array(signature)
75}
76
77export async function verify(
78 alg: string,

Callers 1

signMethod · 0.85

Calls 4

getSigKeyFunction · 0.85
checkKeyLengthFunction · 0.85
subtleAlgorithmFunction · 0.70
signMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…