@sphereon/ssi-sdk-ext.jwt-service 0.28.1-feature.jose.vcdm.52 → 0.28.1-feature.oyd.cmsm.improv.20

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,222 @@
1
+ import { ExternalIdentifierDidOpts, ExternalIdentifierResult, ExternalIdentifierX5cOpts, IIdentifierResolution, ManagedIdentifierOptsOrResult, ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
2
+ import { ClientIdScheme } from '@sphereon/ssi-sdk-ext.x509-utils';
3
+ import { BaseJWK, IValidationResult, JoseSignatureAlgorithm, JoseSignatureAlgorithmString, JWK } from '@sphereon/ssi-types';
4
+ import { IAgentContext, IKeyManager, IPluginMethodMap } from '@veramo/core';
5
+ export type IRequiredContext = IAgentContext<IIdentifierResolution & IKeyManager>;
6
+ export declare const jwtServiceContextMethods: Array<string>;
7
+ export interface IJwtService extends IPluginMethodMap {
8
+ jwtPrepareJws(args: CreateJwsJsonArgs, context: IRequiredContext): Promise<PreparedJwsObject>;
9
+ jwtCreateJwsJsonGeneralSignature(args: CreateJwsJsonArgs, context: IRequiredContext): Promise<JwsJsonGeneral>;
10
+ jwtCreateJwsJsonFlattenedSignature(args: CreateJwsFlattenedArgs, context: IRequiredContext): Promise<JwsJsonFlattened>;
11
+ jwtCreateJwsCompactSignature(args: CreateJwsCompactArgs, context: IRequiredContext): Promise<JwtCompactResult>;
12
+ jwtVerifyJwsSignature(args: VerifyJwsArgs, context: IRequiredContext): Promise<IJwsValidationResult>;
13
+ jwtEncryptJweCompactJwt(args: EncryptJweCompactJwtArgs, context: IRequiredContext): Promise<JwtCompactResult>;
14
+ jwtDecryptJweCompactJwt(args: DecryptJweCompactJwtArgs, context: IRequiredContext): Promise<JwtCompactResult>;
15
+ }
16
+ export type IJwsValidationResult = IValidationResult & {
17
+ jws: JwsJsonGeneralWithIdentifiers;
18
+ };
19
+ export interface PreparedJws {
20
+ protectedHeader: JwsHeader;
21
+ payload: Uint8Array;
22
+ unprotectedHeader?: JwsHeader;
23
+ existingSignatures?: Array<JwsJsonSignature>;
24
+ }
25
+ export interface JwsJsonSignature {
26
+ protected: string;
27
+ header?: JwsHeader;
28
+ signature: string;
29
+ }
30
+ /**
31
+ * The JWK representation of an ephemeral public key.
32
+ * See https://www.rfc-editor.org/rfc/rfc7518.html#section-6
33
+ */
34
+ export type EphemeralPublicKey = Omit<BaseJWK, 'alg'>;
35
+ export interface JweHeader extends Omit<BaseJwtHeader, 'alg'> {
36
+ alg: string;
37
+ enc: string;
38
+ jku?: string;
39
+ jwk?: BaseJWK;
40
+ epk?: EphemeralPublicKey;
41
+ x5u?: string;
42
+ x5c?: string[];
43
+ x5t?: string;
44
+ cty?: string;
45
+ crit?: string[];
46
+ [k: string]: any;
47
+ }
48
+ export interface JweRecipientUnprotectedHeader {
49
+ alg: string;
50
+ iv: string;
51
+ tag: string;
52
+ epk?: EphemeralPublicKey;
53
+ kid?: string;
54
+ apv?: string;
55
+ apu?: string;
56
+ }
57
+ export interface JweProtectedHeader extends Partial<JweHeader> {
58
+ zip?: 'DEF' | string;
59
+ }
60
+ export type Jws = JwsCompact | JwsJsonFlattened | JwsJsonGeneral;
61
+ export type JwsCompact = string;
62
+ export interface JwsJsonFlattened {
63
+ payload: string;
64
+ protected: string;
65
+ header?: JwsHeader;
66
+ signature: string;
67
+ }
68
+ export interface JwsJsonGeneral {
69
+ payload: string;
70
+ signatures: Array<JwsJsonSignature>;
71
+ }
72
+ export interface JwsJsonGeneralWithIdentifiers extends JwsJsonGeneral {
73
+ signatures: Array<JwsJsonSignatureWithIdentifier>;
74
+ }
75
+ export interface JwsJsonSignatureWithIdentifier extends JwsJsonSignature {
76
+ identifier: ExternalIdentifierResult;
77
+ }
78
+ export type Jwe = JweCompact | JweJsonFlattened | JweJsonGeneral;
79
+ export type JweCompact = string;
80
+ export interface JweJsonFlattened {
81
+ protected: string;
82
+ unprotected: JweHeader;
83
+ header: JweHeader | JweRecipientUnprotectedHeader;
84
+ encrypted_key?: string;
85
+ aad?: string;
86
+ iv: string;
87
+ ciphertext: string;
88
+ tag?: string;
89
+ }
90
+ export interface JweRecipient {
91
+ header?: JweRecipientUnprotectedHeader;
92
+ encrypted_key?: string;
93
+ }
94
+ export interface JweJsonGeneral {
95
+ protected: string;
96
+ unprotected?: JweHeader;
97
+ recipients: Array<JweRecipient>;
98
+ aad?: string;
99
+ iv: string;
100
+ ciphertext: string;
101
+ tag?: string;
102
+ }
103
+ export interface PreparedJwsObject {
104
+ jws: PreparedJws;
105
+ b64: {
106
+ payload: string;
107
+ protectedHeader: string;
108
+ };
109
+ identifier: ManagedIdentifierResult;
110
+ }
111
+ export interface BaseJwtHeader {
112
+ typ?: string;
113
+ alg?: string;
114
+ kid?: string;
115
+ }
116
+ export interface BaseJwtPayload {
117
+ iss?: string;
118
+ sub?: string;
119
+ aud?: string[] | string;
120
+ exp?: number;
121
+ nbf?: number;
122
+ iat?: number;
123
+ jti?: string;
124
+ }
125
+ export interface JwsHeader extends BaseJwtHeader {
126
+ kid?: string;
127
+ jwk?: JWK;
128
+ x5c?: string[];
129
+ [key: string]: unknown;
130
+ }
131
+ export interface JwsPayload extends BaseJwtPayload {
132
+ [key: string]: unknown;
133
+ }
134
+ export interface JwsHeaderOpts {
135
+ alg: JoseSignatureAlgorithm | JoseSignatureAlgorithmString;
136
+ }
137
+ export type JwsIdentifierMode = 'x5c' | 'kid' | 'jwk' | 'did' | 'auto';
138
+ export type EncryptJweCompactJwtArgs = {
139
+ payload: JwsPayload;
140
+ protectedHeader?: JweProtectedHeader | undefined;
141
+ aad?: Uint8Array | undefined;
142
+ recipientKey: ExternalIdentifierResult & {
143
+ kid?: string;
144
+ };
145
+ alg?: JweAlg;
146
+ enc?: JweEnc;
147
+ apu?: string;
148
+ apv?: string;
149
+ expirationTime?: number | string | Date;
150
+ issuer?: string;
151
+ audience?: string | string[];
152
+ };
153
+ export type DecryptJweCompactJwtArgs = {
154
+ jwe: JweCompact;
155
+ idOpts: ManagedIdentifierOptsOrResult;
156
+ };
157
+ export type CreateJwsArgs = {
158
+ mode?: JwsIdentifierMode;
159
+ issuer: ManagedIdentifierOptsOrResult & {
160
+ noIssPayloadUpdate?: boolean;
161
+ noIdentifierInHeader?: boolean;
162
+ };
163
+ clientId?: string;
164
+ clientIdScheme?: ClientIdScheme | 'did' | string;
165
+ protectedHeader: JwsHeader;
166
+ payload: JwsPayload | Uint8Array | string;
167
+ };
168
+ export type CreateJweArgs = {
169
+ mode?: JwsIdentifierMode;
170
+ issuer: ManagedIdentifierOptsOrResult & {
171
+ noIssPayloadUpdate?: boolean;
172
+ noIdentifierInHeader?: boolean;
173
+ };
174
+ protectedHeader: JweProtectedHeader;
175
+ encryptedKey: string | EphemeralPublicKey;
176
+ iv: string;
177
+ ciphertext: string;
178
+ tag: string;
179
+ };
180
+ export type CreateJwsCompactArgs = CreateJwsArgs;
181
+ export type CreateJwsFlattenedArgs = Exclude<CreateJwsJsonArgs, 'existingSignatures'>;
182
+ export type VerifyJwsArgs = {
183
+ jws: Jws;
184
+ jwk?: JWK;
185
+ opts?: {
186
+ x5c?: Omit<ExternalIdentifierX5cOpts, 'identifier'>;
187
+ did?: Omit<ExternalIdentifierDidOpts, 'identifier'>;
188
+ };
189
+ };
190
+ /**
191
+ * @public
192
+ */
193
+ export type CreateJwsJsonArgs = CreateJwsArgs & {
194
+ unprotectedHeader?: JwsHeader;
195
+ existingSignatures?: Array<JwsJsonSignature>;
196
+ };
197
+ export type CreateJweJsonArgs = CreateJweArgs & {
198
+ unprotectedHeader?: JweHeader;
199
+ };
200
+ /**
201
+ * @public
202
+ */
203
+ export interface JwtCompactResult {
204
+ jwt: JwsCompact | JweCompact;
205
+ }
206
+ export declare function isJwsCompact(jws: Jws): jws is JwsCompact;
207
+ export declare function isJweCompact(jwe: Jwe): jwe is JweCompact;
208
+ export declare function isJwsJsonFlattened(jws: Jws): jws is JwsJsonFlattened;
209
+ export declare function isJwsJsonGeneral(jws: Jws): jws is JwsJsonGeneral;
210
+ export declare function isJweJsonFlattened(jwe: Jwe): jwe is JweJsonFlattened;
211
+ export declare function isJweJsonGeneral(jwe: Jwe): jwe is JweJsonGeneral;
212
+ export declare function isJwsHeader(header: BaseJwtHeader & Record<string, any>): header is JwsHeader;
213
+ export declare function isJweHeader(header: BaseJwtHeader & Record<string, any>): header is JweHeader;
214
+ export declare const COMPACT_JWS_REGEX: RegExp;
215
+ export declare const COMPACT_JWE_REGEX: RegExp;
216
+ export declare const JweAlgs: readonly ["RSA1_5", "RSA-OAEP", "RSA-OAEP-256", "A128KW", "A192KW", "A256KW", "dir", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW", "A128GCMKW", "A192GCMKW", "A256GCMKW", "PBES2-HS256+A128KW", "PBES2-HS384+A192KW", "PBES2-HS512+A256KW"];
217
+ export type JweAlg = (typeof JweAlgs)[number];
218
+ export declare function jweAlg(alg?: string | JweAlg): JweAlg | undefined;
219
+ export declare const JweEncs: readonly ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM"];
220
+ export type JweEnc = (typeof JweEncs)[number];
221
+ export declare function jweEnc(alg?: string | JweEnc): JweEnc | undefined;
222
+ //# 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,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,6BAA6B,EAC7B,uBAAuB,EACxB,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAC3H,OAAO,EAAE,aA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,cAAc,CAEhE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,IAAI,SAAS,CAE5F;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,IAAI,SAAS,CAE5F;AAED,eAAO,MAAM,iBAAiB,QAA8D,CAAA;AAC5F,eAAO,MAAM,iBAAiB,QAAuG,CAAA;AAErI,eAAO,MAAM,OAAO,gQAkBV,CAAA;AACV,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAC7C,wBAAgB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhE;AAED,eAAO,MAAM,OAAO,+FAAkH,CAAA;AACtI,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7C,wBAAgB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhE"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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 = [
50
+ 'RSA1_5',
51
+ 'RSA-OAEP',
52
+ 'RSA-OAEP-256',
53
+ 'A128KW',
54
+ 'A192KW',
55
+ 'A256KW',
56
+ 'dir',
57
+ 'ECDH-ES' /*interop value*/,
58
+ 'ECDH-ES+A128KW',
59
+ 'ECDH-ES+A192KW',
60
+ 'ECDH-ES+A256KW',
61
+ 'A128GCMKW',
62
+ 'A192GCMKW',
63
+ 'A256GCMKW',
64
+ 'PBES2-HS256+A128KW',
65
+ 'PBES2-HS384+A192KW',
66
+ 'PBES2-HS512+A256KW',
67
+ ];
68
+ function jweAlg(alg) {
69
+ return exports.JweAlgs.find((supportedVal) => supportedVal === alg);
70
+ }
71
+ exports.JweEncs = ['A128CBC-HS256', 'A192CBC-HS384', 'A256CBC-HS512', 'A128GCM', 'A192GCM', 'A256GCM' /*interop value*/];
72
+ function jweEnc(alg) {
73
+ return exports.JweEncs.find((supportedVal) => supportedVal === alg);
74
+ }
75
+ //# sourceMappingURL=IJwtService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IJwtService.js","sourceRoot":"","sources":["../../src/types/IJwtService.ts"],"names":[],"mappings":";;;AAsQA,oCAEC;AAED,oCAEC;AAED,gDAEC;AAED,4CAEC;AAED,gDAEC;AAED,4CAEC;AAED,kCAEC;AAED,kCAEC;AAyBD,wBAEC;AAKD,wBAEC;AAxTY,QAAA,wBAAwB,GAAkB;IACrD,eAAe;IACf,kCAAkC;IAClC,oCAAoC;IACpC,8BAA8B;IAC9B,uBAAuB;IACvB,yBAAyB;IACzB,yBAAyB;CAC1B,CAAA;AAgPD,SAAgB,YAAY,CAAC,GAAQ;IACnC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,yBAAiB,CAAC,KAAK,IAAI,CAAA;AACvF,CAAC;AAED,SAAgB,YAAY,CAAC,GAAQ;IACnC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC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IACd,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,SAAS,CAAC,iBAAiB;IAC3B,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,WAAW;IACX,oBAAoB;IACpB,oBAAoB;IACpB,oBAAoB;CACZ,CAAA;AAEV,SAAgB,MAAM,CAAC,GAAqB;IAC1C,OAAO,eAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,KAAK,GAAG,CAAC,CAAA;AAC7D,CAAC;AAEY,QAAA,OAAO,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAU,CAAA;AAGtI,SAAgB,MAAM,CAAC,GAAqB;IAC1C,OAAO,eAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,KAAK,GAAG,CAAC,CAAA;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,53 +1,40 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk-ext.jwt-service",
3
- "version": "0.28.1-feature.jose.vcdm.52+751e224",
4
- "source": "./src/index.ts",
5
- "type": "module",
6
- "main": "./dist/index.cjs",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- "react-native": "./dist/index.js",
11
- "import": {
12
- "types": "./dist/index.d.ts",
13
- "import": "./dist/index.js"
14
- },
15
- "require": {
16
- "types": "./dist/index.d.cts",
17
- "require": "./dist/index.cjs"
18
- }
19
- },
3
+ "version": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
4
+ "source": "src/index.ts",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
20
7
  "veramo": {
21
8
  "pluginInterfaces": {
22
9
  "IJwtService": "./src/types/IJwtService.ts"
23
10
  }
24
11
  },
25
12
  "scripts": {
26
- "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json && sphereon dev generate-plugin-schema",
13
+ "build": "tsc --build",
14
+ "build:clean": "tsc --build --clean && tsc --build",
27
15
  "generate-plugin-schema": "sphereon dev generate-plugin-schema"
28
16
  },
29
17
  "dependencies": {
30
- "@sphereon/ssi-sdk-ext.did-utils": "0.28.1-feature.jose.vcdm.52+751e224",
31
- "@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.1-feature.jose.vcdm.52+751e224",
32
- "@sphereon/ssi-sdk-ext.key-manager": "0.28.1-feature.jose.vcdm.52+751e224",
33
- "@sphereon/ssi-sdk-ext.key-utils": "0.28.1-feature.jose.vcdm.52+751e224",
34
- "@sphereon/ssi-sdk-ext.x509-utils": "0.28.1-feature.jose.vcdm.52+751e224",
35
- "@sphereon/ssi-sdk.agent-config": "0.33.1-feature.jose.vcdm.65",
36
- "@sphereon/ssi-types": "0.33.1-feature.jose.vcdm.65",
18
+ "@sphereon/ssi-sdk-ext.did-utils": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
19
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
20
+ "@sphereon/ssi-sdk-ext.key-manager": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
21
+ "@sphereon/ssi-sdk-ext.key-utils": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
22
+ "@sphereon/ssi-sdk-ext.x509-utils": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
23
+ "@sphereon/ssi-sdk.agent-config": "0.30.2-feature.SDK.41.oidf.support.286",
24
+ "@sphereon/ssi-types": "0.30.2-feature.SDK.41.oidf.support.286",
37
25
  "@stablelib/random": "^1.0.2",
38
26
  "@veramo/core": "4.2.0",
39
27
  "@veramo/utils": "4.2.0",
40
28
  "debug": "^4.3.4",
41
- "jose": "^5.10.0",
29
+ "jose": "^5.9.3",
42
30
  "jwt-decode": "^4.0.0",
43
- "uint8arrays": "3.1.1"
31
+ "uint8arrays": "^3.1.1"
44
32
  },
45
33
  "devDependencies": {
46
- "@sphereon/ssi-sdk-ext.did-provider-jwk": "0.28.1-feature.jose.vcdm.52+751e224",
47
- "@sphereon/ssi-sdk-ext.did-provider-web": "0.28.1-feature.jose.vcdm.52+751e224",
48
- "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.28.1-feature.jose.vcdm.52+751e224",
49
- "@sphereon/ssi-sdk-ext.kms-local": "0.28.1-feature.jose.vcdm.52+751e224",
50
- "@sphereon/ssi-sdk.dev": "0.33.0",
34
+ "@sphereon/ssi-sdk-ext.did-provider-jwk": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
35
+ "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
36
+ "@sphereon/ssi-sdk-ext.kms-local": "0.28.1-feature.oyd.cmsm.improv.20+7c3cf5a",
37
+ "@sphereon/ssi-sdk.dev": "0.30.2-feature.SDK.41.oidf.support.286",
51
38
  "@veramo/data-store": "4.2.0",
52
39
  "@veramo/did-manager": "4.2.0",
53
40
  "@veramo/did-resolver": "4.2.0",
@@ -56,14 +43,12 @@
56
43
  "@veramo/remote-client": "4.2.0",
57
44
  "@veramo/remote-server": "4.2.0",
58
45
  "did-resolver": "^4.1.0",
59
- "express": "^4.21.2",
60
46
  "js-crypto-key-utils": "^1.0.7",
61
- "typeorm": "0.3.20",
62
- "web-did-resolver": "^2.0.30"
47
+ "typeorm": "0.3.20"
63
48
  },
64
49
  "files": [
65
- "dist",
66
- "src",
50
+ "dist/**/*",
51
+ "src/**/*",
67
52
  "plugin.schema.json",
68
53
  "README.md",
69
54
  "LICENSE"
@@ -83,5 +68,5 @@
83
68
  "X.509 Certificates",
84
69
  "ARF"
85
70
  ],
86
- "gitHead": "751e224f245c6ba757827ea4e50ad3c46afbea94"
71
+ "gitHead": "7c3cf5a3b32ef8a31744757aab14c21338880f79"
87
72
  }