@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.33.1-feature.vcdm2.tsup.32 → 0.33.1-next.3

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.
Files changed (88) hide show
  1. package/dist/agent/DidAuthSiopOpAuthenticator.d.ts +36 -0
  2. package/dist/agent/DidAuthSiopOpAuthenticator.d.ts.map +1 -0
  3. package/dist/agent/DidAuthSiopOpAuthenticator.js +392 -0
  4. package/dist/agent/DidAuthSiopOpAuthenticator.js.map +1 -0
  5. package/dist/index.d.ts +8 -555
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +31 -2420
  8. package/dist/index.js.map +1 -1
  9. package/dist/link-handler/index.d.ts +22 -0
  10. package/dist/link-handler/index.d.ts.map +1 -0
  11. package/dist/link-handler/index.js +57 -0
  12. package/dist/link-handler/index.js.map +1 -0
  13. package/dist/localization/Localization.d.ts +9 -0
  14. package/dist/localization/Localization.d.ts.map +1 -0
  15. package/dist/localization/Localization.js +46 -0
  16. package/dist/localization/Localization.js.map +1 -0
  17. package/dist/localization/translations/en.json +9 -0
  18. package/dist/localization/translations/nl.json +8 -0
  19. package/dist/machine/CallbackStateListener.d.ts +3 -0
  20. package/dist/machine/CallbackStateListener.d.ts.map +1 -0
  21. package/dist/machine/CallbackStateListener.js +48 -0
  22. package/dist/machine/CallbackStateListener.js.map +1 -0
  23. package/dist/machine/Siopv2Machine.d.ts +8 -0
  24. package/dist/machine/Siopv2Machine.d.ts.map +1 -0
  25. package/dist/machine/Siopv2Machine.js +364 -0
  26. package/dist/machine/Siopv2Machine.js.map +1 -0
  27. package/dist/services/IdentifierService.d.ts +3 -0
  28. package/dist/services/IdentifierService.d.ts.map +1 -0
  29. package/dist/services/IdentifierService.js +28 -0
  30. package/dist/services/IdentifierService.js.map +1 -0
  31. package/dist/services/Siopv2MachineService.d.ts +18 -0
  32. package/dist/services/Siopv2MachineService.d.ts.map +1 -0
  33. package/dist/services/Siopv2MachineService.js +299 -0
  34. package/dist/services/Siopv2MachineService.js.map +1 -0
  35. package/dist/session/OID4VP.d.ts +72 -0
  36. package/dist/session/OID4VP.d.ts.map +1 -0
  37. package/dist/session/OID4VP.js +224 -0
  38. package/dist/session/OID4VP.js.map +1 -0
  39. package/dist/session/OpSession.d.ts +39 -0
  40. package/dist/session/OpSession.d.ts.map +1 -0
  41. package/dist/session/OpSession.js +365 -0
  42. package/dist/session/OpSession.js.map +1 -0
  43. package/dist/session/functions.d.ts +37 -0
  44. package/dist/session/functions.d.ts.map +1 -0
  45. package/dist/session/functions.js +163 -0
  46. package/dist/session/functions.js.map +1 -0
  47. package/dist/session/index.d.ts +4 -0
  48. package/dist/session/index.d.ts.map +1 -0
  49. package/dist/session/index.js +20 -0
  50. package/dist/session/index.js.map +1 -0
  51. package/dist/types/IDidAuthSiopOpAuthenticator.d.ts +120 -0
  52. package/dist/types/IDidAuthSiopOpAuthenticator.d.ts.map +1 -0
  53. package/dist/types/IDidAuthSiopOpAuthenticator.js +10 -0
  54. package/dist/types/IDidAuthSiopOpAuthenticator.js.map +1 -0
  55. package/dist/types/error/index.d.ts +8 -0
  56. package/dist/types/error/index.d.ts.map +1 -0
  57. package/dist/types/error/index.js +3 -0
  58. package/dist/types/error/index.js.map +1 -0
  59. package/dist/types/identifier/index.d.ts +53 -0
  60. package/dist/types/identifier/index.d.ts.map +1 -0
  61. package/dist/types/identifier/index.js +5 -0
  62. package/dist/types/identifier/index.js.map +1 -0
  63. package/dist/types/index.d.ts +6 -0
  64. package/dist/types/index.d.ts.map +1 -0
  65. package/dist/types/index.js +22 -0
  66. package/dist/types/index.js.map +1 -0
  67. package/dist/types/machine/index.d.ts +124 -0
  68. package/dist/types/machine/index.d.ts.map +1 -0
  69. package/dist/types/machine/index.js +57 -0
  70. package/dist/types/machine/index.js.map +1 -0
  71. package/dist/types/siop-service/index.d.ts +80 -0
  72. package/dist/types/siop-service/index.d.ts.map +1 -0
  73. package/dist/types/siop-service/index.js +14 -0
  74. package/dist/types/siop-service/index.js.map +1 -0
  75. package/dist/utils/CredentialUtils.d.ts +23 -0
  76. package/dist/utils/CredentialUtils.d.ts.map +1 -0
  77. package/dist/utils/CredentialUtils.js +65 -0
  78. package/dist/utils/CredentialUtils.js.map +1 -0
  79. package/dist/utils/dcql.d.ts +5 -0
  80. package/dist/utils/dcql.d.ts.map +1 -0
  81. package/dist/utils/dcql.js +37 -0
  82. package/dist/utils/dcql.js.map +1 -0
  83. package/package.json +30 -41
  84. package/src/agent/DidAuthSiopOpAuthenticator.ts +14 -13
  85. package/src/session/OpSession.ts +13 -13
  86. package/dist/index.cjs +0 -2451
  87. package/dist/index.cjs.map +0 -1
  88. package/dist/index.d.cts +0 -559
@@ -0,0 +1,124 @@
1
+ import { VerifiedAuthorizationRequest } from '@sphereon/did-auth-siop';
2
+ import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
+ import { DidAuthConfig, Party } from '@sphereon/ssi-sdk.data-store';
4
+ import { BaseActionObject, Interpreter, ResolveTypegenMeta, ServiceMap, State, StateMachine, TypegenDisabled } from 'xstate';
5
+ import { ErrorDetails } from '../error';
6
+ import { SelectableCredentialsMap, Siopv2AuthorizationRequestData, Siopv2AuthorizationResponseData } from '../siop-service';
7
+ import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store';
8
+ export type Siopv2MachineContext = {
9
+ url: string;
10
+ idOpts?: ManagedIdentifierOptsOrResult;
11
+ didAuthConfig?: Omit<DidAuthConfig, 'identifier'>;
12
+ authorizationRequestData?: Siopv2AuthorizationRequestData;
13
+ authorizationResponseData?: Siopv2AuthorizationResponseData;
14
+ verifiedAuthorizationRequest?: VerifiedAuthorizationRequest;
15
+ contact?: Party;
16
+ hasContactConsent: boolean;
17
+ contactAlias: string;
18
+ selectableCredentialsMap?: SelectableCredentialsMap;
19
+ selectedCredentials: Array<UniqueDigitalCredential>;
20
+ isFirstParty?: boolean;
21
+ error?: ErrorDetails;
22
+ };
23
+ export declare enum Siopv2MachineStates {
24
+ createConfig = "createConfig",
25
+ getSiopRequest = "getSiopRequest",
26
+ getSelectableCredentials = "getSelectableCredentials",
27
+ retrieveContact = "retrieveContact",
28
+ transitionFromSetup = "transitionFromSetup",
29
+ addContact = "addContact",
30
+ addContactIdentity = "addContactIdentity",
31
+ selectCredentials = "selectCredentials",
32
+ sendResponse = "sendResponse",
33
+ handleError = "handleError",
34
+ aborted = "aborted",
35
+ declined = "declined",
36
+ error = "error",
37
+ done = "done"
38
+ }
39
+ export declare enum Siopv2MachineAddContactStates {
40
+ idle = "idle",
41
+ executing = "executing",
42
+ next = "next"
43
+ }
44
+ export type Siopv2MachineInterpreter = Interpreter<Siopv2MachineContext, any, Siopv2MachineEventTypes, {
45
+ value: any;
46
+ context: Siopv2MachineContext;
47
+ }, any>;
48
+ export type Siopv2MachineState = State<Siopv2MachineContext, Siopv2MachineEventTypes, any, {
49
+ value: any;
50
+ context: Siopv2MachineContext;
51
+ }, any>;
52
+ export type Siopv2StateMachine = StateMachine<Siopv2MachineContext, any, Siopv2MachineEventTypes, {
53
+ value: any;
54
+ context: Siopv2MachineContext;
55
+ }, BaseActionObject, ServiceMap, ResolveTypegenMeta<TypegenDisabled, Siopv2MachineEventTypes, BaseActionObject, ServiceMap>>;
56
+ export type CreateSiopv2MachineOpts = {
57
+ url: string | URL;
58
+ idOpts?: ManagedIdentifierOptsOrResult;
59
+ machineId?: string;
60
+ };
61
+ export type Siopv2MachineInstanceOpts = {
62
+ services?: any;
63
+ guards?: any;
64
+ subscription?: () => void;
65
+ requireCustomNavigationHook?: boolean;
66
+ stateNavigationListener?: (siopv2Machine: Siopv2MachineInterpreter, state: Siopv2MachineState, navigation?: any) => Promise<void>;
67
+ } & CreateSiopv2MachineOpts;
68
+ export declare enum Siopv2MachineEvents {
69
+ NEXT = "NEXT",
70
+ PREVIOUS = "PREVIOUS",
71
+ DECLINE = "DECLINE",
72
+ SET_CONTACT_ALIAS = "SET_CONTACT_ALIAS",
73
+ SET_CONTACT_CONSENT = "SET_CONTACT_CONSENT",
74
+ CREATE_CONTACT = "CREATE_CONTACT",
75
+ SET_SELECTED_CREDENTIALS = "SET_SELECTED_CREDENTIALS"
76
+ }
77
+ export declare enum Siopv2MachineGuards {
78
+ hasNoContactGuard = "Siopv2HasNoContactGuard",
79
+ createContactGuard = "Siopv2CreateContactGuard",
80
+ hasContactGuard = "Siopv2HasContactGuard",
81
+ hasAuthorizationRequestGuard = "Siopv2HasAuthorizationRequestGuard",
82
+ hasSelectableCredentialsAndContactGuard = "Siopv2HasSelectableCredentialsAndContactGuard",
83
+ hasSelectedRequiredCredentialsGuard = "Siopv2HasSelectedRequiredCredentialsGuard",
84
+ siopOnlyGuard = "Siopv2IsSiopOnlyGuard",
85
+ siopWithOID4VPGuard = "Siopv2IsSiopWithOID4VPGuard"
86
+ }
87
+ export declare enum Siopv2MachineServices {
88
+ getSiopRequest = "getSiopRequest",
89
+ getSelectableCredentials = "getSelectableCredentials",
90
+ retrieveContact = "retrieveContact",
91
+ addContactIdentity = "addContactIdentity",
92
+ sendResponse = "sendResponse",
93
+ createConfig = "createConfig"
94
+ }
95
+ export type Siopv2MachineEventTypes = NextEvent | PreviousEvent | DeclineEvent | CreateContactEvent | ContactConsentEvent | ContactAliasEvent | SelectCredentialsEvent;
96
+ export type NextEvent = {
97
+ type: Siopv2MachineEvents.NEXT;
98
+ };
99
+ export type PreviousEvent = {
100
+ type: Siopv2MachineEvents.PREVIOUS;
101
+ };
102
+ export type DeclineEvent = {
103
+ type: Siopv2MachineEvents.DECLINE;
104
+ };
105
+ export type ContactConsentEvent = {
106
+ type: Siopv2MachineEvents.SET_CONTACT_CONSENT;
107
+ data: boolean;
108
+ };
109
+ export type ContactAliasEvent = {
110
+ type: Siopv2MachineEvents.SET_CONTACT_ALIAS;
111
+ data: string;
112
+ };
113
+ export type CreateContactEvent = {
114
+ type: Siopv2MachineEvents.CREATE_CONTACT;
115
+ data: Party;
116
+ };
117
+ export type SelectCredentialsEvent = {
118
+ type: Siopv2MachineEvents.SET_SELECTED_CREDENTIALS;
119
+ data: Array<UniqueDigitalCredential>;
120
+ };
121
+ export type Siopv2Machine = {
122
+ interpreter: Siopv2MachineInterpreter;
123
+ };
124
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/machine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAA;AAC3F,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAC5H,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAA;AAC3H,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAE5E,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,6BAA6B,CAAA;IACtC,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAA;IACjD,wBAAwB,CAAC,EAAE,8BAA8B,CAAA;IACzD,yBAAyB,CAAC,EAAE,+BAA+B,CAAA;IAC3D,4BAA4B,CAAC,EAAE,4BAA4B,CAAA;IAC3D,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,iBAAiB,EAAE,OAAO,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,mBAAmB,EAAE,KAAK,CAAC,uBA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AA;AAClE,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAA;CAAE,CAAA;AAChE,MAAM,MAAM,mBAAmB,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAC,mBAAmB,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAClG,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAC,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAC7F,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,mBAAmB,CAAC,cAAc,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAA;AAC1F,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,mBAAmB,CAAC,wBAAwB,CAAA;IAClD,IAAI,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,wBAAwB,CAAA;CACtC,CAAA"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Siopv2MachineServices = exports.Siopv2MachineGuards = exports.Siopv2MachineEvents = exports.Siopv2MachineAddContactStates = exports.Siopv2MachineStates = void 0;
4
+ var Siopv2MachineStates;
5
+ (function (Siopv2MachineStates) {
6
+ Siopv2MachineStates["createConfig"] = "createConfig";
7
+ Siopv2MachineStates["getSiopRequest"] = "getSiopRequest";
8
+ Siopv2MachineStates["getSelectableCredentials"] = "getSelectableCredentials";
9
+ Siopv2MachineStates["retrieveContact"] = "retrieveContact";
10
+ Siopv2MachineStates["transitionFromSetup"] = "transitionFromSetup";
11
+ Siopv2MachineStates["addContact"] = "addContact";
12
+ Siopv2MachineStates["addContactIdentity"] = "addContactIdentity";
13
+ Siopv2MachineStates["selectCredentials"] = "selectCredentials";
14
+ Siopv2MachineStates["sendResponse"] = "sendResponse";
15
+ Siopv2MachineStates["handleError"] = "handleError";
16
+ Siopv2MachineStates["aborted"] = "aborted";
17
+ Siopv2MachineStates["declined"] = "declined";
18
+ Siopv2MachineStates["error"] = "error";
19
+ Siopv2MachineStates["done"] = "done";
20
+ })(Siopv2MachineStates || (exports.Siopv2MachineStates = Siopv2MachineStates = {}));
21
+ var Siopv2MachineAddContactStates;
22
+ (function (Siopv2MachineAddContactStates) {
23
+ Siopv2MachineAddContactStates["idle"] = "idle";
24
+ Siopv2MachineAddContactStates["executing"] = "executing";
25
+ Siopv2MachineAddContactStates["next"] = "next";
26
+ })(Siopv2MachineAddContactStates || (exports.Siopv2MachineAddContactStates = Siopv2MachineAddContactStates = {}));
27
+ var Siopv2MachineEvents;
28
+ (function (Siopv2MachineEvents) {
29
+ Siopv2MachineEvents["NEXT"] = "NEXT";
30
+ Siopv2MachineEvents["PREVIOUS"] = "PREVIOUS";
31
+ Siopv2MachineEvents["DECLINE"] = "DECLINE";
32
+ Siopv2MachineEvents["SET_CONTACT_ALIAS"] = "SET_CONTACT_ALIAS";
33
+ Siopv2MachineEvents["SET_CONTACT_CONSENT"] = "SET_CONTACT_CONSENT";
34
+ Siopv2MachineEvents["CREATE_CONTACT"] = "CREATE_CONTACT";
35
+ Siopv2MachineEvents["SET_SELECTED_CREDENTIALS"] = "SET_SELECTED_CREDENTIALS";
36
+ })(Siopv2MachineEvents || (exports.Siopv2MachineEvents = Siopv2MachineEvents = {}));
37
+ var Siopv2MachineGuards;
38
+ (function (Siopv2MachineGuards) {
39
+ Siopv2MachineGuards["hasNoContactGuard"] = "Siopv2HasNoContactGuard";
40
+ Siopv2MachineGuards["createContactGuard"] = "Siopv2CreateContactGuard";
41
+ Siopv2MachineGuards["hasContactGuard"] = "Siopv2HasContactGuard";
42
+ Siopv2MachineGuards["hasAuthorizationRequestGuard"] = "Siopv2HasAuthorizationRequestGuard";
43
+ Siopv2MachineGuards["hasSelectableCredentialsAndContactGuard"] = "Siopv2HasSelectableCredentialsAndContactGuard";
44
+ Siopv2MachineGuards["hasSelectedRequiredCredentialsGuard"] = "Siopv2HasSelectedRequiredCredentialsGuard";
45
+ Siopv2MachineGuards["siopOnlyGuard"] = "Siopv2IsSiopOnlyGuard";
46
+ Siopv2MachineGuards["siopWithOID4VPGuard"] = "Siopv2IsSiopWithOID4VPGuard";
47
+ })(Siopv2MachineGuards || (exports.Siopv2MachineGuards = Siopv2MachineGuards = {}));
48
+ var Siopv2MachineServices;
49
+ (function (Siopv2MachineServices) {
50
+ Siopv2MachineServices["getSiopRequest"] = "getSiopRequest";
51
+ Siopv2MachineServices["getSelectableCredentials"] = "getSelectableCredentials";
52
+ Siopv2MachineServices["retrieveContact"] = "retrieveContact";
53
+ Siopv2MachineServices["addContactIdentity"] = "addContactIdentity";
54
+ Siopv2MachineServices["sendResponse"] = "sendResponse";
55
+ Siopv2MachineServices["createConfig"] = "createConfig";
56
+ })(Siopv2MachineServices || (exports.Siopv2MachineServices = Siopv2MachineServices = {}));
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/machine/index.ts"],"names":[],"mappings":";;;AAwBA,IAAY,mBAeX;AAfD,WAAY,mBAAmB;IAC7B,oDAA6B,CAAA;IAC7B,wDAAiC,CAAA;IACjC,4EAAqD,CAAA;IACrD,0DAAmC,CAAA;IACnC,kEAA2C,CAAA;IAC3C,gDAAyB,CAAA;IACzB,gEAAyC,CAAA;IACzC,8DAAuC,CAAA;IACvC,oDAA6B,CAAA;IAC7B,kDAA2B,CAAA;IAC3B,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;IACrB,sCAAe,CAAA;IACf,oCAAa,CAAA;AACf,CAAC,EAfW,mBAAmB,mCAAnB,mBAAmB,QAe9B;AAED,IAAY,6BAIX;AAJD,WAAY,6BAA6B;IACvC,8CAAa,CAAA;IACb,wDAAuB,CAAA;IACvB,8CAAa,CAAA;AACf,CAAC,EAJW,6BAA6B,6CAA7B,6BAA6B,QAIxC;AA6CD,IAAY,mBAQX;AARD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,4CAAqB,CAAA;IACrB,0CAAmB,CAAA;IACnB,8DAAuC,CAAA;IACvC,kEAA2C,CAAA;IAC3C,wDAAiC,CAAA;IACjC,4EAAqD,CAAA;AACvD,CAAC,EARW,mBAAmB,mCAAnB,mBAAmB,QAQ9B;AAED,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,oEAA6C,CAAA;IAC7C,sEAA+C,CAAA;IAC/C,gEAAyC,CAAA;IACzC,0FAAmE,CAAA;IACnE,gHAAyF,CAAA;IACzF,wGAAiF,CAAA;IACjF,8DAAuC,CAAA;IACvC,0EAAmD,CAAA;AACrD,CAAC,EATW,mBAAmB,mCAAnB,mBAAmB,QAS9B;AAED,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,0DAAiC,CAAA;IACjC,8EAAqD,CAAA;IACrD,4DAAmC,CAAA;IACnC,kEAAyC,CAAA;IACzC,sDAA6B,CAAA;IAC7B,sDAA6B,CAAA;AAC/B,CAAC,EAPW,qBAAqB,qCAArB,qBAAqB,QAOhC"}
@@ -0,0 +1,80 @@
1
+ import { PresentationDefinitionWithLocation, PresentationSignCallback, RPRegistrationMetadataPayload, VerifiedAuthorizationRequest } from '@sphereon/did-auth-siop';
2
+ import { IIdentifierResolution, ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution';
3
+ import { IContactManager } from '@sphereon/ssi-sdk.contact-manager';
4
+ import { ICredentialStore, UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store';
5
+ import { DidAuthConfig, ICredentialLocaleBranding, Identity, Party } from '@sphereon/ssi-sdk.data-store';
6
+ import { IIssuanceBranding } from '@sphereon/ssi-sdk.issuance-branding';
7
+ import { IAgentContext, IDIDManager, IIdentifier, IResolver } from '@veramo/core';
8
+ import { IDidAuthSiopOpAuthenticator } from '../IDidAuthSiopOpAuthenticator';
9
+ import { Siopv2MachineContext, Siopv2MachineInterpreter, Siopv2MachineState } from '../machine';
10
+ import { DcqlQuery } from 'dcql';
11
+ import { HasherSync } from '@sphereon/ssi-types';
12
+ export type DidAuthSiopOpAuthenticatorOptions = {
13
+ presentationSignCallback?: PresentationSignCallback;
14
+ customApprovals?: Record<string, (verifiedAuthorizationRequest: VerifiedAuthorizationRequest, sessionId: string) => Promise<void>>;
15
+ onContactIdentityCreated?: (args: OnContactIdentityCreatedArgs) => Promise<void>;
16
+ onIdentifierCreated?: (args: OnIdentifierCreatedArgs) => Promise<void>;
17
+ hasher?: HasherSync;
18
+ };
19
+ export type GetMachineArgs = {
20
+ url: string | URL;
21
+ idOpts?: ManagedIdentifierOptsOrResult;
22
+ stateNavigationListener?: (siopv2Machine: Siopv2MachineInterpreter, state: Siopv2MachineState, navigation?: any) => Promise<void>;
23
+ };
24
+ export type CreateConfigArgs = {
25
+ url: string;
26
+ };
27
+ export type CreateConfigResult = Omit<DidAuthConfig, 'stateId' | 'idOpts'>;
28
+ export type GetSiopRequestArgs = {
29
+ didAuthConfig?: Omit<DidAuthConfig, 'identifier'>;
30
+ url: string;
31
+ };
32
+ export type RetrieveContactArgs = Pick<Siopv2MachineContext, 'url' | 'authorizationRequestData'>;
33
+ export type AddIdentityArgs = Pick<Siopv2MachineContext, 'contact' | 'authorizationRequestData'>;
34
+ export type SendResponseArgs = {
35
+ didAuthConfig?: Omit<DidAuthConfig, 'identifier'>;
36
+ authorizationRequestData?: Siopv2AuthorizationRequestData;
37
+ selectedCredentials: Array<UniqueDigitalCredential>;
38
+ idOpts?: ManagedIdentifierOptsOrResult;
39
+ isFirstParty?: boolean;
40
+ };
41
+ export type GetSelectableCredentialsArgs = Pick<Siopv2MachineContext, 'authorizationRequestData'>;
42
+ export declare enum Siopv2HolderEvent {
43
+ CONTACT_IDENTITY_CREATED = "contact_identity_created",
44
+ IDENTIFIER_CREATED = "identifier_created"
45
+ }
46
+ export declare enum SupportedLanguage {
47
+ ENGLISH = "en",
48
+ DUTCH = "nl"
49
+ }
50
+ export type Siopv2AuthorizationResponseData = {
51
+ body?: string | Record<string, any>;
52
+ url?: string;
53
+ queryParams?: Record<string, any>;
54
+ };
55
+ export type Siopv2AuthorizationRequestData = {
56
+ correlationId: string;
57
+ registrationMetadataPayload: RPRegistrationMetadataPayload;
58
+ issuer?: string;
59
+ name?: string;
60
+ uri?: URL;
61
+ clientId?: string;
62
+ presentationDefinitions?: PresentationDefinitionWithLocation[];
63
+ dcqlQuery?: DcqlQuery;
64
+ };
65
+ export type SelectableCredentialsMap = Map<string, Array<SelectableCredential>>;
66
+ export type SelectableCredential = {
67
+ credential: UniqueDigitalCredential;
68
+ credentialBranding: Array<ICredentialLocaleBranding>;
69
+ issuerParty?: Party;
70
+ subjectParty?: Party;
71
+ };
72
+ export type OnContactIdentityCreatedArgs = {
73
+ contactId: string;
74
+ identity: Identity;
75
+ };
76
+ export type OnIdentifierCreatedArgs = {
77
+ identifier: IIdentifier;
78
+ };
79
+ export type RequiredContext = IAgentContext<IContactManager & IDidAuthSiopOpAuthenticator & IDIDManager & IResolver & IIdentifierResolution & ICredentialStore & IIssuanceBranding>;
80
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/siop-service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,6BAA6B,EAC7B,4BAA4B,EAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAA;AAClH,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC9F,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACxG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AAG,CAAC,EAAE,GAAG,CAAA;IACT,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uBAAuB,CAAC,EAAE,kCAAkC,EAAE,CAAA;IAC9D,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAA;AAE/E,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,uBAAuB,CAAA;IACnC,kBAAkB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAA;IACpD,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,WAAW,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,aAAa,CACzC,eAAe,GAAG,2BAA2B,GAAG,WAAW,GAAG,SAAS,GAAG,qBAAqB,GAAG,gBAAgB,GAAG,iBAAiB,CACvI,CAAA"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SupportedLanguage = exports.Siopv2HolderEvent = void 0;
4
+ var Siopv2HolderEvent;
5
+ (function (Siopv2HolderEvent) {
6
+ Siopv2HolderEvent["CONTACT_IDENTITY_CREATED"] = "contact_identity_created";
7
+ Siopv2HolderEvent["IDENTIFIER_CREATED"] = "identifier_created";
8
+ })(Siopv2HolderEvent || (exports.Siopv2HolderEvent = Siopv2HolderEvent = {}));
9
+ var SupportedLanguage;
10
+ (function (SupportedLanguage) {
11
+ SupportedLanguage["ENGLISH"] = "en";
12
+ SupportedLanguage["DUTCH"] = "nl";
13
+ })(SupportedLanguage || (exports.SupportedLanguage = SupportedLanguage = {}));
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/siop-service/index.ts"],"names":[],"mappings":";;;AAgDA,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,0EAAqD,CAAA;IACrD,8DAAyC,CAAA;AAC3C,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,mCAAc,CAAA;IACd,iCAAY,CAAA;AACd,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B"}
@@ -0,0 +1,23 @@
1
+ import { ICredential, OriginalVerifiableCredential } from '@sphereon/ssi-types';
2
+ import { VerifiableCredential } from '@veramo/core';
3
+ import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store';
4
+ /**
5
+ * Return the type(s) of a VC minus the VerifiableCredential type which should always be present
6
+ * @param credential The input credential
7
+ */
8
+ export declare const getCredentialTypeAsString: (credential: ICredential | VerifiableCredential) => string;
9
+ /**
10
+ * Returns a Unique Verifiable Credential (with hash) as stored in Veramo, based upon matching the id of the input VC or the proof value of the input VC
11
+ * @param uniqueVCs The Unique VCs to search in
12
+ * @param searchVC The VC to search for in the unique VCs array
13
+ */
14
+ export declare const getMatchingUniqueDigitalCredential: (uniqueVCs: UniqueDigitalCredential[], searchVC: OriginalVerifiableCredential) => UniqueDigitalCredential | undefined;
15
+ type InputCredential = UniqueDigitalCredential | VerifiableCredential | ICredential | OriginalVerifiableCredential;
16
+ /**
17
+ * Get an original verifiable credential. Maps to wrapped Verifiable Credential first, to get an original JWT as Veramo stores these with a special proof value
18
+ * @param credential The input VC
19
+ */
20
+ export declare const getOriginalVerifiableCredential: (credential: InputCredential) => OriginalVerifiableCredential;
21
+ export declare const isUniqueDigitalCredential: (credential: InputCredential) => credential is UniqueDigitalCredential;
22
+ export {};
23
+ //# sourceMappingURL=CredentialUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialUtils.d.ts","sourceRoot":"","sources":["../../src/utils/CredentialUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,WAAW,EAAyB,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AACpI,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAE5E;;;GAGG;AACH,eAAO,MAAM,yBAAyB,eAAgB,WAAW,GAAG,oBAAoB,KAAG,MAO1F,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,cAClC,uBAAuB,EAAE,YAC1B,4BAA4B,KACrC,uBAAuB,GAAG,SAe5B,CAAA;AAED,KAAK,eAAe,GAAG,uBAAuB,GAAG,oBAAoB,GAAG,WAAW,GAAG,4BAA4B,CAAA;AAElH;;;GAGG;AAEH,eAAO,MAAM,+BAA+B,eAAgB,eAAe,KAAG,4BAS7E,CAAA;AAUD,eAAO,MAAM,yBAAyB,eAAgB,eAAe,KAAG,UAAU,IAAI,uBAErF,CAAA"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isUniqueDigitalCredential = exports.getOriginalVerifiableCredential = exports.getMatchingUniqueDigitalCredential = exports.getCredentialTypeAsString = void 0;
4
+ const ssi_types_1 = require("@sphereon/ssi-types");
5
+ /**
6
+ * Return the type(s) of a VC minus the VerifiableCredential type which should always be present
7
+ * @param credential The input credential
8
+ */
9
+ const getCredentialTypeAsString = (credential) => {
10
+ if (!credential.type) {
11
+ return 'Verifiable Credential';
12
+ }
13
+ else if (typeof credential.type === 'string') {
14
+ return credential.type;
15
+ }
16
+ return credential.type.filter((type) => type !== 'VerifiableCredential').join(', ');
17
+ };
18
+ exports.getCredentialTypeAsString = getCredentialTypeAsString;
19
+ /**
20
+ * Returns a Unique Verifiable Credential (with hash) as stored in Veramo, based upon matching the id of the input VC or the proof value of the input VC
21
+ * @param uniqueVCs The Unique VCs to search in
22
+ * @param searchVC The VC to search for in the unique VCs array
23
+ */
24
+ const getMatchingUniqueDigitalCredential = (uniqueVCs, searchVC) => {
25
+ // Since an ID is optional in a VC according to VCDM, and we really need the matches, we have a fallback match on something which is guaranteed to be unique for any VC (the proof(s))
26
+ return uniqueVCs.find((uniqueVC) => {
27
+ var _a, _b, _c, _d, _e, _f, _g, _h;
28
+ return (typeof searchVC !== 'string' &&
29
+ (uniqueVC.id === searchVC.id ||
30
+ uniqueVC.originalVerifiableCredential.proof === searchVC.proof)) ||
31
+ (typeof searchVC === 'string' && ((_b = (_a = uniqueVC.uniformVerifiableCredential) === null || _a === void 0 ? void 0 : _a.proof) === null || _b === void 0 ? void 0 : _b.jwt) === searchVC) ||
32
+ // We are ignoring the signature of the sd-jwt as PEX signs the vc again and it will not match anymore with the jwt in the proof of the stored jsonld vc
33
+ (typeof searchVC === 'string' &&
34
+ ssi_types_1.CredentialMapper.isSdJwtEncoded(searchVC) &&
35
+ ((_c = uniqueVC.uniformVerifiableCredential) === null || _c === void 0 ? void 0 : _c.proof) &&
36
+ 'jwt' in uniqueVC.uniformVerifiableCredential.proof &&
37
+ ((_f = (_e = (_d = uniqueVC.uniformVerifiableCredential.proof.jwt) === null || _d === void 0 ? void 0 : _d.split('.')) === null || _e === void 0 ? void 0 : _e.slice(0, 2)) === null || _f === void 0 ? void 0 : _f.join('.')) === ((_h = (_g = searchVC.split('.')) === null || _g === void 0 ? void 0 : _g.slice(0, 2)) === null || _h === void 0 ? void 0 : _h.join('.')));
38
+ });
39
+ };
40
+ exports.getMatchingUniqueDigitalCredential = getMatchingUniqueDigitalCredential;
41
+ /**
42
+ * Get an original verifiable credential. Maps to wrapped Verifiable Credential first, to get an original JWT as Veramo stores these with a special proof value
43
+ * @param credential The input VC
44
+ */
45
+ const getOriginalVerifiableCredential = (credential) => {
46
+ if ((0, exports.isUniqueDigitalCredential)(credential)) {
47
+ if (!credential.originalVerifiableCredential) {
48
+ throw new Error('originalVerifiableCredential is not defined in UniqueDigitalCredential');
49
+ }
50
+ return getCredentialFromProofOrWrapped(credential.originalVerifiableCredential);
51
+ }
52
+ return getCredentialFromProofOrWrapped(credential);
53
+ };
54
+ exports.getOriginalVerifiableCredential = getOriginalVerifiableCredential;
55
+ const getCredentialFromProofOrWrapped = (cred, hasher) => {
56
+ if (typeof cred === 'object' && 'proof' in cred && 'jwt' in cred.proof && ssi_types_1.CredentialMapper.isSdJwtEncoded(cred.proof.jwt)) {
57
+ return cred.proof.jwt;
58
+ }
59
+ return ssi_types_1.CredentialMapper.toWrappedVerifiableCredential(cred, { hasher }).original;
60
+ };
61
+ const isUniqueDigitalCredential = (credential) => {
62
+ return credential.digitalCredential !== undefined;
63
+ };
64
+ exports.isUniqueDigitalCredential = isUniqueDigitalCredential;
65
+ //# sourceMappingURL=CredentialUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CredentialUtils.js","sourceRoot":"","sources":["../../src/utils/CredentialUtils.ts"],"names":[],"mappings":";;;AAAA,mDAAoI;AAIpI;;;GAGG;AACI,MAAM,yBAAyB,GAAG,CAAC,UAA8C,EAAU,EAAE;IAClG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,uBAAuB,CAAA;IAChC,CAAC;SAAM,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,UAAU,CAAC,IAAI,CAAA;IACxB,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAY,EAAW,EAAE,CAAC,IAAI,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACtG,CAAC,CAAA;AAPY,QAAA,yBAAyB,6BAOrC;AAED;;;;GAIG;AACI,MAAM,kCAAkC,GAAG,CAChD,SAAoC,EACpC,QAAsC,EACD,EAAE;IACvC,sLAAsL;IACtL,OAAO,SAAS,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AU,CAAC,4BAA4B,CAAC,CAAA;IACjF,CAAC;IAED,OAAO,+BAA+B,CAAC,UAAU,CAAC,CAAA;AACpD,CAAC,CAAA;AATY,QAAA,+BAA+B,mCAS3C;AAED,MAAM,+BAA+B,GAAG,CAAC,IAAS,EAAE,MAAmB,EAAgC,EAAE;IACvG,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,4BAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1H,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA;IACvB,CAAC;IAED,OAAO,4BAAgB,CAAC,6BAA6B,CAAC,IAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAA;AAClH,CAAC,CAAA;AAEM,MAAM,yBAAyB,GAAG,CAAC,UAA2B,EAAyC,EAAE;IAC9G,OAAQ,UAAsC,CAAC,iBAAiB,KAAK,SAAS,CAAA;AAChF,CAAC,CAAA;AAFY,QAAA,yBAAyB,6BAErC"}
@@ -0,0 +1,5 @@
1
+ import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store';
2
+ import { DcqlCredential } from 'dcql';
3
+ import { HasherSync, OriginalVerifiableCredential } from '@sphereon/ssi-types';
4
+ export declare function convertToDcqlCredentials(credential: UniqueDigitalCredential | OriginalVerifiableCredential, hasher?: HasherSync): DcqlCredential;
5
+ //# sourceMappingURL=dcql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dcql.d.ts","sourceRoot":"","sources":["../../src/utils/dcql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAA8C,MAAM,MAAM,CAAA;AACjF,OAAO,EAAoB,UAAU,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAGhG,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,uBAAuB,GAAG,4BAA4B,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,CA8BhJ"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToDcqlCredentials = convertToDcqlCredentials;
4
+ const ssi_types_1 = require("@sphereon/ssi-types");
5
+ const CredentialUtils_1 = require("./CredentialUtils");
6
+ function convertToDcqlCredentials(credential, hasher) {
7
+ let payload;
8
+ if ((0, CredentialUtils_1.isUniqueDigitalCredential)(credential)) {
9
+ if (!credential.originalVerifiableCredential) {
10
+ throw new Error('originalVerifiableCredential is not defined in UniqueDigitalCredential');
11
+ }
12
+ payload = ssi_types_1.CredentialMapper.decodeVerifiableCredential(credential.originalVerifiableCredential, hasher);
13
+ }
14
+ else {
15
+ payload = ssi_types_1.CredentialMapper.decodeVerifiableCredential(credential, hasher);
16
+ }
17
+ if (!payload) {
18
+ throw new Error('No payload found');
19
+ }
20
+ if ('decodedPayload' in payload && payload.decodedPayload) {
21
+ payload = payload.decodedPayload;
22
+ }
23
+ if ('vct' in payload) {
24
+ return { vct: payload.vct, claims: payload, credential_format: 'vc+sd-jwt' }; // TODO dc+sd-jwt support?
25
+ }
26
+ else if ('docType' in payload && 'namespaces' in payload) {
27
+ // mdoc
28
+ return { docType: payload.docType, namespaces: payload.namespaces, claims: payload };
29
+ }
30
+ else {
31
+ return {
32
+ claims: payload,
33
+ credential_format: 'jwt_vc_json', // TODO jwt_vc_json-ld support
34
+ };
35
+ }
36
+ }
37
+ //# sourceMappingURL=dcql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dcql.js","sourceRoot":"","sources":["../../src/utils/dcql.ts"],"names":[],"mappings":";;AAKA,4DA8BC;AAjCD,mDAAgG;AAChG,uDAA6D;AAE7D,SAAgB,wBAAwB,CAAC,UAAkE,EAAE,MAAmB;IAC9H,IAAI,OAAO,CAAA;IACX,IAAI,IAAA,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"version": "0.33.1-next.3+fd1a6fba",
4
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
- },
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
20
7
  "veramo": {
21
8
  "pluginInterfaces": {
22
9
  "IDidAuthSiopOpAuthenticator": "./src/types/IDidAuthSiopOpAuthenticator.ts"
23
10
  }
24
11
  },
25
12
  "scripts": {
26
- "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json"
13
+ "build": "tsc --build",
14
+ "build:clean": "tsc --build --clean && tsc --build"
27
15
  },
28
16
  "dependencies": {
29
- "@sphereon/did-auth-siop": "0.17.1-feature.esm.cjs.39",
30
- "@sphereon/did-auth-siop-adapter": "0.17.1-feature.esm.cjs.39",
31
- "@sphereon/oid4vc-common": "0.17.1-feature.esm.cjs.39",
17
+ "@sphereon/did-auth-siop": "0.17.0",
18
+ "@sphereon/did-auth-siop-adapter": "0.17.0",
19
+ "@sphereon/oid4vc-common": "0.17.0",
32
20
  "@sphereon/pex": "5.0.0-unstable.28",
33
21
  "@sphereon/pex-models": "^2.3.2",
34
- "@sphereon/ssi-sdk-ext.did-utils": "0.28.1-feature.esm.cjs.17",
35
- "@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.1-feature.esm.cjs.17",
36
- "@sphereon/ssi-sdk-ext.jwt-service": "0.28.1-feature.esm.cjs.17",
37
- "@sphereon/ssi-sdk.contact-manager": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
38
- "@sphereon/ssi-sdk.core": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
39
- "@sphereon/ssi-sdk.credential-store": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
40
- "@sphereon/ssi-sdk.credential-validation": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
41
- "@sphereon/ssi-sdk.data-store": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
42
- "@sphereon/ssi-sdk.issuance-branding": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
43
- "@sphereon/ssi-sdk.pd-manager": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
44
- "@sphereon/ssi-sdk.presentation-exchange": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
45
- "@sphereon/ssi-sdk.sd-jwt": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
46
- "@sphereon/ssi-sdk.siopv2-oid4vp-common": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
47
- "@sphereon/ssi-sdk.xstate-machine-persistence": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
48
- "@sphereon/ssi-types": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
22
+ "@sphereon/ssi-sdk-ext.did-utils": "0.28.0",
23
+ "@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.0",
24
+ "@sphereon/ssi-sdk-ext.jwt-service": "0.28.0",
25
+ "@sphereon/ssi-sdk.contact-manager": "0.33.1-next.3+fd1a6fba",
26
+ "@sphereon/ssi-sdk.core": "0.33.1-next.3+fd1a6fba",
27
+ "@sphereon/ssi-sdk.credential-store": "0.33.1-next.3+fd1a6fba",
28
+ "@sphereon/ssi-sdk.credential-validation": "0.33.1-next.3+fd1a6fba",
29
+ "@sphereon/ssi-sdk.data-store": "0.33.1-next.3+fd1a6fba",
30
+ "@sphereon/ssi-sdk.issuance-branding": "0.33.1-next.3+fd1a6fba",
31
+ "@sphereon/ssi-sdk.pd-manager": "0.33.1-next.3+fd1a6fba",
32
+ "@sphereon/ssi-sdk.presentation-exchange": "0.33.1-next.3+fd1a6fba",
33
+ "@sphereon/ssi-sdk.sd-jwt": "0.33.1-next.3+fd1a6fba",
34
+ "@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.33.1-next.3+fd1a6fba",
35
+ "@sphereon/ssi-sdk.xstate-machine-persistence": "0.33.1-next.3+fd1a6fba",
36
+ "@sphereon/ssi-types": "0.33.1-next.3+fd1a6fba",
49
37
  "@sphereon/wellknown-dids-client": "^0.1.3",
50
38
  "@veramo/core": "4.2.0",
51
39
  "@veramo/credential-w3c": "4.2.0",
@@ -59,8 +47,8 @@
59
47
  },
60
48
  "devDependencies": {
61
49
  "@sphereon/did-uni-client": "^0.6.3",
62
- "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.28.1-feature.esm.cjs.17",
63
- "@sphereon/ssi-sdk.agent-config": "^0.33.1-feature.vcdm2.tsup.32+203a9d60",
50
+ "@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.28.0",
51
+ "@sphereon/ssi-sdk.agent-config": "0.33.1-next.3+fd1a6fba",
64
52
  "@types/i18n-js": "^3.8.9",
65
53
  "@types/lodash.memoize": "^4.1.9",
66
54
  "@types/sha.js": "^2.4.4",
@@ -73,11 +61,11 @@
73
61
  "@veramo/utils": "4.2.0",
74
62
  "did-resolver": "^4.1.0",
75
63
  "nock": "^13.5.4",
76
- "typeorm": "0.3.20"
64
+ "typeorm": "^0.3.21"
77
65
  },
78
66
  "files": [
79
- "dist",
80
- "src",
67
+ "dist/**/*",
68
+ "src/**/*",
81
69
  "src/localization/translations/*",
82
70
  "README.md",
83
71
  "plugin.schema.json",
@@ -102,5 +90,6 @@
102
90
  "OpenID Connect",
103
91
  "Authenticator"
104
92
  ],
105
- "gitHead": "203a9d6076275e58d7959b7d212b8b938ad6a49e"
93
+ "nx": {},
94
+ "gitHead": "fd1a6fba306a83a73ff7c531db87fa207dbf436d"
106
95
  }
@@ -13,28 +13,32 @@ import {
13
13
  import { HasherSync, Loggers, SdJwtDecodedVerifiableCredential } from '@sphereon/ssi-types'
14
14
  import { IAgentPlugin } from '@veramo/core'
15
15
  import { v4 as uuidv4 } from 'uuid'
16
-
16
+ import {
17
+ DidAuthSiopOpAuthenticatorOptions,
18
+ GetSelectableCredentialsArgs,
19
+ IOpSessionArgs,
20
+ Json,
21
+ LOGGER_NAMESPACE,
22
+ RequiredContext,
23
+ schema,
24
+ SelectableCredentialsMap,
25
+ Siopv2AuthorizationResponseData,
26
+ VerifiableCredentialsWithDefinition,
27
+ } from '../index'
28
+ import { Siopv2Machine } from '../machine/Siopv2Machine'
29
+ import { getSelectableCredentials, siopSendAuthorizationResponse, translateCorrelationIdToName } from '../services/Siopv2MachineService'
17
30
  import { OpSession } from '../session'
18
31
  import { PEX, Status } from '@sphereon/pex'
19
32
  import { computeEntryHash } from '@veramo/utils'
20
33
  import { UniqueDigitalCredential } from '@sphereon/ssi-sdk.credential-store'
21
34
  import { EventEmitter } from 'events'
22
35
  import {
23
- DidAuthSiopOpAuthenticatorOptions,
24
- GetSelectableCredentialsArgs,
25
36
  IDidAuthSiopOpAuthenticator,
26
37
  IGetSiopSessionArgs,
27
- IOpSessionArgs,
28
38
  IRegisterCustomApprovalForSiopArgs,
29
39
  IRemoveCustomApprovalForSiopArgs,
30
40
  IRemoveSiopSessionArgs,
31
41
  IRequiredContext,
32
- Json,
33
- LOGGER_NAMESPACE,
34
- RequiredContext,
35
- SelectableCredentialsMap,
36
- Siopv2AuthorizationResponseData,
37
- VerifiableCredentialsWithDefinition,
38
42
  } from '../types'
39
43
 
40
44
  import {
@@ -52,9 +56,6 @@ import {
52
56
  Siopv2MachineInstanceOpts,
53
57
  } from '../types'
54
58
  import { DcqlCredential, DcqlPresentation, DcqlQuery, DcqlSdJwtVcCredential } from 'dcql'
55
- import { Siopv2Machine } from '../machine/Siopv2Machine'
56
- import { getSelectableCredentials, siopSendAuthorizationResponse, translateCorrelationIdToName } from '../services/Siopv2MachineService'
57
- import { schema } from '..'
58
59
 
59
60
  const logger = Loggers.DEFAULT.options(LOGGER_NAMESPACE, {}).get(LOGGER_NAMESPACE)
60
61