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

Function encrypt

src/lib/rsaes.ts:20–27  ·  view source on GitHub ↗
(alg: string, key: types.CryptoKey, cek: Uint8Array)

Source from the content-addressed store, hash-verified

18}
19
20export async function encrypt(alg: string, key: types.CryptoKey, cek: Uint8Array) {
21 checkEncCryptoKey(key, alg, 'encrypt')
22 checkKeyLength(alg, key)
23
24 return new Uint8Array(
25 await crypto.subtle.encrypt(subtleAlgorithm(alg), key, cek as Uint8Array<ArrayBuffer>),
26 )
27}
28
29export async function decrypt(alg: string, key: types.CryptoKey, encryptedKey: Uint8Array) {
30 checkEncCryptoKey(key, alg, 'decrypt')

Callers 2

wrapFunction · 0.70
encryptMethod · 0.50

Calls 4

checkEncCryptoKeyFunction · 0.85
checkKeyLengthFunction · 0.85
subtleAlgorithmFunction · 0.70
encryptMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…