deno.land / x / jose@v5.2.4 / lib / aesgcmkw.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import encrypt from '../runtime/encrypt.ts'import decrypt from '../runtime/decrypt.ts'import { encode as base64url } from '../runtime/base64url.ts'
export async function wrap(alg: string, key: unknown, cek: Uint8Array, iv?: Uint8Array) { const jweAlgorithm = alg.slice(0, 7)
const wrapped = await encrypt(jweAlgorithm, cek, key, iv, new Uint8Array(0))
return { encryptedKey: wrapped.ciphertext, iv: base64url(wrapped.iv!), tag: base64url(wrapped.tag!), }}
export async function unwrap( alg: string, key: unknown, encryptedKey: Uint8Array, iv: Uint8Array, tag: Uint8Array,) { const jweAlgorithm = alg.slice(0, 7) return decrypt(jweAlgorithm, key, encryptedKey, iv, tag, new Uint8Array(0))}
jose

Version Info

Tagged at
a month ago