@sphereon/ssi-sdk.sd-jwt 0.33.1-feature.vcdm2.4 → 0.33.1-feature.vcdm2.tsup.19

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/dist/types.d.ts DELETED
@@ -1,234 +0,0 @@
1
- import { SdJwtVcPayload as SdJwtPayload } from '@sd-jwt/sd-jwt-vc';
2
- import { Hasher, kbHeader, KBOptions, kbPayload, SaltGenerator, Signer } from '@sd-jwt/types';
3
- import { IIdentifierResolution, ManagedIdentifierResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
4
- import { IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
5
- import { X509CertificateChainValidationOpts } from '@sphereon/ssi-sdk-ext.x509-utils';
6
- import { ImDLMdoc } from '@sphereon/ssi-sdk.mdl-mdoc';
7
- import { HasherSync, JoseSignatureAlgorithm, SdJwtTypeMetadata } from '@sphereon/ssi-types';
8
- import { DIDDocumentSection, IAgentContext, IDIDManager, IKeyManager, IPluginMethodMap, IResolver } from '@veramo/core';
9
- export declare const sdJwtPluginContextMethods: Array<string>;
10
- /**
11
- * My Agent Plugin description.
12
- *
13
- * This is the interface that describes what your plugin can do.
14
- * The methods listed here, will be directly available to the veramo agent where your plugin is going to be used.
15
- * Depending on the agent configuration, other agent plugins, as well as the application where the agent is used
16
- * will be able to call these methods.
17
- *
18
- * To build a schema for your plugin using standard tools, you must link to this file in your package.json.
19
- * Example:
20
- * ```
21
- * "veramo": {
22
- * "pluginInterfaces": {
23
- * "IMyAgentPlugin": "./src/types/IMyAgentPlugin.ts"
24
- * }
25
- * },
26
- * ```
27
- *
28
- * @beta
29
- */
30
- export interface ISDJwtPlugin extends IPluginMethodMap {
31
- /**
32
- * Your plugin method description
33
- *
34
- * @param args - Input parameters for this method
35
- * @param context - The required context where this method can run.
36
- * Declaring a context type here lets other developers know which other plugins
37
- * need to also be installed for this method to work.
38
- */
39
- /**
40
- * Create a signed SD-JWT credential.
41
- * @param args - Arguments necessary for the creation of a SD-JWT credential.
42
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
43
- */
44
- createSdJwtVc(args: ICreateSdJwtVcArgs, context: IRequiredContext): Promise<ICreateSdJwtVcResult>;
45
- /**
46
- * Create a signed SD-JWT presentation.
47
- * @param args - Arguments necessary for the creation of a SD-JWT presentation.
48
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
49
- */
50
- createSdJwtPresentation(args: ICreateSdJwtPresentationArgs, context: IRequiredContext): Promise<ICreateSdJwtPresentationResult>;
51
- /**
52
- * Verify a signed SD-JWT credential.
53
- * @param args - Arguments necessary for the verification of a SD-JWT credential.
54
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
55
- */
56
- verifySdJwtVc(args: IVerifySdJwtVcArgs, context: IRequiredContext): Promise<IVerifySdJwtVcResult>;
57
- /**
58
- * Verify a signed SD-JWT presentation.
59
- * @param args - Arguments necessary for the verification of a SD-JWT presentation.
60
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
61
- */
62
- verifySdJwtPresentation(args: IVerifySdJwtPresentationArgs, context: IRequiredContext): Promise<IVerifySdJwtPresentationResult>;
63
- /**
64
- * Fetch and validate Type Metadata.
65
- * @param args - Arguments necessary for fetching and validating the type metadata.
66
- * @param context - This reserved param is automatically added and handled by the framework, *do not override*
67
- */
68
- fetchSdJwtTypeMetadataFromVctUrl(args: FetchSdJwtTypeMetadataFromVctUrlArgs, context: IRequiredContext): Promise<SdJwtTypeMetadata>;
69
- }
70
- export declare function contextHasSDJwtPlugin(context: IAgentContext<IPluginMethodMap>): context is IAgentContext<ISDJwtPlugin>;
71
- /**
72
- * ICreateSdJwtVcArgs
73
- *
74
- * @beta
75
- */
76
- export interface SdJwtVcPayload extends SdJwtPayload {
77
- x5c?: string[];
78
- }
79
- export interface ICreateSdJwtVcArgs {
80
- credentialPayload: SdJwtVcPayload;
81
- disclosureFrame?: IDisclosureFrame;
82
- resolution?: ManagedIdentifierResult;
83
- }
84
- /**
85
- * @beta
86
- */
87
- export interface IDisclosureFrame {
88
- _sd?: string[];
89
- _sd_decoy?: number;
90
- [x: string]: string[] | number | IDisclosureFrame | undefined;
91
- }
92
- /**
93
- * ICreateSdJwtVcResult
94
- *
95
- * @beta
96
- */
97
- export interface ICreateSdJwtVcResult {
98
- /**
99
- * the encoded sd-jwt credential
100
- */
101
- credential: string;
102
- }
103
- /**
104
- *
105
- * @beta
106
- */
107
- export interface ICreateSdJwtPresentationArgs {
108
- /**
109
- * Encoded SD-JWT credential
110
- */
111
- presentation: string;
112
- presentationFrame?: IPresentationFrame;
113
- /**
114
- * Allows to override the holder. Normally it will be looked up from the cnf or sub values
115
- */
116
- holder?: string;
117
- /**
118
- * Information to include to add key binding.
119
- */
120
- kb?: KBOptions;
121
- }
122
- /**
123
- * @beta
124
- */
125
- export interface IPresentationFrame {
126
- [x: string]: boolean | IPresentationFrame;
127
- }
128
- /**
129
- * Created presentation
130
- * @beta
131
- */
132
- export interface ICreateSdJwtPresentationResult {
133
- /**
134
- * Encoded presentation.
135
- */
136
- presentation: string;
137
- }
138
- /**
139
- * @beta
140
- */
141
- export interface IVerifySdJwtVcArgs {
142
- credential: string;
143
- opts?: {
144
- x5cValidation?: X509CertificateChainValidationOpts;
145
- };
146
- }
147
- /**
148
- * @beta
149
- */
150
- export type IVerifySdJwtVcResult = {
151
- payload: SdJwtPayload;
152
- header: Record<string, unknown>;
153
- kb?: {
154
- header: kbHeader;
155
- payload: kbPayload;
156
- };
157
- };
158
- /**
159
- * @beta
160
- */
161
- export interface IVerifySdJwtPresentationArgs {
162
- presentation: string;
163
- requiredClaimKeys?: string[];
164
- kb?: boolean;
165
- }
166
- /**
167
- * @beta
168
- */
169
- export type IVerifySdJwtPresentationResult = {
170
- payload: unknown;
171
- header: Record<string, unknown> | undefined;
172
- kb?: {
173
- header: kbHeader;
174
- payload: kbPayload;
175
- };
176
- };
177
- export type SignKeyArgs = {
178
- identifier: string;
179
- vmRelationship: DIDDocumentSection;
180
- resolution?: ManagedIdentifierResult;
181
- };
182
- export type SignKeyResult = {
183
- alg: JoseSignatureAlgorithm;
184
- key: {
185
- kid?: string;
186
- kmsKeyRef: string;
187
- x5c?: string[];
188
- jwkThumbprint?: string;
189
- };
190
- };
191
- /**
192
- * This context describes the requirements of this plugin.
193
- * For this plugin to function properly, the agent needs to also have other plugins installed that implement the
194
- * interfaces declared here.
195
- * You can also define requirements on a more granular level, for each plugin method or event handler of your plugin.
196
- *
197
- * @beta
198
- */
199
- export type IRequiredContext = IAgentContext<IDIDManager & IIdentifierResolution & IJwtService & IResolver & IKeyManager & ImDLMdoc>;
200
- export type SdJwtVerifySignature = (data: string, signature: string, publicKey: JsonWebKey) => Promise<boolean>;
201
- export interface SdJWTImplementation {
202
- saltGenerator?: SaltGenerator;
203
- hasher?: HasherSync;
204
- verifySignature?: SdJwtVerifySignature;
205
- }
206
- export interface Claims {
207
- /**
208
- * Subject of the SD-JWT
209
- */
210
- sub?: string;
211
- cnf?: {
212
- jwk?: JsonWebKey;
213
- kid?: string;
214
- };
215
- [key: string]: unknown;
216
- }
217
- export type FetchSdJwtTypeMetadataFromVctUrlArgs = {
218
- vct: string;
219
- vctIntegrity?: string;
220
- opts?: FetchSdJwtTypeMetadataFromVctUrlOpts;
221
- };
222
- export type FetchSdJwtTypeMetadataFromVctUrlOpts = {
223
- hasher?: HasherSync | Hasher;
224
- };
225
- export type GetSignerForIdentifierArgs = {
226
- identifier: string;
227
- resolution?: ManagedIdentifierResult;
228
- };
229
- export type GetSignerResult = {
230
- signer: Signer;
231
- alg?: string;
232
- signingKey?: SignKeyResult;
233
- };
234
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,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C,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAC/G,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,eAAe,CAAC,EAAE,oBAAoB,CAAA;CACvC;AAED,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE;QACJ,GAAG,CAAC,EAAE,UAAU,CAAA;QAChB,GAAG,CAAC,EAAE,MAAM,CAAA;KACb,CAAA;IAED,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,oCAAoC,CAAA;CAC5C,CAAA;AAED,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,uBAAuB,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,aAAa,CAAA;CAC3B,CAAA"}
package/dist/types.js DELETED
@@ -1,6 +0,0 @@
1
- import { contextHasPlugin } from '@sphereon/ssi-sdk.agent-config';
2
- export const sdJwtPluginContextMethods = ['createSdJwtVc', 'createSdJwtPresentation', 'verifySdJwtVc', 'verifySdJwtPresentation'];
3
- export function contextHasSDJwtPlugin(context) {
4
- return contextHasPlugin(context, 'verifySdJwtVc');
5
- }
6
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAKjE,MAAM,CAAC,MAAM,yBAAyB,GAAkB,CAAC,eAAe,EAAE,yBAAyB,EAAE,eAAe,EAAE,yBAAyB,CAAC,CAAA;AAmEhJ,MAAM,UAAU,qBAAqB,CAAC,OAAwC;IAC5E,OAAO,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAA;AACnD,CAAC"}
package/dist/utils.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { SdJwtTypeMetadata } from '@sphereon/ssi-types';
2
- import { HasherSync } from '@sd-jwt/types';
3
- import { Hasher } from '@sd-jwt/types';
4
- export declare function fetchUrlWithErrorHandling(url: string): Promise<Response>;
5
- export type IntegrityAlg = 'sha256' | 'sha384' | 'sha512';
6
- export declare function extractHashFromIntegrity(integrityValue?: string): string | undefined;
7
- export declare function validateIntegrity({ input, integrityValue, hasher, }: {
8
- input: any;
9
- integrityValue?: string;
10
- hasher: HasherSync | Hasher;
11
- }): Promise<boolean>;
12
- export declare function createIntegrity({ input, hasher, alg, }: {
13
- input: any;
14
- hasher: HasherSync | Hasher;
15
- alg?: IntegrityAlg;
16
- }): Promise<string>;
17
- export declare function assertValidTypeMetadata(metadata: SdJwtTypeMetadata, vct: string): void;
18
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAGtC,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAM9E;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAUzD,wBAAgB,wBAAwB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpF;AAED,wBAAsB,iBAAiB,CAAC,EACtC,KAAK,EACL,cAAc,EACd,MAAM,GACP,EAAE;IACD,KAAK,EAAE,GAAG,CAAA;IACV,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,UAAU,GAAG,MAAM,CAAA;CAC5B,GAAG,OAAO,CAAC,OAAO,CAAC,CAUnB;AAED,wBAAsB,eAAe,CAAC,EACpC,KAAK,EACL,MAAM,EACN,GAAc,GACf,EAAE;IACD,KAAK,EAAE,GAAG,CAAA;IACV,MAAM,EAAE,UAAU,GAAG,MAAM,CAAA;IAC3B,GAAG,CAAC,EAAE,YAAY,CAAA;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAGlB;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAItF"}
package/dist/utils.js DELETED
@@ -1,40 +0,0 @@
1
- import * as u8a from 'uint8arrays';
2
- // Helper function to fetch API with error handling
3
- export async function fetchUrlWithErrorHandling(url) {
4
- const response = await fetch(url);
5
- if (!response.ok) {
6
- throw new Error(`${response.status}: ${response.statusText}`);
7
- }
8
- return response;
9
- }
10
- function extractHashAlgFromIntegrity(integrityValue) {
11
- const val = integrityValue?.toLowerCase().trim().split('-')[0];
12
- if (val === 'sha256' || val === 'sha384' || val === 'sha512') {
13
- return val;
14
- }
15
- return undefined;
16
- }
17
- export function extractHashFromIntegrity(integrityValue) {
18
- return integrityValue?.toLowerCase().trim().split('-')[1];
19
- }
20
- export async function validateIntegrity({ input, integrityValue, hasher, }) {
21
- if (!integrityValue) {
22
- return true;
23
- }
24
- const alg = extractHashAlgFromIntegrity(integrityValue);
25
- if (!alg) {
26
- return false;
27
- }
28
- const calculatedHash = await createIntegrity({ hasher, input, alg });
29
- return calculatedHash == integrityValue;
30
- }
31
- export async function createIntegrity({ input, hasher, alg = 'sha256', }) {
32
- const calculatedHash = await hasher(typeof input === 'string' ? input : JSON.stringify(input), alg);
33
- return `${alg}-${u8a.toString(calculatedHash, 'base64')}`;
34
- }
35
- export function assertValidTypeMetadata(metadata, vct) {
36
- if (metadata.vct !== vct) {
37
- throw new Error('VCT mismatch in metadata and credential');
38
- }
39
- }
40
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAIlC,mDAAmD;AACnD,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,GAAW;IACzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;IACjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;IAC/D,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAID,SAAS,2BAA2B,CAAC,cAAuB;IAC1D,MAAM,GAAG,GAAG,cAAc,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9D,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC7D,OAAO,GAAmB,CAAA;IAC5B,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,cAAuB;IAC9D,OAAO,cAAc,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAA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