@sphereon/ssi-sdk-ext.jwt-service 0.24.1-unstable.92 → 0.25.0
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/README.md +73 -374
- package/dist/agent/JwtService.d.ts +3 -0
- package/dist/agent/JwtService.d.ts.map +1 -1
- package/dist/agent/JwtService.js +78 -1
- package/dist/agent/JwtService.js.map +1 -1
- package/dist/functions/JWE.d.ts +75 -0
- package/dist/functions/JWE.d.ts.map +1 -0
- package/dist/functions/JWE.js +280 -0
- package/dist/functions/JWE.js.map +1 -0
- package/dist/functions/index.d.ts +19 -5
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +155 -19
- package/dist/functions/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/IJwtService.d.ts +149 -20
- package/dist/types/IJwtService.d.ts.map +1 -1
- package/dist/types/IJwtService.js +54 -1
- package/dist/types/IJwtService.js.map +1 -1
- package/package.json +15 -13
- package/plugin.schema.json +4212 -282
- package/src/agent/JwtService.ts +103 -39
- package/src/functions/JWE.ts +360 -0
- package/src/functions/index.ts +184 -26
- package/src/index.ts +4 -0
- package/src/types/IJwtService.ts +272 -55
|
@@ -1,4 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.JweEncs = exports.JweAlgs = exports.COMPACT_JWE_REGEX = exports.COMPACT_JWS_REGEX = exports.jwtServiceContextMethods = void 0;
|
|
4
|
+
exports.isJwsCompact = isJwsCompact;
|
|
5
|
+
exports.isJweCompact = isJweCompact;
|
|
6
|
+
exports.isJwsJsonFlattened = isJwsJsonFlattened;
|
|
7
|
+
exports.isJwsJsonGeneral = isJwsJsonGeneral;
|
|
8
|
+
exports.isJweJsonFlattened = isJweJsonFlattened;
|
|
9
|
+
exports.isJweJsonGeneral = isJweJsonGeneral;
|
|
10
|
+
exports.isJwsHeader = isJwsHeader;
|
|
11
|
+
exports.isJweHeader = isJweHeader;
|
|
12
|
+
exports.jweAlg = jweAlg;
|
|
13
|
+
exports.jweEnc = jweEnc;
|
|
14
|
+
exports.jwtServiceContextMethods = [
|
|
15
|
+
'jwtPrepareJws',
|
|
16
|
+
'jwtCreateJwsJsonGeneralSignature',
|
|
17
|
+
'jwtCreateJwsJsonFlattenedSignature',
|
|
18
|
+
'jwtCreateJwsCompactSignature',
|
|
19
|
+
'jwtVerifyJwsSignature',
|
|
20
|
+
'jwtEncryptJweCompactJwt',
|
|
21
|
+
'jwtDecryptJweCompactJwt'
|
|
22
|
+
];
|
|
23
|
+
function isJwsCompact(jws) {
|
|
24
|
+
return typeof jws === 'string' && jws.split('~')[0].match(exports.COMPACT_JWS_REGEX) !== null;
|
|
25
|
+
}
|
|
26
|
+
function isJweCompact(jwe) {
|
|
27
|
+
return typeof jwe === 'string' && jwe.split('~')[0].match(exports.COMPACT_JWE_REGEX) !== null;
|
|
28
|
+
}
|
|
29
|
+
function isJwsJsonFlattened(jws) {
|
|
30
|
+
return typeof jws === 'object' && 'signature' in jws && 'protected' in jws && !('ciphertext' in jws);
|
|
31
|
+
}
|
|
32
|
+
function isJwsJsonGeneral(jws) {
|
|
33
|
+
return typeof jws === 'object' && 'signatures' in jws && !('ciphertext' in jws);
|
|
34
|
+
}
|
|
35
|
+
function isJweJsonFlattened(jwe) {
|
|
36
|
+
return typeof jwe === 'object' && 'signature' in jwe && 'ciphertext' in jwe && !('payload' in jwe);
|
|
37
|
+
}
|
|
38
|
+
function isJweJsonGeneral(jwe) {
|
|
39
|
+
return typeof jwe === 'object' && 'signatures' in jwe && 'ciphertext' in jwe && !('payload' in jwe);
|
|
40
|
+
}
|
|
41
|
+
function isJwsHeader(header) {
|
|
42
|
+
return header && !isJweHeader(header);
|
|
43
|
+
}
|
|
44
|
+
function isJweHeader(header) {
|
|
45
|
+
return ('enc' in header && header.enc && jweEnc(header.enc)) || (header.alg && jweAlg(header.alg));
|
|
46
|
+
}
|
|
47
|
+
exports.COMPACT_JWS_REGEX = /^([a-zA-Z0-9_=-]+).([a-zA-Z0-9_=-]+)?.([a-zA-Z0-9_=-]+)?$/;
|
|
48
|
+
exports.COMPACT_JWE_REGEX = /^([a-zA-Z0-9_=-]+)\.([a-zA-Z0-9_=-]+)?\.([a-zA-Z0-9_=-]+)\.([a-zA-Z0-9_=-]+)?\.([a-zA-Z0-9_=-]+)?$/;
|
|
49
|
+
exports.JweAlgs = ['RSA1_5', 'RSA-OAEP', 'RSA-OAEP-256', 'A128KW', 'A192KW', 'A256KW', 'dir', 'ECDH-ES' /*interop value*/, 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW', 'PBES2-HS256+A128KW', 'PBES2-HS384+A192KW', 'PBES2-HS512+A256KW'];
|
|
50
|
+
function jweAlg(alg) {
|
|
51
|
+
return exports.JweAlgs.find((supportedVal) => supportedVal === alg);
|
|
52
|
+
}
|
|
53
|
+
exports.JweEncs = ['A128CBC-HS256', 'A192CBC-HS384', 'A256CBC-HS512', 'A128GCM', 'A192GCM', 'A256GCM' /*interop value*/];
|
|
54
|
+
function jweEnc(alg) {
|
|
55
|
+
return exports.JweEncs.find((supportedVal) => supportedVal === alg);
|
|
56
|
+
}
|
|
4
57
|
//# sourceMappingURL=IJwtService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IJwtService.js","sourceRoot":"","sources":["../../src/types/IJwtService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IJwtService.js","sourceRoot":"","sources":["../../src/types/IJwtService.ts"],"names":[],"mappings":";;;AAsRA,oCAEC;AAED,oCAEC;AAGD,gDAEC;AAED,4CAEC;AAGD,gDAEC;AAED,4CAEC;AAGD,kCAEC;AAED,kC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3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,24 +15,26 @@
|
|
|
15
15
|
"generate-plugin-schema": "sphereon dev generate-plugin-schema"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.
|
|
19
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.
|
|
20
|
-
"@sphereon/ssi-sdk-ext.key-manager": "0.
|
|
21
|
-
"@sphereon/ssi-sdk-ext.key-utils": "0.
|
|
22
|
-
"@sphereon/ssi-sdk-ext.x509-utils": "0.
|
|
23
|
-
"@sphereon/ssi-sdk.agent-config": "0.
|
|
24
|
-
"@sphereon/ssi-types": "0.
|
|
18
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.25.0",
|
|
19
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.25.0",
|
|
20
|
+
"@sphereon/ssi-sdk-ext.key-manager": "0.25.0",
|
|
21
|
+
"@sphereon/ssi-sdk-ext.key-utils": "0.25.0",
|
|
22
|
+
"@sphereon/ssi-sdk-ext.x509-utils": "0.25.0",
|
|
23
|
+
"@sphereon/ssi-sdk.agent-config": "0.30.1",
|
|
24
|
+
"@sphereon/ssi-types": "0.30.1",
|
|
25
|
+
"@stablelib/random": "^1.0.2",
|
|
25
26
|
"@veramo/core": "4.2.0",
|
|
26
27
|
"@veramo/utils": "4.2.0",
|
|
27
28
|
"debug": "^4.3.4",
|
|
29
|
+
"jose": "^5.9.3",
|
|
28
30
|
"jwt-decode": "^4.0.0",
|
|
29
31
|
"uint8arrays": "^3.1.1"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.
|
|
33
|
-
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.
|
|
34
|
-
"@sphereon/ssi-sdk-ext.kms-local": "0.
|
|
35
|
-
"@sphereon/ssi-sdk.dev": "0.
|
|
34
|
+
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.25.0",
|
|
35
|
+
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.25.0",
|
|
36
|
+
"@sphereon/ssi-sdk-ext.kms-local": "0.25.0",
|
|
37
|
+
"@sphereon/ssi-sdk.dev": "0.30.1",
|
|
36
38
|
"@veramo/data-store": "4.2.0",
|
|
37
39
|
"@veramo/did-manager": "4.2.0",
|
|
38
40
|
"@veramo/did-resolver": "4.2.0",
|
|
@@ -66,5 +68,5 @@
|
|
|
66
68
|
"X.509 Certificates",
|
|
67
69
|
"ARF"
|
|
68
70
|
],
|
|
69
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "ca2cc4d0d45bc7e0b25dccc0068420b33bbc4c47"
|
|
70
72
|
}
|