@kokuin/jwe 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -0
- package/package.json +9 -9
package/lib/index.js
CHANGED
|
@@ -274,6 +274,9 @@ export function createTokenEncrypter(recipient, options) {
|
|
|
274
274
|
throw new Error(`Invalid JWE format: expected 5 parts, got ${parts.length}`);
|
|
275
275
|
}
|
|
276
276
|
const [encodedHeader, _encryptedKey, encodedIV, encodedCiphertext, encodedTag] = parts;
|
|
277
|
+
if (encodedHeader === undefined || encodedIV === undefined || encodedCiphertext === undefined || encodedTag === undefined) {
|
|
278
|
+
throw new Error('Invalid JWE format: expected 5 parts separated by dots');
|
|
279
|
+
}
|
|
277
280
|
// Parse protected header
|
|
278
281
|
const header = b64uToJSON(encodedHeader);
|
|
279
282
|
if (header.alg !== 'ECDH-ES') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kokuin/jwe",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "JWE encryption for kokuin tokens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"json",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"lib/*"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@noble/
|
|
30
|
-
"@noble/
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
28
|
+
"@kokuin/token": "^0.6.0",
|
|
29
|
+
"@noble/ciphers": "^2.4.0",
|
|
30
|
+
"@noble/curves": "^2.4.0",
|
|
31
|
+
"@noble/hashes": "^2.4.0",
|
|
32
|
+
"@sozai/codec": "^0.4.3"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "pnpm run build:clean && pnpm run build:js && pnpm run build:types",
|
|
39
|
-
"build:clean": "del lib",
|
|
40
|
-
"build:js": "swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
|
|
41
|
-
"build:types": "tsc --emitDeclarationOnly --skipLibCheck",
|
|
39
|
+
"build:clean": "del-cli lib",
|
|
40
|
+
"build:js": "del-cli 'lib/**/*.js' && swc src -d ./lib --config-file ../../node_modules/@kigu/dev/swc.json --strip-leading-paths",
|
|
41
|
+
"build:types": "del-cli 'lib/**/*.d.ts' 'lib/**/*.d.ts.map' && tsc --emitDeclarationOnly --skipLibCheck",
|
|
42
42
|
"test": "pnpm run test:types && pnpm run test:unit",
|
|
43
43
|
"test:types": "tsc --noEmit --skipLibCheck -p tsconfig.test.json",
|
|
44
44
|
"test:unit": "vitest run"
|