@sphereon/ssi-sdk-ext.jwt-service 0.24.1-unstable.85

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.
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.JwtService = void 0;
13
+ const __1 = require("..");
14
+ /**
15
+ * @public
16
+ */
17
+ class JwtService {
18
+ constructor() {
19
+ this.schema = __1.schema.IMnemonicInfoGenerator;
20
+ this.methods = {
21
+ jwtPrepareJws: this.jwtPrepareJws.bind(this),
22
+ jwtCreateJwsJsonGeneralSignature: this.jwtCreateJwsJsonGeneralSignature.bind(this),
23
+ jwtCreateJwsJsonFlattenedSignature: this.jwtCreateJwsJsonFlattenedSignature.bind(this),
24
+ jwtCreateJwsCompactSignature: this.jwtCreateJwsCompactSignature.bind(this),
25
+ };
26
+ }
27
+ jwtPrepareJws(args, context) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return yield (0, __1.prepareJwsObject)(args, context);
30
+ });
31
+ }
32
+ jwtCreateJwsJsonGeneralSignature(args, context) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ return yield (0, __1.createJwsJsonGeneral)(args, context);
35
+ });
36
+ }
37
+ jwtCreateJwsJsonFlattenedSignature(args, context) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ return yield (0, __1.createJwsJsonFlattened)(args, context);
40
+ });
41
+ }
42
+ jwtCreateJwsCompactSignature(args, context) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ // We wrap it in a json object for remote REST calls
45
+ return { jwt: yield (0, __1.createJwsCompact)(args, context) };
46
+ });
47
+ }
48
+ }
49
+ exports.JwtService = JwtService;
50
+ //# sourceMappingURL=JwtService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JwtService.js","sourceRoot":"","sources":["../../src/agent/JwtService.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0BAcW;AAGX;;GAEG;AACH,MAAa,UAAU;IAAvB;QACW,WAAM,GAAG,UAAM,CAAC,sBAAsB,CAAA;QACtC,YAAO,GAAgB;YAC9B,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5C,gCAAgC,EAAE,IAAI,CAAC,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC;YAClF,kCAAkC,EAAE,IAAI,CAAC,kCAAkC,CAAC,IAAI,CAAC,IAAI,CAAC;YACtF,4BAA4B,EAAE,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC;SAC3E,CAAA;IAqBH,CAAC;IAnBe,aAAa,CAAC,IAAuB,EAAE,OAAyB;;YAC5E,OAAO,MAAM,IAAA,oBAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC9C,CAAC;KAAA;IAEa,gCAAgC,CAAC,IAAuB,EAAE,OAAyB;;YAC/F,OAAO,MAAM,IAAA,wBAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAClD,CAAC;KAAA;IAEa,kCAAkC,CAAC,IAA4B,EAAE,OAAyB;;YACtG,OAAO,MAAM,IAAA,0BAAsB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACpD,CAAC;KAAA;IAEa,4BAA4B,CACxC,IAA0B,EAC1B,OAAyB;;YAEzB,oDAAoD;YACpD,OAAO,EAAE,GAAG,EAAE,MAAM,IAAA,oBAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAA;QACvD,CAAC;KAAA;CACF;AA5BD,gCA4BC"}
@@ -0,0 +1,21 @@
1
+ import { ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
2
+ import { CreateJwsCompactArgs, CreateJwsFlattenedArgs, CreateJwsJsonArgs, CreateJwsMode, IRequiredContext, JwsCompact, JwsJsonFlattened, JwsJsonGeneral, JwtHeader, PreparedJwsObject } from '../types/IJwtService';
3
+ export declare const prepareJwsObject: (args: CreateJwsJsonArgs, context: IRequiredContext) => Promise<PreparedJwsObject>;
4
+ export declare const createJwsCompact: (args: CreateJwsCompactArgs, context: IRequiredContext) => Promise<JwsCompact>;
5
+ export declare const createJwsJsonFlattened: (args: CreateJwsFlattenedArgs, context: IRequiredContext) => Promise<JwsJsonFlattened>;
6
+ export declare const createJwsJsonGeneral: (args: CreateJwsJsonArgs, context: IRequiredContext) => Promise<JwsJsonGeneral>;
7
+ /**
8
+ * Updates the JWT header to include x5c, kid, jwk objects using the supplied issuer identifier that will be used to sign. If not present will automatically make the header objects available
9
+ * @param mode The type of header to check or include
10
+ * @param identifier The identifier of the signer. This identifier will be used later to sign
11
+ * @param header The JWT header
12
+ * @param noIdentifierInHeader
13
+ * @param context
14
+ */
15
+ export declare const checkAndUpdateJwtHeader: ({ mode, identifier, header, noIdentifierInHeader }: {
16
+ mode?: CreateJwsMode;
17
+ identifier: ManagedIdentifierResult;
18
+ noIdentifierInHeader?: boolean;
19
+ header: JwtHeader;
20
+ }, context: IRequiredContext) => Promise<undefined>;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,uBAAuB,EAC1B,MAAM,6CAA6C,CAAA;AAGpD,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,cAAc,EAEd,SAAS,EACT,iBAAiB,EACpB,MAAM,sBAAsB,CAAA;AAE7B,eAAO,MAAM,gBAAgB,SAAgB,iBAAiB,gCAA8B,QAAQ,iBAAiB,CA2CpH,CAAA;AAED,eAAO,MAAM,gBAAgB,SAAgB,oBAAoB,gCAA8B,QAAQ,UAAU,CAGhH,CAAA;AAED,eAAO,MAAM,sBAAsB,SAAgB,sBAAsB,gCAA8B,QAAQ,gBAAgB,CAS9H,CAAA;AAED,eAAO,MAAM,oBAAoB,SAAgB,iBAAiB,gCAA8B,QAAQ,cAAc,CA4BrH,CAAA;AAED;;;;;;;GAOG;AAEH,eAAO,MAAM,uBAAuB,uDAM7B;IACC,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,UAAU,EAAE,uBAAuB,CAAA;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,MAAM,EAAE,SAAS,CAAA;CACpB,kDAsBJ,CAAA"}
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.checkAndUpdateJwtHeader = exports.createJwsJsonGeneral = exports.createJwsJsonFlattened = exports.createJwsCompact = exports.prepareJwsObject = void 0;
36
+ const ssi_sdk_ext_identifier_resolution_1 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
37
+ const utils_1 = require("@veramo/utils");
38
+ const u8a = __importStar(require("uint8arrays"));
39
+ const prepareJwsObject = (args, context) => __awaiter(void 0, void 0, void 0, function* () {
40
+ const { existingSignatures, protectedHeader, unprotectedHeader, issuer, payload, mode = 'auto' } = args;
41
+ const { noIdentifierInHeader = false } = issuer;
42
+ const combinedHeader = Object.assign(Object.assign({}, unprotectedHeader), protectedHeader);
43
+ if (!combinedHeader.alg) {
44
+ return Promise.reject(`No 'alg' key present in the JWS header`);
45
+ }
46
+ const identifier = yield context.agent.identifierManagedGet(issuer);
47
+ yield (0, exports.checkAndUpdateJwtHeader)({ mode, identifier, noIdentifierInHeader, header: protectedHeader }, context);
48
+ const isBytes = payload instanceof Uint8Array;
49
+ const isString = typeof payload === 'string';
50
+ if (!isBytes && !isString) {
51
+ if (issuer.noIssPayloadUpdate !== true && !payload.iss && identifier.issuer) {
52
+ payload.iss = identifier.issuer;
53
+ }
54
+ }
55
+ const payloadBytes = isBytes ? payload : (isString ? u8a.fromString(payload, 'base64url') : u8a.fromString(JSON.stringify(payload), 'utf-8'));
56
+ const base64urlHeader = (0, utils_1.encodeJoseBlob)(protectedHeader);
57
+ const base64urlPayload = (0, utils_1.bytesToBase64url)(payloadBytes);
58
+ return {
59
+ jws: {
60
+ unprotectedHeader,
61
+ protectedHeader,
62
+ payload: payloadBytes,
63
+ existingSignatures,
64
+ },
65
+ b64: {
66
+ protectedHeader: base64urlHeader,
67
+ payload: base64urlPayload,
68
+ },
69
+ issuer,
70
+ identifier,
71
+ };
72
+ });
73
+ exports.prepareJwsObject = prepareJwsObject;
74
+ const createJwsCompact = (args, context) => __awaiter(void 0, void 0, void 0, function* () {
75
+ const { protected: protectedHeader, payload, signature } = yield (0, exports.createJwsJsonFlattened)(args, context);
76
+ return `${protectedHeader}.${payload}.${signature}`;
77
+ });
78
+ exports.createJwsCompact = createJwsCompact;
79
+ const createJwsJsonFlattened = (args, context) => __awaiter(void 0, void 0, void 0, function* () {
80
+ const jws = yield (0, exports.createJwsJsonGeneral)(args, context);
81
+ if (jws.signatures.length !== 1) {
82
+ return Promise.reject(Error(`JWS flattened signature can only contain 1 signature. Found ${jws.signatures.length}`));
83
+ }
84
+ return Object.assign(Object.assign({}, jws.signatures[0]), { payload: jws.payload });
85
+ });
86
+ exports.createJwsJsonFlattened = createJwsJsonFlattened;
87
+ const createJwsJsonGeneral = (args, context) => __awaiter(void 0, void 0, void 0, function* () {
88
+ const { payload, protectedHeader, unprotectedHeader, existingSignatures, issuer, mode } = args;
89
+ const { b64, identifier } = yield (0, exports.prepareJwsObject)({
90
+ protectedHeader,
91
+ unprotectedHeader,
92
+ payload,
93
+ existingSignatures,
94
+ issuer,
95
+ mode,
96
+ }, context);
97
+ // const algorithm = await signatureAlgorithmFromKey({ key: identifier.key })
98
+ const signature = yield context.agent.keyManagerSign({
99
+ keyRef: identifier.kmsKeyRef,
100
+ data: `${b64.protectedHeader}.${b64.payload}`,
101
+ encoding: undefined
102
+ });
103
+ const jsonSignature = {
104
+ protected: b64.protectedHeader,
105
+ header: unprotectedHeader,
106
+ signature,
107
+ };
108
+ return {
109
+ payload: b64.payload,
110
+ signatures: [...(existingSignatures !== null && existingSignatures !== void 0 ? existingSignatures : []), jsonSignature],
111
+ };
112
+ });
113
+ exports.createJwsJsonGeneral = createJwsJsonGeneral;
114
+ /**
115
+ * Updates the JWT header to include x5c, kid, jwk objects using the supplied issuer identifier that will be used to sign. If not present will automatically make the header objects available
116
+ * @param mode The type of header to check or include
117
+ * @param identifier The identifier of the signer. This identifier will be used later to sign
118
+ * @param header The JWT header
119
+ * @param noIdentifierInHeader
120
+ * @param context
121
+ */
122
+ const checkAndUpdateJwtHeader = (_a, context_1) => __awaiter(void 0, [_a, context_1], void 0, function* ({ mode = 'auto', identifier, header, noIdentifierInHeader = false }, context) {
123
+ if (isMode(mode, identifier.method, 'did')) {
124
+ // kid is VM of the DID
125
+ // @see https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.4
126
+ yield checkAndUpdateDidHeader({ header, identifier, noIdentifierInHeader }, context);
127
+ }
128
+ else if (isMode(mode, identifier.method, 'x5c')) {
129
+ // Include the x5c in the header. No kid
130
+ // @see https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.6
131
+ yield checkAndUpdateX5cHeader({ header, identifier, noIdentifierInHeader }, context);
132
+ }
133
+ else if (isMode(mode, identifier.method, 'kid', false)) {
134
+ yield checkAndUpdateKidHeader({ header, identifier, noIdentifierInHeader }, context);
135
+ }
136
+ else if (isMode(mode, identifier.method, 'jwk', false)) {
137
+ // Include the JWK in the header as well as its kid if present
138
+ // @see https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.3
139
+ // @see https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.4
140
+ yield checkAndUpdateJwkHeader({ header, identifier, noIdentifierInHeader }, context);
141
+ }
142
+ else {
143
+ // Better safe than sorry. We could let it pass, but we want to force implementers to make a conscious choice
144
+ return Promise.reject(`Invalid combination of JWS creation mode ${mode} and identifier method ${identifier.method} chosen`);
145
+ }
146
+ });
147
+ exports.checkAndUpdateJwtHeader = checkAndUpdateJwtHeader;
148
+ const checkAndUpdateX5cHeader = (_b, context_2) => __awaiter(void 0, [_b, context_2], void 0, function* ({ header, identifier, noIdentifierInHeader = false }, context) {
149
+ const { x5c } = header;
150
+ if (x5c) {
151
+ // let's resolve the provided x5c to be sure
152
+ const x5cIdentifier = yield context.agent.identifierManagedGetByX5c({ identifier: x5c });
153
+ if (x5cIdentifier.kmsKeyRef !== identifier.kmsKeyRef) {
154
+ return Promise.reject(Error(`An x5c header was present, but its issuer public key did not match the provided signing public key!`));
155
+ }
156
+ }
157
+ else if (!noIdentifierInHeader) {
158
+ if (!(0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierX5cResult)(identifier)) {
159
+ return Promise.reject(Error('No x5c header in the JWT, but mode was x5c and also no x5x identifier was provided!'));
160
+ }
161
+ else if (header.jwk || header.kid) {
162
+ return Promise.reject(Error('x5c mode was choosen, but jwk or kid headers were provided. These cannot be used together!'));
163
+ }
164
+ header.x5c = identifier.x5c;
165
+ }
166
+ });
167
+ const checkAndUpdateDidHeader = (_c, context_3) => __awaiter(void 0, [_c, context_3], void 0, function* ({ header, identifier, noIdentifierInHeader = false }, context) {
168
+ const { kid } = header;
169
+ if (kid) {
170
+ // let's resolve the provided x5c to be sure
171
+ const vmIdentifier = yield context.agent.identifierManagedGetByDid({ identifier: kid });
172
+ if (vmIdentifier.kmsKeyRef !== identifier.kmsKeyRef) {
173
+ return Promise.reject(Error(`A kid header was present, but its value did not match the provided signing kid!`));
174
+ }
175
+ }
176
+ else if (!noIdentifierInHeader) {
177
+ if (!(0, ssi_sdk_ext_identifier_resolution_1.isManagedIdentifierDidResult)(identifier)) {
178
+ return Promise.reject(Error('No kid header in the JWT, but mode was did and also no DID identifier was provided!'));
179
+ }
180
+ else if (header.jwk || header.x5c) {
181
+ return Promise.reject(Error('did mode was chosen, but jwk or x5c headers were provided. These cannot be used together!'));
182
+ }
183
+ header.kid = identifier.kid;
184
+ }
185
+ });
186
+ const checkAndUpdateJwkHeader = (_d, context_4) => __awaiter(void 0, [_d, context_4], void 0, function* ({ header, identifier, noIdentifierInHeader = false }, context) {
187
+ const { jwk } = header;
188
+ if (jwk) {
189
+ // let's resolve the provided x5c to be sure
190
+ const jwkIdentifier = yield context.agent.identifierManagedGetByJwk({ identifier: jwk });
191
+ if (jwkIdentifier.kmsKeyRef !== identifier.kmsKeyRef) {
192
+ return Promise.reject(Error(`A jwk header was present, but its value did not match the provided signing jwk or kid!`));
193
+ }
194
+ }
195
+ else if (!noIdentifierInHeader) {
196
+ // We basically accept everything for this mode, as we can always create JWKs from any key
197
+ if (header.x5c) {
198
+ return Promise.reject(Error('jwk mode was chosen, but x5c headers were provided. These cannot be used together!'));
199
+ }
200
+ header.jwk = identifier.jwk;
201
+ }
202
+ });
203
+ const checkAndUpdateKidHeader = (_e, context_5) => __awaiter(void 0, [_e, context_5], void 0, function* ({ header, identifier, noIdentifierInHeader = false }, context) {
204
+ const { kid } = header;
205
+ if (kid) {
206
+ // let's resolve the provided x5c to be sure
207
+ const kidIdentifier = yield context.agent.identifierManagedGetByKid({ identifier: kid });
208
+ if (kidIdentifier.kmsKeyRef !== identifier.kmsKeyRef) {
209
+ return Promise.reject(Error(`A kid header was present, but its value did not match the provided signing kid!`));
210
+ }
211
+ }
212
+ else if (!noIdentifierInHeader) {
213
+ // We basically accept everything for this mode, as we can always create JWKs from any key
214
+ if (header.x5c) {
215
+ return Promise.reject(Error('kid mode was chosen, but x5c headers were provided. These cannot be used together!'));
216
+ }
217
+ header.kid = identifier.kid;
218
+ }
219
+ });
220
+ const isMode = (mode, identifierMethod, checkMode, loose = true) => {
221
+ if (loose && (checkMode === 'jwk' || checkMode === 'kid')) {
222
+ // we always have the kid and jwk at hand no matter the identifier method, so we are okay with that
223
+ // todo: check the impact on the above expressions, as this will now always return true for the both of them
224
+ return true;
225
+ }
226
+ if (mode === checkMode) {
227
+ if (checkMode !== 'auto' && mode !== identifierMethod) {
228
+ throw Error(`Provided mode ${mode} conflicts with identifier method ${identifierMethod}`);
229
+ }
230
+ return true;
231
+ }
232
+ // we always have the kid and jwk at hand no matter the identifier method, so we are okay with that
233
+ return mode === 'auto' && identifierMethod === checkMode;
234
+ };
235
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mGAKoD;AACpD,yCAA8D;AAC9D,iDAAkC;AAe3B,MAAM,gBAAgB,GAAG,CAAO,IAAuB,EAAE,OAAyB,EAA8B,EAAE;IACrH,MAAM,EACF,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,MAAM,EACN,OAAO,EACP,IAAI,GAAG,MAAM,EAChB,GAAG,IAAI,CAAA;IAER,MAAM,EAAC,oBAAoB,GAAG,KAAK,EAAC,GAAG,MAAM,CAAA;IAC7C,MAAM,cAAc,mCAAO,iBAAiB,GAAK,eAAe,CAAC,CAAA;IACjE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC,MAAM,CAAC,wCAAwC,CAAC,CAAA;IACnE,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;IACnE,MAAM,IAAA,+BAAuB,EAAC,EAAC,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,EAAE,eAAe,EAAC,EAAE,OAAO,CAAC,CAAA;IAEzG,MAAM,OAAO,GAAG,OAAO,YAAY,UAAU,CAAA;IAC7C,MAAM,QAAQ,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAA;IAC5C,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,MAAM,CAAC,kBAAkB,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,UAAU,CAA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,EAAE,CAAC;YACpD,MAAM,KAAK,CAAC,iBAAiB,IAAI,qCAAqC,gBAAgB,EAAE,CAAC,CAAA;QAC7F,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;IACD,mGAAmG;IACnG,OAAO,IAAI,KAAK,MAAM,IAAI,gBAAgB,KAAK,SAAS,CAAA;AAC5D,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ declare const schema: any;
5
+ export { schema };
6
+ /**
7
+ * @public
8
+ */
9
+ export { JwtService } from './agent/JwtService';
10
+ export * from './functions';
11
+ export * from './types/IJwtService';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,MAAM,KAAmC,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.JwtService = exports.schema = void 0;
18
+ /**
19
+ * @internal
20
+ */
21
+ const schema = require('../plugin.schema.json');
22
+ exports.schema = schema;
23
+ /**
24
+ * @public
25
+ */
26
+ var JwtService_1 = require("./agent/JwtService");
27
+ Object.defineProperty(exports, "JwtService", { enumerable: true, get: function () { return JwtService_1.JwtService; } });
28
+ __exportStar(require("./functions"), exports);
29
+ __exportStar(require("./types/IJwtService"), exports);
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACtC,wBAAM;AACf;;GAEG;AACH,iDAA+C;AAAtC,wGAAA,UAAU,OAAA;AACnB,8CAA2B;AAC3B,sDAAmC"}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.47.5"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,94 @@
1
+ import { IIdentifierResolution, ManagedIdentifierOpts, ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
2
+ import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager';
3
+ import { JWK, SignatureAlgorithmJwa } from '@sphereon/ssi-sdk-ext.key-utils';
4
+ import { IAgentContext, IPluginMethodMap } from '@veramo/core';
5
+ export type IRequiredContext = IAgentContext<IIdentifierResolution & ISphereonKeyManager>;
6
+ export interface IJwtService extends IPluginMethodMap {
7
+ jwtPrepareJws(args: CreateJwsJsonArgs, context: IRequiredContext): Promise<PreparedJwsObject>;
8
+ jwtCreateJwsJsonGeneralSignature(args: CreateJwsJsonArgs, context: IRequiredContext): Promise<JwsJsonGeneral>;
9
+ jwtCreateJwsJsonFlattenedSignature(args: CreateJwsFlattenedArgs, context: IRequiredContext): Promise<JwsJsonFlattened>;
10
+ jwtCreateJwsCompactSignature(args: CreateJwsCompactArgs, context: IRequiredContext): Promise<JwsCompactResult>;
11
+ }
12
+ export interface PreparedJws {
13
+ protectedHeader: JwtHeader;
14
+ payload: Uint8Array;
15
+ unprotectedHeader?: JwtHeader;
16
+ existingSignatures?: Array<JwsJsonSignature>;
17
+ }
18
+ export interface JwsJsonSignature {
19
+ protected: string;
20
+ header?: JwtHeader;
21
+ signature: string;
22
+ }
23
+ export type JwsCompact = string;
24
+ export interface JwsJsonFlattened {
25
+ payload: string;
26
+ protected: string;
27
+ header?: JwtHeader;
28
+ signature: string;
29
+ }
30
+ export interface JwsJsonGeneral {
31
+ payload: string;
32
+ signatures: Array<JwsJsonSignature>;
33
+ }
34
+ export interface PreparedJwsObject {
35
+ jws: PreparedJws;
36
+ b64: {
37
+ payload: string;
38
+ protectedHeader: string;
39
+ };
40
+ issuer: ManagedIdentifierOpts;
41
+ identifier: ManagedIdentifierResult;
42
+ }
43
+ export interface BaseJwtHeader {
44
+ typ?: string;
45
+ alg?: string;
46
+ kid?: string;
47
+ }
48
+ export interface BaseJwtPayload {
49
+ iss?: string;
50
+ sub?: string;
51
+ aud?: string[] | string;
52
+ exp?: number;
53
+ nbf?: number;
54
+ iat?: number;
55
+ jti?: string;
56
+ }
57
+ export interface JwtHeader extends BaseJwtHeader {
58
+ kid?: string;
59
+ jwk?: JWK;
60
+ x5c?: string[];
61
+ [key: string]: unknown;
62
+ }
63
+ export interface JwtPayload extends BaseJwtPayload {
64
+ [key: string]: unknown;
65
+ }
66
+ export interface JwsHeaderOpts {
67
+ als: SignatureAlgorithmJwa;
68
+ }
69
+ export type CreateJwsMode = 'x5c' | 'kid' | 'jwk' | 'did' | 'auto';
70
+ export type CreateJwsArgs = {
71
+ mode?: CreateJwsMode;
72
+ issuer: ManagedIdentifierOpts & {
73
+ noIssPayloadUpdate?: boolean;
74
+ noIdentifierInHeader?: boolean;
75
+ };
76
+ protectedHeader: JwtHeader;
77
+ payload: JwtPayload | Uint8Array | string;
78
+ };
79
+ export type CreateJwsCompactArgs = CreateJwsArgs;
80
+ export type CreateJwsFlattenedArgs = Exclude<CreateJwsJsonArgs, 'existingSignatures'>;
81
+ /**
82
+ * @public
83
+ */
84
+ export type CreateJwsJsonArgs = CreateJwsArgs & {
85
+ unprotectedHeader?: JwtHeader;
86
+ existingSignatures?: Array<JwsJsonSignature>;
87
+ };
88
+ /**
89
+ * @public
90
+ */
91
+ export interface JwsCompactResult {
92
+ jwt: JwsCompact;
93
+ }
94
+ //# sourceMappingURL=IJwtService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IJwtService.d.ts","sourceRoot":"","sources":["../../src/types/IJwtService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAA;AACrE,OAAO,EAAC,GAAG,EAAE,qBAAqB,EAAC,MAAM,iCAAiC,CAAA;AAC1E,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAA;AAE5D,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,qBAAqB,GAAG,mBAAmB,CAAC,CAAA;AACzF,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,aAAa,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAE7F,gCAAgC,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAE7G,kCAAkC,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAA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B,GAAG,EAAE,UAAU,CAAC;CACjB"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // export const COMPACT_JWS_REGEX = /^([a-zA-Z0-9_=-]+)\.([a-zA-Z0-9_=-]+)?\.([a-zA-Z0-9_=-]+)$/
4
+ //# sourceMappingURL=IJwtService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IJwtService.js","sourceRoot":"","sources":["../../src/types/IJwtService.ts"],"names":[],"mappings":";;AAqHA,gGAAgG"}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@sphereon/ssi-sdk-ext.jwt-service",
3
+ "version": "0.24.1-unstable.85+f6a9007",
4
+ "source": "src/index.ts",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "veramo": {
8
+ "pluginInterfaces": {
9
+ "IJwtService": "./src/types/IJwtService.ts"
10
+ }
11
+ },
12
+ "scripts": {
13
+ "build": "tsc --build",
14
+ "build:clean": "tsc --build --clean && tsc --build",
15
+ "generate-plugin-schema": "sphereon dev generate-plugin-schema"
16
+ },
17
+ "dependencies": {
18
+ "@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.85+f6a9007",
19
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.85+f6a9007",
20
+ "@sphereon/ssi-sdk-ext.key-manager": "0.24.1-unstable.85+f6a9007",
21
+ "@sphereon/ssi-sdk-ext.key-utils": "0.24.1-unstable.85+f6a9007",
22
+ "@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-unstable.85+f6a9007",
23
+ "@sphereon/ssi-sdk.agent-config": "0.29.1-unstable.75",
24
+ "@sphereon/ssi-types": "0.29.1-unstable.75",
25
+ "@veramo/core": "4.2.0",
26
+ "@veramo/utils": "4.2.0",
27
+ "debug": "^4.3.4",
28
+ "jwt-decode": "^4.0.0",
29
+ "uint8arrays": "^3.1.1"
30
+ },
31
+ "devDependencies": {
32
+ "@sphereon/ssi-sdk-ext.did-provider-jwk": "0.24.1-unstable.85+f6a9007",
33
+ "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.24.1-unstable.85+f6a9007",
34
+ "@sphereon/ssi-sdk-ext.kms-local": "0.24.1-unstable.85+f6a9007",
35
+ "@sphereon/ssi-sdk.dev": "0.29.1-unstable.75",
36
+ "@veramo/data-store": "4.2.0",
37
+ "@veramo/did-manager": "4.2.0",
38
+ "@veramo/did-resolver": "4.2.0",
39
+ "@veramo/key-manager": "4.2.0",
40
+ "@veramo/kms-local": "4.2.0",
41
+ "@veramo/remote-client": "4.2.0",
42
+ "@veramo/remote-server": "4.2.0",
43
+ "did-resolver": "^4.1.0",
44
+ "js-crypto-key-utils": "^1.0.7",
45
+ "typeorm": "0.3.20"
46
+ },
47
+ "files": [
48
+ "dist/**/*",
49
+ "src/**/*",
50
+ "plugin.schema.json",
51
+ "README.md",
52
+ "LICENSE"
53
+ ],
54
+ "private": false,
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "repository": "git@github.com:Sphereon-OpenSource/SSI-SDK-crypto-extensions.git",
59
+ "author": "Sphereon <dev@sphereon.com>",
60
+ "license": "Apache-2.0",
61
+ "keywords": [
62
+ "Sphereon",
63
+ "Identifier resolution",
64
+ "JWK",
65
+ "DID",
66
+ "X.509 Certificates",
67
+ "ARF"
68
+ ],
69
+ "gitHead": "f6a9007ee413ee23d77214c6f8e8a75b8a7e356d"
70
+ }