@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.33.1-next.3 → 0.33.1-next.73
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/index.cjs +2451 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +559 -0
- package/dist/index.d.ts +555 -8
- package/dist/index.js +2420 -31
- package/dist/index.js.map +1 -1
- package/package.json +41 -30
- package/src/agent/DidAuthSiopOpAuthenticator.ts +13 -14
- package/src/session/OpSession.ts +13 -13
- package/dist/agent/DidAuthSiopOpAuthenticator.d.ts +0 -36
- package/dist/agent/DidAuthSiopOpAuthenticator.d.ts.map +0 -1
- package/dist/agent/DidAuthSiopOpAuthenticator.js +0 -392
- package/dist/agent/DidAuthSiopOpAuthenticator.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/link-handler/index.d.ts +0 -22
- package/dist/link-handler/index.d.ts.map +0 -1
- package/dist/link-handler/index.js +0 -57
- package/dist/link-handler/index.js.map +0 -1
- package/dist/localization/Localization.d.ts +0 -9
- package/dist/localization/Localization.d.ts.map +0 -1
- package/dist/localization/Localization.js +0 -46
- package/dist/localization/Localization.js.map +0 -1
- package/dist/localization/translations/en.json +0 -9
- package/dist/localization/translations/nl.json +0 -8
- package/dist/machine/CallbackStateListener.d.ts +0 -3
- package/dist/machine/CallbackStateListener.d.ts.map +0 -1
- package/dist/machine/CallbackStateListener.js +0 -48
- package/dist/machine/CallbackStateListener.js.map +0 -1
- package/dist/machine/Siopv2Machine.d.ts +0 -8
- package/dist/machine/Siopv2Machine.d.ts.map +0 -1
- package/dist/machine/Siopv2Machine.js +0 -364
- package/dist/machine/Siopv2Machine.js.map +0 -1
- package/dist/services/IdentifierService.d.ts +0 -3
- package/dist/services/IdentifierService.d.ts.map +0 -1
- package/dist/services/IdentifierService.js +0 -28
- package/dist/services/IdentifierService.js.map +0 -1
- package/dist/services/Siopv2MachineService.d.ts +0 -18
- package/dist/services/Siopv2MachineService.d.ts.map +0 -1
- package/dist/services/Siopv2MachineService.js +0 -299
- package/dist/services/Siopv2MachineService.js.map +0 -1
- package/dist/session/OID4VP.d.ts +0 -72
- package/dist/session/OID4VP.d.ts.map +0 -1
- package/dist/session/OID4VP.js +0 -224
- package/dist/session/OID4VP.js.map +0 -1
- package/dist/session/OpSession.d.ts +0 -39
- package/dist/session/OpSession.d.ts.map +0 -1
- package/dist/session/OpSession.js +0 -365
- package/dist/session/OpSession.js.map +0 -1
- package/dist/session/functions.d.ts +0 -37
- package/dist/session/functions.d.ts.map +0 -1
- package/dist/session/functions.js +0 -163
- package/dist/session/functions.js.map +0 -1
- package/dist/session/index.d.ts +0 -4
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js +0 -20
- package/dist/session/index.js.map +0 -1
- package/dist/types/IDidAuthSiopOpAuthenticator.d.ts +0 -120
- package/dist/types/IDidAuthSiopOpAuthenticator.d.ts.map +0 -1
- package/dist/types/IDidAuthSiopOpAuthenticator.js +0 -10
- package/dist/types/IDidAuthSiopOpAuthenticator.js.map +0 -1
- package/dist/types/error/index.d.ts +0 -8
- package/dist/types/error/index.d.ts.map +0 -1
- package/dist/types/error/index.js +0 -3
- package/dist/types/error/index.js.map +0 -1
- package/dist/types/identifier/index.d.ts +0 -53
- package/dist/types/identifier/index.d.ts.map +0 -1
- package/dist/types/identifier/index.js +0 -5
- package/dist/types/identifier/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -6
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -22
- package/dist/types/index.js.map +0 -1
- package/dist/types/machine/index.d.ts +0 -124
- package/dist/types/machine/index.d.ts.map +0 -1
- package/dist/types/machine/index.js +0 -57
- package/dist/types/machine/index.js.map +0 -1
- package/dist/types/siop-service/index.d.ts +0 -80
- package/dist/types/siop-service/index.d.ts.map +0 -1
- package/dist/types/siop-service/index.js +0 -14
- package/dist/types/siop-service/index.js.map +0 -1
- package/dist/utils/CredentialUtils.d.ts +0 -23
- package/dist/utils/CredentialUtils.d.ts.map +0 -1
- package/dist/utils/CredentialUtils.js +0 -65
- package/dist/utils/CredentialUtils.js.map +0 -1
- package/dist/utils/dcql.d.ts +0 -5
- package/dist/utils/dcql.d.ts.map +0 -1
- package/dist/utils/dcql.js +0 -37
- package/dist/utils/dcql.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,559 @@
|
|
|
1
|
+
import { TKeyType, IIdentifier, IAgentContext, IDIDManager, IResolver, IPluginMethodMap, IDataStoreORM, IKeyManager, ICredentialIssuer, ICredentialVerifier, TAgent, IAgentPlugin } from '@veramo/core';
|
|
2
|
+
import { PresentationSignCallback, OPBuilder, OP, VerifiedAuthorizationRequest, URI, PresentationDefinitionWithLocation, RPRegistrationMetadataPayload, ResponseMode, SupportedVersion, VerifyJwtCallback, DcqlResponseOpts, VPTokenLocation, VerifiablePresentationTypeFormat } from '@sphereon/did-auth-siop';
|
|
3
|
+
import { CheckLinkedDomain, ResolveOpts } from '@sphereon/did-auth-siop-adapter';
|
|
4
|
+
import { DIDDocument } from '@sphereon/did-uni-client';
|
|
5
|
+
import { SelectResults, VerifiablePresentationResult } from '@sphereon/pex';
|
|
6
|
+
import { ManagedIdentifierOptsOrResult, IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
|
|
7
|
+
import { JwsPayload, IJwtService } from '@sphereon/ssi-sdk-ext.jwt-service';
|
|
8
|
+
import { UniqueDigitalCredential, ICredentialStore } from '@sphereon/ssi-sdk.credential-store';
|
|
9
|
+
import { CredentialRole, FindDigitalCredentialArgs, ICredentialLocaleBranding, Party, DidAuthConfig, Identity } from '@sphereon/ssi-sdk.data-store';
|
|
10
|
+
import { IPDManager } from '@sphereon/ssi-sdk.pd-manager';
|
|
11
|
+
import { ISDJwtPlugin } from '@sphereon/ssi-sdk.sd-jwt';
|
|
12
|
+
import { HasherSync, OriginalVerifiableCredential, PresentationSubmission, W3CVerifiablePresentation } from '@sphereon/ssi-types';
|
|
13
|
+
import { VerifyCallback } from '@sphereon/wellknown-dids-client';
|
|
14
|
+
import { EventEmitter } from 'events';
|
|
15
|
+
import { Interpreter, State, StateMachine, BaseActionObject, ServiceMap, ResolveTypegenMeta, TypegenDisabled } from 'xstate';
|
|
16
|
+
import { IContactManager } from '@sphereon/ssi-sdk.contact-manager';
|
|
17
|
+
import { IIssuanceBranding } from '@sphereon/ssi-sdk.issuance-branding';
|
|
18
|
+
import { DcqlQuery } from 'dcql';
|
|
19
|
+
import { ICredentialValidation } from '@sphereon/ssi-sdk.credential-validation';
|
|
20
|
+
import { Format } from '@sphereon/pex-models';
|
|
21
|
+
import { ProofOptions, LinkHandlerAdapter } from '@sphereon/ssi-sdk.core';
|
|
22
|
+
import { JwtIssuer, JwtHeader, SigningAlgo } from '@sphereon/oid4vc-common';
|
|
23
|
+
import { _ExtendedIKey } from '@veramo/utils';
|
|
24
|
+
import { SupportedDidMethodEnum } from '@sphereon/ssi-sdk-ext.did-utils';
|
|
25
|
+
import { IMachineStatePersistence, SerializableState } from '@sphereon/ssi-sdk.xstate-machine-persistence';
|
|
26
|
+
|
|
27
|
+
declare function createOID4VPPresentationSignCallback({ presentationSignCallback, idOpts, domain, fetchRemoteContexts, challenge, format, context, skipDidResolution, }: {
|
|
28
|
+
presentationSignCallback?: PresentationSignCallback;
|
|
29
|
+
idOpts: ManagedIdentifierOptsOrResult;
|
|
30
|
+
domain?: string;
|
|
31
|
+
challenge?: string;
|
|
32
|
+
fetchRemoteContexts?: boolean;
|
|
33
|
+
skipDidResolution?: boolean;
|
|
34
|
+
format?: Format;
|
|
35
|
+
context: IRequiredContext;
|
|
36
|
+
}): Promise<PresentationSignCallback>;
|
|
37
|
+
declare function createOPBuilder({ opOptions, idOpts, context, }: {
|
|
38
|
+
opOptions: IOPOptions;
|
|
39
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
40
|
+
context: IRequiredContext;
|
|
41
|
+
}): Promise<OPBuilder>;
|
|
42
|
+
declare function createJwtCallbackWithIdOpts(idOpts: ManagedIdentifierOptsOrResult, context: IRequiredContext): (jwtIssuer: JwtIssuer, jwt: {
|
|
43
|
+
header: JwtHeader;
|
|
44
|
+
payload: JwsPayload;
|
|
45
|
+
}) => Promise<string>;
|
|
46
|
+
declare function createJwtCallbackWithOpOpts(opOpts: IOPOptions, context: IRequiredContext): (jwtIssuer: JwtIssuer, jwt: {
|
|
47
|
+
header: JwtHeader;
|
|
48
|
+
payload: JwsPayload;
|
|
49
|
+
}) => Promise<string>;
|
|
50
|
+
declare function createOP({ opOptions, idOpts, context, }: {
|
|
51
|
+
opOptions: IOPOptions;
|
|
52
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
53
|
+
context: IRequiredContext;
|
|
54
|
+
}): Promise<OP>;
|
|
55
|
+
declare function getSigningAlgo(type: TKeyType): SigningAlgo;
|
|
56
|
+
|
|
57
|
+
declare class OpSession {
|
|
58
|
+
readonly ts: number;
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly options: IOPOptions;
|
|
61
|
+
readonly context: IRequiredContext;
|
|
62
|
+
private readonly requestJwtOrUri;
|
|
63
|
+
private verifiedAuthorizationRequest?;
|
|
64
|
+
private _nonce?;
|
|
65
|
+
private _state?;
|
|
66
|
+
private readonly _providedPresentationDefinitions?;
|
|
67
|
+
private constructor();
|
|
68
|
+
static init(options: Required<IOpSessionArgs>): Promise<OpSession>;
|
|
69
|
+
getAuthorizationRequest(): Promise<VerifiedAuthorizationRequest>;
|
|
70
|
+
getAuthorizationRequestURI(): Promise<URI>;
|
|
71
|
+
get nonce(): string;
|
|
72
|
+
get state(): string;
|
|
73
|
+
clear(): OpSession;
|
|
74
|
+
getSupportedDIDMethods(didPrefix?: boolean): Promise<string[]>;
|
|
75
|
+
private getAgentDIDMethodsSupported;
|
|
76
|
+
private getSubjectSyntaxTypesSupported;
|
|
77
|
+
private getRPDIDMethodsSupported;
|
|
78
|
+
getSupportedIdentifiers(opts?: {
|
|
79
|
+
createInCaseNoDIDFound?: boolean;
|
|
80
|
+
}): Promise<IIdentifier[]>;
|
|
81
|
+
getSupportedDIDs(): Promise<string[]>;
|
|
82
|
+
getRedirectUri(): Promise<string>;
|
|
83
|
+
hasPresentationDefinitions(): Promise<boolean>;
|
|
84
|
+
getPresentationDefinitions(): Promise<Array<PresentationDefinitionWithLocation> | undefined>;
|
|
85
|
+
getOID4VP(args: IOpSessionGetOID4VPArgs): Promise<OID4VP>;
|
|
86
|
+
private createPresentationVerificationCallback;
|
|
87
|
+
private createJarmResponseCallback;
|
|
88
|
+
sendAuthorizationResponse(args: IOpsSendSiopAuthorizationResponseArgs): Promise<Response>;
|
|
89
|
+
private countVCsInAllVPs;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare class OID4VP {
|
|
93
|
+
private readonly session;
|
|
94
|
+
private readonly allIdentifiers;
|
|
95
|
+
private readonly hasher?;
|
|
96
|
+
private constructor();
|
|
97
|
+
static init(session: OpSession, allIdentifiers: string[], hasher?: HasherSync): Promise<OID4VP>;
|
|
98
|
+
getPresentationDefinitions(): Promise<PresentationDefinitionWithLocation[] | undefined>;
|
|
99
|
+
private getPresentationExchange;
|
|
100
|
+
createVerifiablePresentations(credentialRole: CredentialRole, credentialsWithDefinitions: VerifiableCredentialsWithDefinition[], opts?: {
|
|
101
|
+
forceNoCredentialsInVP?: boolean;
|
|
102
|
+
restrictToFormats?: Format;
|
|
103
|
+
restrictToDIDMethods?: string[];
|
|
104
|
+
proofOpts?: ProofOptions;
|
|
105
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
106
|
+
skipDidResolution?: boolean;
|
|
107
|
+
holderDID?: string;
|
|
108
|
+
subjectIsHolder?: boolean;
|
|
109
|
+
hasher?: HasherSync;
|
|
110
|
+
applyFilter?: boolean;
|
|
111
|
+
}): Promise<VerifiablePresentationWithDefinition[]>;
|
|
112
|
+
createVerifiablePresentation(credentialRole: CredentialRole, selectedVerifiableCredentials: VerifiableCredentialsWithDefinition, opts?: {
|
|
113
|
+
forceNoCredentialsInVP?: boolean;
|
|
114
|
+
restrictToFormats?: Format;
|
|
115
|
+
restrictToDIDMethods?: string[];
|
|
116
|
+
proofOpts?: ProofOptions;
|
|
117
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
118
|
+
skipDidResolution?: boolean;
|
|
119
|
+
holder?: string;
|
|
120
|
+
subjectIsHolder?: boolean;
|
|
121
|
+
applyFilter?: boolean;
|
|
122
|
+
hasher?: HasherSync;
|
|
123
|
+
}): Promise<VerifiablePresentationWithDefinition>;
|
|
124
|
+
filterCredentialsAgainstAllDefinitions(credentialRole: CredentialRole, opts?: {
|
|
125
|
+
filterOpts?: {
|
|
126
|
+
verifiableCredentials?: UniqueDigitalCredential[];
|
|
127
|
+
filter?: FindDigitalCredentialArgs;
|
|
128
|
+
};
|
|
129
|
+
holderDIDs?: string[];
|
|
130
|
+
restrictToFormats?: Format;
|
|
131
|
+
restrictToDIDMethods?: string[];
|
|
132
|
+
}): Promise<VerifiableCredentialsWithDefinition[]>;
|
|
133
|
+
filterCredentials(credentialRole: CredentialRole, presentationDefinition: PresentationDefinitionWithLocation, opts?: {
|
|
134
|
+
filterOpts?: {
|
|
135
|
+
verifiableCredentials?: (UniqueDigitalCredential | OriginalVerifiableCredential)[];
|
|
136
|
+
filter?: FindDigitalCredentialArgs;
|
|
137
|
+
};
|
|
138
|
+
holderDIDs?: string[];
|
|
139
|
+
restrictToFormats?: Format;
|
|
140
|
+
restrictToDIDMethods?: string[];
|
|
141
|
+
}): Promise<VerifiableCredentialsWithDefinition>;
|
|
142
|
+
filterCredentialsWithSelectionStatus(credentialRole: CredentialRole, presentationDefinition: PresentationDefinitionWithLocation, opts?: {
|
|
143
|
+
filterOpts?: {
|
|
144
|
+
verifiableCredentials?: OriginalVerifiableCredential[];
|
|
145
|
+
filter?: FindDigitalCredentialArgs;
|
|
146
|
+
};
|
|
147
|
+
holderDIDs?: string[];
|
|
148
|
+
restrictToFormats?: Format;
|
|
149
|
+
restrictToDIDMethods?: string[];
|
|
150
|
+
}): Promise<SelectResults>;
|
|
151
|
+
private getCredentials;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
type ErrorDetails = {
|
|
155
|
+
title: string;
|
|
156
|
+
message: string;
|
|
157
|
+
detailsTitle?: string;
|
|
158
|
+
detailsMessage?: string;
|
|
159
|
+
stack?: string;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type DidAuthSiopOpAuthenticatorOptions = {
|
|
163
|
+
presentationSignCallback?: PresentationSignCallback;
|
|
164
|
+
customApprovals?: Record<string, (verifiedAuthorizationRequest: VerifiedAuthorizationRequest, sessionId: string) => Promise<void>>;
|
|
165
|
+
onContactIdentityCreated?: (args: OnContactIdentityCreatedArgs) => Promise<void>;
|
|
166
|
+
onIdentifierCreated?: (args: OnIdentifierCreatedArgs) => Promise<void>;
|
|
167
|
+
hasher?: HasherSync;
|
|
168
|
+
};
|
|
169
|
+
type GetMachineArgs = {
|
|
170
|
+
url: string | URL;
|
|
171
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
172
|
+
stateNavigationListener?: (siopv2Machine: Siopv2MachineInterpreter, state: Siopv2MachineState, navigation?: any) => Promise<void>;
|
|
173
|
+
};
|
|
174
|
+
type CreateConfigArgs = {
|
|
175
|
+
url: string;
|
|
176
|
+
};
|
|
177
|
+
type CreateConfigResult = Omit<DidAuthConfig, 'stateId' | 'idOpts'>;
|
|
178
|
+
type GetSiopRequestArgs = {
|
|
179
|
+
didAuthConfig?: Omit<DidAuthConfig, 'identifier'>;
|
|
180
|
+
url: string;
|
|
181
|
+
};
|
|
182
|
+
type RetrieveContactArgs = Pick<Siopv2MachineContext, 'url' | 'authorizationRequestData'>;
|
|
183
|
+
type AddIdentityArgs = Pick<Siopv2MachineContext, 'contact' | 'authorizationRequestData'>;
|
|
184
|
+
type SendResponseArgs = {
|
|
185
|
+
didAuthConfig?: Omit<DidAuthConfig, 'identifier'>;
|
|
186
|
+
authorizationRequestData?: Siopv2AuthorizationRequestData;
|
|
187
|
+
selectedCredentials: Array<UniqueDigitalCredential>;
|
|
188
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
189
|
+
isFirstParty?: boolean;
|
|
190
|
+
};
|
|
191
|
+
type GetSelectableCredentialsArgs = Pick<Siopv2MachineContext, 'authorizationRequestData'>;
|
|
192
|
+
declare enum Siopv2HolderEvent {
|
|
193
|
+
CONTACT_IDENTITY_CREATED = "contact_identity_created",
|
|
194
|
+
IDENTIFIER_CREATED = "identifier_created"
|
|
195
|
+
}
|
|
196
|
+
declare enum SupportedLanguage {
|
|
197
|
+
ENGLISH = "en",
|
|
198
|
+
DUTCH = "nl"
|
|
199
|
+
}
|
|
200
|
+
type Siopv2AuthorizationResponseData = {
|
|
201
|
+
body?: string | Record<string, any>;
|
|
202
|
+
url?: string;
|
|
203
|
+
queryParams?: Record<string, any>;
|
|
204
|
+
};
|
|
205
|
+
type Siopv2AuthorizationRequestData = {
|
|
206
|
+
correlationId: string;
|
|
207
|
+
registrationMetadataPayload: RPRegistrationMetadataPayload;
|
|
208
|
+
issuer?: string;
|
|
209
|
+
name?: string;
|
|
210
|
+
uri?: URL;
|
|
211
|
+
clientId?: string;
|
|
212
|
+
presentationDefinitions?: PresentationDefinitionWithLocation[];
|
|
213
|
+
dcqlQuery?: DcqlQuery;
|
|
214
|
+
};
|
|
215
|
+
type SelectableCredentialsMap = Map<string, Array<SelectableCredential>>;
|
|
216
|
+
type SelectableCredential = {
|
|
217
|
+
credential: UniqueDigitalCredential;
|
|
218
|
+
credentialBranding: Array<ICredentialLocaleBranding>;
|
|
219
|
+
issuerParty?: Party;
|
|
220
|
+
subjectParty?: Party;
|
|
221
|
+
};
|
|
222
|
+
type OnContactIdentityCreatedArgs = {
|
|
223
|
+
contactId: string;
|
|
224
|
+
identity: Identity;
|
|
225
|
+
};
|
|
226
|
+
type OnIdentifierCreatedArgs = {
|
|
227
|
+
identifier: IIdentifier;
|
|
228
|
+
};
|
|
229
|
+
type RequiredContext = IAgentContext<IContactManager & IDidAuthSiopOpAuthenticator & IDIDManager & IResolver & IIdentifierResolution & ICredentialStore & IIssuanceBranding>;
|
|
230
|
+
|
|
231
|
+
type Siopv2MachineContext = {
|
|
232
|
+
url: string;
|
|
233
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
234
|
+
didAuthConfig?: Omit<DidAuthConfig, 'identifier'>;
|
|
235
|
+
authorizationRequestData?: Siopv2AuthorizationRequestData;
|
|
236
|
+
authorizationResponseData?: Siopv2AuthorizationResponseData;
|
|
237
|
+
verifiedAuthorizationRequest?: VerifiedAuthorizationRequest;
|
|
238
|
+
contact?: Party;
|
|
239
|
+
hasContactConsent: boolean;
|
|
240
|
+
contactAlias: string;
|
|
241
|
+
selectableCredentialsMap?: SelectableCredentialsMap;
|
|
242
|
+
selectedCredentials: Array<UniqueDigitalCredential>;
|
|
243
|
+
isFirstParty?: boolean;
|
|
244
|
+
error?: ErrorDetails;
|
|
245
|
+
};
|
|
246
|
+
declare enum Siopv2MachineStates {
|
|
247
|
+
createConfig = "createConfig",
|
|
248
|
+
getSiopRequest = "getSiopRequest",
|
|
249
|
+
getSelectableCredentials = "getSelectableCredentials",
|
|
250
|
+
retrieveContact = "retrieveContact",
|
|
251
|
+
transitionFromSetup = "transitionFromSetup",
|
|
252
|
+
addContact = "addContact",
|
|
253
|
+
addContactIdentity = "addContactIdentity",
|
|
254
|
+
selectCredentials = "selectCredentials",
|
|
255
|
+
sendResponse = "sendResponse",
|
|
256
|
+
handleError = "handleError",
|
|
257
|
+
aborted = "aborted",
|
|
258
|
+
declined = "declined",
|
|
259
|
+
error = "error",
|
|
260
|
+
done = "done"
|
|
261
|
+
}
|
|
262
|
+
declare enum Siopv2MachineAddContactStates {
|
|
263
|
+
idle = "idle",
|
|
264
|
+
executing = "executing",
|
|
265
|
+
next = "next"
|
|
266
|
+
}
|
|
267
|
+
type Siopv2MachineInterpreter = Interpreter<Siopv2MachineContext, any, Siopv2MachineEventTypes, {
|
|
268
|
+
value: any;
|
|
269
|
+
context: Siopv2MachineContext;
|
|
270
|
+
}, any>;
|
|
271
|
+
type Siopv2MachineState = State<Siopv2MachineContext, Siopv2MachineEventTypes, any, {
|
|
272
|
+
value: any;
|
|
273
|
+
context: Siopv2MachineContext;
|
|
274
|
+
}, any>;
|
|
275
|
+
type Siopv2StateMachine = StateMachine<Siopv2MachineContext, any, Siopv2MachineEventTypes, {
|
|
276
|
+
value: any;
|
|
277
|
+
context: Siopv2MachineContext;
|
|
278
|
+
}, BaseActionObject, ServiceMap, ResolveTypegenMeta<TypegenDisabled, Siopv2MachineEventTypes, BaseActionObject, ServiceMap>>;
|
|
279
|
+
type CreateSiopv2MachineOpts = {
|
|
280
|
+
url: string | URL;
|
|
281
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
282
|
+
machineId?: string;
|
|
283
|
+
};
|
|
284
|
+
type Siopv2MachineInstanceOpts = {
|
|
285
|
+
services?: any;
|
|
286
|
+
guards?: any;
|
|
287
|
+
subscription?: () => void;
|
|
288
|
+
requireCustomNavigationHook?: boolean;
|
|
289
|
+
stateNavigationListener?: (siopv2Machine: Siopv2MachineInterpreter, state: Siopv2MachineState, navigation?: any) => Promise<void>;
|
|
290
|
+
} & CreateSiopv2MachineOpts;
|
|
291
|
+
declare enum Siopv2MachineEvents {
|
|
292
|
+
NEXT = "NEXT",
|
|
293
|
+
PREVIOUS = "PREVIOUS",
|
|
294
|
+
DECLINE = "DECLINE",
|
|
295
|
+
SET_CONTACT_ALIAS = "SET_CONTACT_ALIAS",
|
|
296
|
+
SET_CONTACT_CONSENT = "SET_CONTACT_CONSENT",
|
|
297
|
+
CREATE_CONTACT = "CREATE_CONTACT",
|
|
298
|
+
SET_SELECTED_CREDENTIALS = "SET_SELECTED_CREDENTIALS"
|
|
299
|
+
}
|
|
300
|
+
declare enum Siopv2MachineGuards {
|
|
301
|
+
hasNoContactGuard = "Siopv2HasNoContactGuard",
|
|
302
|
+
createContactGuard = "Siopv2CreateContactGuard",
|
|
303
|
+
hasContactGuard = "Siopv2HasContactGuard",
|
|
304
|
+
hasAuthorizationRequestGuard = "Siopv2HasAuthorizationRequestGuard",
|
|
305
|
+
hasSelectableCredentialsAndContactGuard = "Siopv2HasSelectableCredentialsAndContactGuard",
|
|
306
|
+
hasSelectedRequiredCredentialsGuard = "Siopv2HasSelectedRequiredCredentialsGuard",
|
|
307
|
+
siopOnlyGuard = "Siopv2IsSiopOnlyGuard",
|
|
308
|
+
siopWithOID4VPGuard = "Siopv2IsSiopWithOID4VPGuard"
|
|
309
|
+
}
|
|
310
|
+
declare enum Siopv2MachineServices {
|
|
311
|
+
getSiopRequest = "getSiopRequest",
|
|
312
|
+
getSelectableCredentials = "getSelectableCredentials",
|
|
313
|
+
retrieveContact = "retrieveContact",
|
|
314
|
+
addContactIdentity = "addContactIdentity",
|
|
315
|
+
sendResponse = "sendResponse",
|
|
316
|
+
createConfig = "createConfig"
|
|
317
|
+
}
|
|
318
|
+
type Siopv2MachineEventTypes = NextEvent | PreviousEvent | DeclineEvent | CreateContactEvent | ContactConsentEvent | ContactAliasEvent | SelectCredentialsEvent;
|
|
319
|
+
type NextEvent = {
|
|
320
|
+
type: Siopv2MachineEvents.NEXT;
|
|
321
|
+
};
|
|
322
|
+
type PreviousEvent = {
|
|
323
|
+
type: Siopv2MachineEvents.PREVIOUS;
|
|
324
|
+
};
|
|
325
|
+
type DeclineEvent = {
|
|
326
|
+
type: Siopv2MachineEvents.DECLINE;
|
|
327
|
+
};
|
|
328
|
+
type ContactConsentEvent = {
|
|
329
|
+
type: Siopv2MachineEvents.SET_CONTACT_CONSENT;
|
|
330
|
+
data: boolean;
|
|
331
|
+
};
|
|
332
|
+
type ContactAliasEvent = {
|
|
333
|
+
type: Siopv2MachineEvents.SET_CONTACT_ALIAS;
|
|
334
|
+
data: string;
|
|
335
|
+
};
|
|
336
|
+
type CreateContactEvent = {
|
|
337
|
+
type: Siopv2MachineEvents.CREATE_CONTACT;
|
|
338
|
+
data: Party;
|
|
339
|
+
};
|
|
340
|
+
type SelectCredentialsEvent = {
|
|
341
|
+
type: Siopv2MachineEvents.SET_SELECTED_CREDENTIALS;
|
|
342
|
+
data: Array<UniqueDigitalCredential>;
|
|
343
|
+
};
|
|
344
|
+
type Siopv2Machine$1 = {
|
|
345
|
+
interpreter: Siopv2MachineInterpreter;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
declare const LOGGER_NAMESPACE = "sphereon:siopv2-oid4vp:op-auth";
|
|
349
|
+
interface IDidAuthSiopOpAuthenticator extends IPluginMethodMap {
|
|
350
|
+
siopGetOPSession(args: IGetSiopSessionArgs, context: IRequiredContext): Promise<OpSession>;
|
|
351
|
+
siopRegisterOPSession(args: Omit<IOpSessionArgs, 'context'>, context: IRequiredContext): Promise<OpSession>;
|
|
352
|
+
siopRemoveOPSession(args: IRemoveSiopSessionArgs, context: IRequiredContext): Promise<boolean>;
|
|
353
|
+
siopRegisterOPCustomApproval(args: IRegisterCustomApprovalForSiopArgs, context: IRequiredContext): Promise<void>;
|
|
354
|
+
siopRemoveOPCustomApproval(args: IRemoveCustomApprovalForSiopArgs, context: IRequiredContext): Promise<boolean>;
|
|
355
|
+
siopGetMachineInterpreter(args: GetMachineArgs, context: RequiredContext): Promise<Siopv2Machine$1>;
|
|
356
|
+
siopCreateConfig(args: CreateConfigArgs): Promise<CreateConfigResult>;
|
|
357
|
+
siopGetSiopRequest(args: GetSiopRequestArgs, context: RequiredContext): Promise<Siopv2AuthorizationRequestData>;
|
|
358
|
+
siopRetrieveContact(args: RetrieveContactArgs, context: RequiredContext): Promise<Party | undefined>;
|
|
359
|
+
siopAddIdentity(args: AddIdentityArgs, context: RequiredContext): Promise<void>;
|
|
360
|
+
siopSendResponse(args: SendResponseArgs, context: RequiredContext): Promise<Siopv2AuthorizationResponseData>;
|
|
361
|
+
siopGetSelectableCredentials(args: GetSelectableCredentialsArgs, context: RequiredContext): Promise<SelectableCredentialsMap>;
|
|
362
|
+
}
|
|
363
|
+
interface IOpSessionArgs {
|
|
364
|
+
sessionId?: string;
|
|
365
|
+
requestJwtOrUri: string | URI;
|
|
366
|
+
providedPresentationDefinitions?: Array<PresentationDefinitionWithLocation>;
|
|
367
|
+
identifierOptions?: ManagedIdentifierOptsOrResult;
|
|
368
|
+
context: IRequiredContext;
|
|
369
|
+
op?: IOPOptions;
|
|
370
|
+
}
|
|
371
|
+
interface IAuthRequestDetails {
|
|
372
|
+
rpDIDDocument?: DIDDocument;
|
|
373
|
+
id: string;
|
|
374
|
+
verifiablePresentationMatches: IPresentationWithDefinition[];
|
|
375
|
+
alsoKnownAs?: string[];
|
|
376
|
+
}
|
|
377
|
+
interface IPresentationWithDefinition {
|
|
378
|
+
location: VPTokenLocation;
|
|
379
|
+
definition: PresentationDefinitionWithLocation;
|
|
380
|
+
format: VerifiablePresentationTypeFormat;
|
|
381
|
+
presentation: W3CVerifiablePresentation;
|
|
382
|
+
}
|
|
383
|
+
interface IGetSiopSessionArgs {
|
|
384
|
+
sessionId: string;
|
|
385
|
+
}
|
|
386
|
+
interface IRemoveSiopSessionArgs {
|
|
387
|
+
sessionId: string;
|
|
388
|
+
}
|
|
389
|
+
interface IRegisterCustomApprovalForSiopArgs {
|
|
390
|
+
key: string;
|
|
391
|
+
customApproval: (verifiedAuthorizationRequest: VerifiedAuthorizationRequest, sessionId: string) => Promise<void>;
|
|
392
|
+
}
|
|
393
|
+
interface IRemoveCustomApprovalForSiopArgs {
|
|
394
|
+
key: string;
|
|
395
|
+
}
|
|
396
|
+
interface IOpsSendSiopAuthorizationResponseArgs {
|
|
397
|
+
responseSignerOpts: ManagedIdentifierOptsOrResult;
|
|
398
|
+
presentationSubmission?: PresentationSubmission;
|
|
399
|
+
verifiablePresentations?: W3CVerifiablePresentation[];
|
|
400
|
+
dcqlResponse?: DcqlResponseOpts;
|
|
401
|
+
hasher?: HasherSync;
|
|
402
|
+
isFirstParty?: boolean;
|
|
403
|
+
}
|
|
404
|
+
declare enum events {
|
|
405
|
+
DID_SIOP_AUTHENTICATED = "didSiopAuthenticated"
|
|
406
|
+
}
|
|
407
|
+
type IRequiredContext = IAgentContext<IDataStoreORM & IResolver & IDIDManager & IKeyManager & IIdentifierResolution & ICredentialIssuer & ICredentialValidation & ICredentialVerifier & ICredentialStore & IPDManager & ISDJwtPlugin & IJwtService>;
|
|
408
|
+
interface IOPOptions {
|
|
409
|
+
responseMode?: ResponseMode;
|
|
410
|
+
supportedVersions?: SupportedVersion[];
|
|
411
|
+
expiresIn?: number;
|
|
412
|
+
checkLinkedDomains?: CheckLinkedDomain;
|
|
413
|
+
skipDidResolution?: boolean;
|
|
414
|
+
eventEmitter?: EventEmitter;
|
|
415
|
+
supportedDIDMethods?: string[];
|
|
416
|
+
verifyJwtCallback?: VerifyJwtCallback;
|
|
417
|
+
wellknownDIDVerifyCallback?: VerifyCallback;
|
|
418
|
+
presentationSignCallback?: PresentationSignCallback;
|
|
419
|
+
resolveOpts?: ResolveOpts;
|
|
420
|
+
hasher?: HasherSync;
|
|
421
|
+
}
|
|
422
|
+
interface VerifiableCredentialsWithDefinition {
|
|
423
|
+
definition: PresentationDefinitionWithLocation;
|
|
424
|
+
credentials: (UniqueDigitalCredential | OriginalVerifiableCredential)[];
|
|
425
|
+
}
|
|
426
|
+
interface VerifiablePresentationWithDefinition extends VerifiablePresentationResult {
|
|
427
|
+
definition: PresentationDefinitionWithLocation;
|
|
428
|
+
verifiableCredentials: OriginalVerifiableCredential[];
|
|
429
|
+
idOpts: ManagedIdentifierOptsOrResult;
|
|
430
|
+
}
|
|
431
|
+
interface IOpSessionGetOID4VPArgs {
|
|
432
|
+
allIdentifiers?: string[];
|
|
433
|
+
hasher?: HasherSync;
|
|
434
|
+
}
|
|
435
|
+
interface IOID4VPArgs {
|
|
436
|
+
session: OpSession;
|
|
437
|
+
allIdentifiers?: string[];
|
|
438
|
+
hasher?: HasherSync;
|
|
439
|
+
}
|
|
440
|
+
interface IGetPresentationExchangeArgs {
|
|
441
|
+
verifiableCredentials: OriginalVerifiableCredential[];
|
|
442
|
+
allIdentifiers?: string[];
|
|
443
|
+
hasher?: HasherSync;
|
|
444
|
+
}
|
|
445
|
+
type Json = string | number | boolean | null | {
|
|
446
|
+
[key: string]: Json;
|
|
447
|
+
} | Json[];
|
|
448
|
+
declare const DEFAULT_JWT_PROOF_TYPE = "JwtProof2020";
|
|
449
|
+
|
|
450
|
+
declare const DID_PREFIX = "did";
|
|
451
|
+
type CreateOrGetIdentifierOpts = {
|
|
452
|
+
method: SupportedDidMethodEnum;
|
|
453
|
+
createOpts?: CreateIdentifierCreateOpts;
|
|
454
|
+
};
|
|
455
|
+
type CreateIdentifierCreateOpts = {
|
|
456
|
+
kms?: string;
|
|
457
|
+
alias?: string;
|
|
458
|
+
options?: IdentifierProviderOpts;
|
|
459
|
+
};
|
|
460
|
+
type IdentifierProviderOpts = {
|
|
461
|
+
type?: TKeyType;
|
|
462
|
+
use?: string;
|
|
463
|
+
[x: string]: any;
|
|
464
|
+
};
|
|
465
|
+
type KeyOpts = {
|
|
466
|
+
didMethod: SupportedDidMethodEnum;
|
|
467
|
+
keyType: TKeyType;
|
|
468
|
+
codecName?: string;
|
|
469
|
+
kid?: string;
|
|
470
|
+
identifier: IIdentifier;
|
|
471
|
+
};
|
|
472
|
+
type GetIdentifierArgs = {
|
|
473
|
+
keyOpts: KeyOpts;
|
|
474
|
+
context: RequiredContext;
|
|
475
|
+
};
|
|
476
|
+
type IdentifierWithKey = {
|
|
477
|
+
identifier: IIdentifier;
|
|
478
|
+
key: _ExtendedIKey;
|
|
479
|
+
kid: string;
|
|
480
|
+
};
|
|
481
|
+
type GetAuthenticationKeyArgs = {
|
|
482
|
+
identifier: IIdentifier;
|
|
483
|
+
context: RequiredContext;
|
|
484
|
+
};
|
|
485
|
+
type CreateIdentifierArgs = {
|
|
486
|
+
context: RequiredContext;
|
|
487
|
+
opts?: CreateIdentifierOpts;
|
|
488
|
+
};
|
|
489
|
+
type CreateIdentifierOpts = {
|
|
490
|
+
method: SupportedDidMethodEnum;
|
|
491
|
+
createOpts?: CreateIdentifierCreateOpts;
|
|
492
|
+
};
|
|
493
|
+
type DidAgents = TAgent<IResolver & IDIDManager>;
|
|
494
|
+
type SuitableCredentialAgents = TAgent<IContactManager & ICredentialStore & IIssuanceBranding>;
|
|
495
|
+
|
|
496
|
+
declare const didAuthSiopOpAuthenticatorMethods: Array<string>;
|
|
497
|
+
declare class DidAuthSiopOpAuthenticator implements IAgentPlugin {
|
|
498
|
+
readonly schema: any;
|
|
499
|
+
readonly methods: IDidAuthSiopOpAuthenticator;
|
|
500
|
+
private readonly sessions;
|
|
501
|
+
private readonly customApprovals;
|
|
502
|
+
private readonly presentationSignCallback?;
|
|
503
|
+
private readonly onContactIdentityCreated?;
|
|
504
|
+
private readonly onIdentifierCreated?;
|
|
505
|
+
private readonly eventEmitter?;
|
|
506
|
+
private readonly hasher?;
|
|
507
|
+
constructor(options?: DidAuthSiopOpAuthenticatorOptions);
|
|
508
|
+
onEvent(event: any, context: RequiredContext): Promise<void>;
|
|
509
|
+
private siopGetOPSession;
|
|
510
|
+
private siopRegisterOPSession;
|
|
511
|
+
private siopRemoveOPSession;
|
|
512
|
+
private siopRegisterOPCustomApproval;
|
|
513
|
+
private siopRemoveOPCustomApproval;
|
|
514
|
+
private siopGetMachineInterpreter;
|
|
515
|
+
private siopCreateConfig;
|
|
516
|
+
private siopGetSiopRequest;
|
|
517
|
+
private determineCorrelationId;
|
|
518
|
+
private siopRetrieveContact;
|
|
519
|
+
private siopAddContactIdentity;
|
|
520
|
+
private siopSendResponse;
|
|
521
|
+
private hasMDocCredentials;
|
|
522
|
+
private isMDocCredential;
|
|
523
|
+
private hasSdJwtCredentials;
|
|
524
|
+
private isSdJwtCredential;
|
|
525
|
+
private retrieveEncodedCredential;
|
|
526
|
+
private siopGetSelectableCredentials;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
declare class Siopv2Machine {
|
|
530
|
+
static newInstance(opts: Siopv2MachineInstanceOpts): {
|
|
531
|
+
interpreter: Siopv2MachineInterpreter;
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
declare const OID4VPCallbackStateListener: (callbacks?: Map<Siopv2MachineStates, (machine: Siopv2MachineInterpreter, state: Siopv2MachineState, opts?: any) => Promise<void>>) => (oid4vciMachine: Siopv2MachineInterpreter, state: Siopv2MachineState) => Promise<void>;
|
|
536
|
+
|
|
537
|
+
declare class Siopv2OID4VPLinkHandler extends LinkHandlerAdapter {
|
|
538
|
+
private readonly context;
|
|
539
|
+
private readonly stateNavigationListener;
|
|
540
|
+
private readonly noStateMachinePersistence;
|
|
541
|
+
private readonly idOpts?;
|
|
542
|
+
constructor(args: Pick<GetMachineArgs, 'stateNavigationListener'> & {
|
|
543
|
+
protocols?: Array<string | RegExp>;
|
|
544
|
+
context: IAgentContext<IDidAuthSiopOpAuthenticator & IMachineStatePersistence>;
|
|
545
|
+
noStateMachinePersistence?: boolean;
|
|
546
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
547
|
+
});
|
|
548
|
+
handle(url: string | URL, opts?: {
|
|
549
|
+
machineState?: SerializableState;
|
|
550
|
+
idOpts?: ManagedIdentifierOptsOrResult;
|
|
551
|
+
}): Promise<void>;
|
|
552
|
+
}
|
|
553
|
+
|
|
1
554
|
/**
|
|
2
555
|
* @public
|
|
3
556
|
*/
|
|
4
557
|
declare const schema: any;
|
|
5
|
-
|
|
6
|
-
export { DidAuthSiopOpAuthenticator, didAuthSiopOpAuthenticatorMethods
|
|
7
|
-
export { Siopv2Machine } from './machine/Siopv2Machine';
|
|
8
|
-
export * from './machine/CallbackStateListener';
|
|
9
|
-
export * from './session';
|
|
10
|
-
export * from './types';
|
|
11
|
-
export * from './link-handler';
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
558
|
+
|
|
559
|
+
export { type AddIdentityArgs, type ContactAliasEvent, type ContactConsentEvent, type CreateConfigArgs, type CreateConfigResult, type CreateContactEvent, type CreateIdentifierArgs, type CreateIdentifierCreateOpts, type CreateIdentifierOpts, type CreateOrGetIdentifierOpts, type CreateSiopv2MachineOpts, DEFAULT_JWT_PROOF_TYPE, DID_PREFIX, type DeclineEvent, type DidAgents, DidAuthSiopOpAuthenticator, type DidAuthSiopOpAuthenticatorOptions, type ErrorDetails, type GetAuthenticationKeyArgs, type GetIdentifierArgs, type GetMachineArgs, type GetSelectableCredentialsArgs, type GetSiopRequestArgs, type IAuthRequestDetails, type IDidAuthSiopOpAuthenticator, type IGetPresentationExchangeArgs, type IGetSiopSessionArgs, type IOID4VPArgs, type IOPOptions, type IOpSessionArgs, type IOpSessionGetOID4VPArgs, type IOpsSendSiopAuthorizationResponseArgs, type IPresentationWithDefinition, type IRegisterCustomApprovalForSiopArgs, type IRemoveCustomApprovalForSiopArgs, type IRemoveSiopSessionArgs, type IRequiredContext, type IdentifierProviderOpts, type IdentifierWithKey, type Json, type KeyOpts, LOGGER_NAMESPACE, type NextEvent, OID4VP, OID4VPCallbackStateListener, type OnContactIdentityCreatedArgs, type OnIdentifierCreatedArgs, OpSession, type PreviousEvent, type RequiredContext, type RetrieveContactArgs, type SelectCredentialsEvent, type SelectableCredential, type SelectableCredentialsMap, type SendResponseArgs, type Siopv2AuthorizationRequestData, type Siopv2AuthorizationResponseData, Siopv2HolderEvent, Siopv2Machine, Siopv2MachineAddContactStates, type Siopv2MachineContext, type Siopv2MachineEventTypes, Siopv2MachineEvents, Siopv2MachineGuards, type Siopv2MachineInstanceOpts, type Siopv2MachineInterpreter, Siopv2MachineServices, type Siopv2MachineState, Siopv2MachineStates, Siopv2OID4VPLinkHandler, type Siopv2StateMachine, type SuitableCredentialAgents, SupportedLanguage, type VerifiableCredentialsWithDefinition, type VerifiablePresentationWithDefinition, createJwtCallbackWithIdOpts, createJwtCallbackWithOpOpts, createOID4VPPresentationSignCallback, createOP, createOPBuilder, didAuthSiopOpAuthenticatorMethods, events, getSigningAlgo, schema };
|