@credebl/ssi-mobile-didcomm 2.0.3-alpha-20260211142205

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 (86) hide show
  1. package/build/DidCommSdk.d.mts +128 -0
  2. package/build/DidCommSdk.d.mts.map +1 -0
  3. package/build/DidCommSdk.mjs +134 -0
  4. package/build/DidCommSdk.mjs.map +1 -0
  5. package/build/basicMessages/BasicMessagesApi.d.mts +18 -0
  6. package/build/basicMessages/BasicMessagesApi.d.mts.map +1 -0
  7. package/build/basicMessages/BasicMessagesApi.mjs +19 -0
  8. package/build/basicMessages/BasicMessagesApi.mjs.map +1 -0
  9. package/build/basicMessages/index.d.mts +1 -0
  10. package/build/connections/ConnectionsApi.d.mts +100 -0
  11. package/build/connections/ConnectionsApi.d.mts.map +1 -0
  12. package/build/connections/ConnectionsApi.mjs +125 -0
  13. package/build/connections/ConnectionsApi.mjs.map +1 -0
  14. package/build/connections/index.d.mts +1 -0
  15. package/build/core/src/MobileSDK.mjs +7 -0
  16. package/build/core/src/contexts/MobileSDKContext.mjs +8 -0
  17. package/build/core/src/contexts/MobileSDKContext.mjs.map +1 -0
  18. package/build/core/src/contexts/index.mjs +1 -0
  19. package/build/core/src/hooks/index.mjs +1 -0
  20. package/build/core/src/hooks/useSDKInitializer.mjs +3 -0
  21. package/build/core/src/index.mjs +6 -0
  22. package/build/core/src/providers/AgentProvider.mjs +8 -0
  23. package/build/core/src/providers/AgentProvider.mjs.map +1 -0
  24. package/build/core/src/providers/CredentialsProvider.mjs +4 -0
  25. package/build/core/src/providers/MdocProvider.mjs +10 -0
  26. package/build/core/src/providers/MdocProvider.mjs.map +1 -0
  27. package/build/core/src/providers/SdJwtVcsProvider.mjs +10 -0
  28. package/build/core/src/providers/SdJwtVcsProvider.mjs.map +1 -0
  29. package/build/core/src/providers/W3cCredentialsProvider.mjs +10 -0
  30. package/build/core/src/providers/W3cCredentialsProvider.mjs.map +1 -0
  31. package/build/core/src/providers/index.mjs +6 -0
  32. package/build/core/src/providers/recordUtils.mjs +50 -0
  33. package/build/core/src/providers/recordUtils.mjs.map +1 -0
  34. package/build/credentials/CredentialsApi.d.mts +71 -0
  35. package/build/credentials/CredentialsApi.d.mts.map +1 -0
  36. package/build/credentials/CredentialsApi.mjs +83 -0
  37. package/build/credentials/CredentialsApi.mjs.map +1 -0
  38. package/build/credentials/index.d.mts +1 -0
  39. package/build/index.d.mts +16 -0
  40. package/build/index.mjs +17 -0
  41. package/build/mediationRecipient/MediationRecipientApi.d.mts +25 -0
  42. package/build/mediationRecipient/MediationRecipientApi.d.mts.map +1 -0
  43. package/build/mediationRecipient/MediationRecipientApi.mjs +43 -0
  44. package/build/mediationRecipient/MediationRecipientApi.mjs.map +1 -0
  45. package/build/mediationRecipient/index.d.mts +1 -0
  46. package/build/proofs/ProofsApi.d.mts +94 -0
  47. package/build/proofs/ProofsApi.d.mts.map +1 -0
  48. package/build/proofs/ProofsApi.mjs +109 -0
  49. package/build/proofs/ProofsApi.mjs.map +1 -0
  50. package/build/proofs/index.d.mts +1 -0
  51. package/build/providers/BasicMessageProvider.d.mts +15 -0
  52. package/build/providers/BasicMessageProvider.d.mts.map +1 -0
  53. package/build/providers/BasicMessageProvider.mjs +51 -0
  54. package/build/providers/BasicMessageProvider.mjs.map +1 -0
  55. package/build/providers/ConnectionProvider.d.mts +25 -0
  56. package/build/providers/ConnectionProvider.d.mts.map +1 -0
  57. package/build/providers/ConnectionProvider.mjs +74 -0
  58. package/build/providers/ConnectionProvider.mjs.map +1 -0
  59. package/build/providers/CredentialFormatDataProvider.d.mts +17 -0
  60. package/build/providers/CredentialFormatDataProvider.d.mts.map +1 -0
  61. package/build/providers/CredentialFormatDataProvider.mjs +88 -0
  62. package/build/providers/CredentialFormatDataProvider.mjs.map +1 -0
  63. package/build/providers/CredentialProvider.d.mts +18 -0
  64. package/build/providers/CredentialProvider.d.mts.map +1 -0
  65. package/build/providers/CredentialProvider.mjs +65 -0
  66. package/build/providers/CredentialProvider.mjs.map +1 -0
  67. package/build/providers/ProofFormatDataProvider.d.mts +19 -0
  68. package/build/providers/ProofFormatDataProvider.d.mts.map +1 -0
  69. package/build/providers/ProofFormatDataProvider.mjs +94 -0
  70. package/build/providers/ProofFormatDataProvider.mjs.map +1 -0
  71. package/build/providers/ProofProvider.d.mts +18 -0
  72. package/build/providers/ProofProvider.d.mts.map +1 -0
  73. package/build/providers/ProofProvider.mjs +65 -0
  74. package/build/providers/ProofProvider.mjs.map +1 -0
  75. package/build/providers/QuestionAnswerProvider.d.mts +18 -0
  76. package/build/providers/QuestionAnswerProvider.d.mts.map +1 -0
  77. package/build/providers/QuestionAnswerProvider.mjs +59 -0
  78. package/build/providers/QuestionAnswerProvider.mjs.map +1 -0
  79. package/build/providers/index.d.mts +7 -0
  80. package/build/providers/index.mjs +7 -0
  81. package/build/questionAnswer/QuestionAnswerApi.d.mts +43 -0
  82. package/build/questionAnswer/QuestionAnswerApi.d.mts.map +1 -0
  83. package/build/questionAnswer/QuestionAnswerApi.mjs +44 -0
  84. package/build/questionAnswer/QuestionAnswerApi.mjs.map +1 -0
  85. package/build/questionAnswer/index.d.mts +1 -0
  86. package/package.json +50 -0
@@ -0,0 +1,128 @@
1
+ import { BasicMessagesApi } from "./basicMessages/BasicMessagesApi.mjs";
2
+ import "./basicMessages/index.mjs";
3
+ import { ConnectionsApi } from "./connections/ConnectionsApi.mjs";
4
+ import "./connections/index.mjs";
5
+ import { CredentialsApi } from "./credentials/CredentialsApi.mjs";
6
+ import "./credentials/index.mjs";
7
+ import { MediationRecipientApi } from "./mediationRecipient/MediationRecipientApi.mjs";
8
+ import "./mediationRecipient/index.mjs";
9
+ import { ProofsApi } from "./proofs/ProofsApi.mjs";
10
+ import "./proofs/index.mjs";
11
+ import { QuestionAnswerApi as QuestionAnswerApi$1 } from "./questionAnswer/QuestionAnswerApi.mjs";
12
+ import "./questionAnswer/index.mjs";
13
+ import { AnonCredsDidCommCredentialFormatService, AnonCredsDidCommProofFormatService, AnonCredsModule, AnonCredsRegistry, DataIntegrityDidCommCredentialFormatService, LegacyIndyDidCommCredentialFormatService, LegacyIndyDidCommProofFormatService } from "@credo-ts/anoncreds";
14
+ import { DidCommAutoAcceptCredential, DidCommAutoAcceptProof, DidCommConnectionsModuleConfigOptions, DidCommCredentialV2Protocol, DidCommDifPresentationExchangeProofFormatService, DidCommHttpOutboundTransport, DidCommJsonLdCredentialFormatService, DidCommMediatorPickupStrategy, DidCommModule, DidCommModuleConfigOptions, DidCommProofV2Protocol, DidCommWsOutboundTransport } from "@credo-ts/didcomm";
15
+ import { IndyVdrModule, IndyVdrPoolConfig } from "@credo-ts/indy-vdr";
16
+ import { QuestionAnswerModule } from "@credo-ts/question-answer";
17
+ import * as _credo_ts_core0 from "@credo-ts/core";
18
+ import { Agent } from "@credo-ts/core";
19
+ import { PropsWithChildren } from "react";
20
+ import { MobileSDKModule } from "@credebl/ssi-mobile-core";
21
+
22
+ //#region src/DidCommSdk.d.ts
23
+ interface DidCommConfiguration extends Pick<DidCommConnectionsModuleConfigOptions, 'peerNumAlgoForDidExchangeRequests' | 'peerNumAlgoForDidRotation'>, Pick<DidCommModuleConfigOptions, 'processDidCommMessagesConcurrently'> {
24
+ /**
25
+ * Strategy to use for picking up messages from the mediator. If no strategy is provided, the agent will use the discover
26
+ * features protocol to determine the best strategy.
27
+ *
28
+ *
29
+ * - `DidCommMediatorPickupStrategy.PickUpV1` - explicitly pick up messages from the mediator in periodic loops according to [RFC 0212 Pickup Protocol](https://github.com/hyperledger/aries-rfcs/blob/main/features/0212-pickup/README.md)
30
+ * - `DidCommMediatorPickupStrategy.PickUpV2` - pick up messages from the mediator in periodic loops according to [RFC 0685 Pickup V2 Protocol](https://github.com/hyperledger/aries-rfcs/tree/main/features/0685-pickup-v2/README.md).
31
+ * - `DidCommMediatorPickupStrategy.PickUpV2LiveMode` - pick up messages from the mediator using Live Mode as specified in [RFC 0685 Pickup V2 Protocol](https://github.com/hyperledger/aries-rfcs/tree/main/features/0685-pickup-v2/README.md).
32
+ * - `DidCommMediatorPickupStrategy.Implicit` - Open a WebSocket with the mediator to implicitly receive messages. (currently used by Aries Cloud Agent Python)
33
+ * - `DidCommMediatorPickupStrategy.None` - Do not retrieve messages from the mediator automatically. You can launch manual pickup flows afterwards.
34
+ *
35
+ * @default undefined
36
+ */
37
+ mediatorPickupStrategy?: DidCommMediatorPickupStrategy;
38
+ anoncreds?: {
39
+ registries: AnonCredsRegistry[];
40
+ };
41
+ indyVdr?: {
42
+ networks: [IndyVdrPoolConfig, ...IndyVdrPoolConfig[]];
43
+ };
44
+ }
45
+ declare const getDidCommModules: (configuration: DidCommConfiguration) => {
46
+ indyVdr?: IndyVdrModule | undefined;
47
+ didcomm: DidCommModule<{
48
+ connections: {
49
+ autoAcceptConnections: true;
50
+ peerNumAlgoForDidExchangeRequests: _credo_ts_core0.PeerDidNumAlgo | undefined;
51
+ peerNumAlgoForDidRotation: _credo_ts_core0.PeerDidNumAlgo.MultipleInceptionKeyWithoutDoc | _credo_ts_core0.PeerDidNumAlgo.ShortFormAndLongForm | undefined;
52
+ };
53
+ credentials: {
54
+ autoAcceptCredentials: DidCommAutoAcceptCredential.ContentApproved;
55
+ credentialProtocols: DidCommCredentialV2Protocol<(LegacyIndyDidCommCredentialFormatService | AnonCredsDidCommCredentialFormatService | DataIntegrityDidCommCredentialFormatService | DidCommJsonLdCredentialFormatService)[]>[];
56
+ };
57
+ proofs: {
58
+ autoAcceptProofs: DidCommAutoAcceptProof.ContentApproved;
59
+ proofProtocols: DidCommProofV2Protocol<(LegacyIndyDidCommProofFormatService | AnonCredsDidCommProofFormatService | DidCommDifPresentationExchangeProofFormatService)[]>[];
60
+ };
61
+ mediationRecipient: {
62
+ mediatorPickupStrategy: DidCommMediatorPickupStrategy | undefined;
63
+ };
64
+ processDidCommMessagesConcurrently: boolean | undefined;
65
+ transports: {
66
+ outbound: (DidCommHttpOutboundTransport | DidCommWsOutboundTransport)[];
67
+ };
68
+ }>;
69
+ questionAnswer: QuestionAnswerModule;
70
+ anoncreds: AnonCredsModule;
71
+ };
72
+ type DidCommAgentModules = ReturnType<typeof getDidCommModules>;
73
+ type DidCommAgent = Agent<DidCommAgentModules>;
74
+ declare class DidCommSDK implements MobileSDKModule {
75
+ private _agent?;
76
+ private configuration;
77
+ private _connections?;
78
+ private _credentials?;
79
+ private _proofs?;
80
+ private _basicMessages?;
81
+ private _questionAnswer?;
82
+ private _mediatorRecipient?;
83
+ constructor(configuration: DidCommConfiguration);
84
+ initialize(agent: DidCommAgent): void;
85
+ get agent(): DidCommAgent;
86
+ getAgentModules(): {
87
+ indyVdr?: IndyVdrModule | undefined;
88
+ didcomm: DidCommModule<{
89
+ connections: {
90
+ autoAcceptConnections: true;
91
+ peerNumAlgoForDidExchangeRequests: _credo_ts_core0.PeerDidNumAlgo | undefined;
92
+ peerNumAlgoForDidRotation: _credo_ts_core0.PeerDidNumAlgo.MultipleInceptionKeyWithoutDoc | _credo_ts_core0.PeerDidNumAlgo.ShortFormAndLongForm | undefined;
93
+ };
94
+ credentials: {
95
+ autoAcceptCredentials: DidCommAutoAcceptCredential.ContentApproved;
96
+ credentialProtocols: DidCommCredentialV2Protocol<(LegacyIndyDidCommCredentialFormatService | AnonCredsDidCommCredentialFormatService | DataIntegrityDidCommCredentialFormatService | DidCommJsonLdCredentialFormatService)[]>[];
97
+ };
98
+ proofs: {
99
+ autoAcceptProofs: DidCommAutoAcceptProof.ContentApproved;
100
+ proofProtocols: DidCommProofV2Protocol<(LegacyIndyDidCommProofFormatService | AnonCredsDidCommProofFormatService | DidCommDifPresentationExchangeProofFormatService)[]>[];
101
+ };
102
+ mediationRecipient: {
103
+ mediatorPickupStrategy: DidCommMediatorPickupStrategy | undefined;
104
+ };
105
+ processDidCommMessagesConcurrently: boolean | undefined;
106
+ transports: {
107
+ outbound: (DidCommHttpOutboundTransport | DidCommWsOutboundTransport)[];
108
+ };
109
+ }>;
110
+ questionAnswer: QuestionAnswerModule;
111
+ anoncreds: AnonCredsModule;
112
+ };
113
+ static DidCommProvider({
114
+ agent,
115
+ children
116
+ }: PropsWithChildren<{
117
+ agent: Agent;
118
+ }>): any;
119
+ get connections(): ConnectionsApi;
120
+ get credentials(): CredentialsApi;
121
+ get proofs(): ProofsApi;
122
+ get basicMessages(): BasicMessagesApi;
123
+ get questionAnswer(): QuestionAnswerApi$1;
124
+ get mediatorRecipient(): MediationRecipientApi;
125
+ }
126
+ //#endregion
127
+ export { DidCommAgent, DidCommAgentModules, DidCommConfiguration, DidCommSDK, getDidCommModules };
128
+ //# sourceMappingURL=DidCommSdk.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DidCommSdk.d.mts","names":[],"sources":["../src/DidCommSdk.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;UA8CiB,oBAAA,SACP,IAAA,CACJ,qCAAA,sEAGF,IAAA,CAAK,0BAAA;;;;;;;;AALT;;;;;;EAmBE,sBAAA,GAAyB,6BAAA;EACzB,SAAA;IACE,UAAA,EAAY,iBAAA;EAAA;EAEd,OAAA;IACE,QAAA,GAAW,iBAAA,KAAsB,iBAAA;EAAA;AAAA;AAAA,cAIxB,iBAAA,GAAqB,aAAA,EAAe,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuDrC,mBAAA,GAAsB,UAAA,QAAkB,iBAAA;AAAA,KAExC,YAAA,GAAe,KAAA,CAAM,mBAAA;AAAA,cAEpB,UAAA,YAAsB,eAAA;EAAA,QACzB,MAAA;EAAA,QACA,aAAA;EAAA,QAEA,YAAA;EAAA,QACA,YAAA;EAAA,QACA,OAAA;EAAA,QACA,cAAA;EAAA,QACA,eAAA;EAAA,QACA,kBAAA;cAEW,aAAA,EAAe,oBAAA;EAI3B,UAAA,CAAW,KAAA,EAAO,YAAA;EAAA,IAUd,KAAA,CAAA,GAAS,YAAA;EAOb,eAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;SAIO,eAAA,CAAA;IAAkB,KAAA;IAAO;EAAA,GAAY,iBAAA;IAAoB,KAAA,EAAO,KAAA;EAAA;EAAA,IAkBnE,WAAA,CAAA,GAAe,cAAA;EAAA,IAOf,WAAA,CAAA,GAAe,cAAA;EAAA,IAOf,MAAA,CAAA,GAAU,SAAA;EAAA,IAOV,aAAA,CAAA,GAAiB,gBAAA;EAAA,IAOjB,cAAA,CAAA,GAAkB,mBAAA;EAAA,IAOlB,iBAAA,CAAA,GAAqB,qBAAA;AAAA"}
@@ -0,0 +1,134 @@
1
+ import { BasicMessagesApi } from "./basicMessages/BasicMessagesApi.mjs";
2
+ import { ConnectionsApi } from "./connections/ConnectionsApi.mjs";
3
+ import { CredentialsApi } from "./credentials/CredentialsApi.mjs";
4
+ import { MediationRecipientApi } from "./mediationRecipient/MediationRecipientApi.mjs";
5
+ import { ProofsApi } from "./proofs/ProofsApi.mjs";
6
+ import { BasicMessageProvider } from "./providers/BasicMessageProvider.mjs";
7
+ import { ConnectionProvider } from "./providers/ConnectionProvider.mjs";
8
+ import { CredentialFormatDataProvider } from "./providers/CredentialFormatDataProvider.mjs";
9
+ import { CredentialProvider } from "./providers/CredentialProvider.mjs";
10
+ import { ProofFormatDataProvider } from "./providers/ProofFormatDataProvider.mjs";
11
+ import { ProofProvider } from "./providers/ProofProvider.mjs";
12
+ import { QuestionAnswerProvider } from "./providers/QuestionAnswerProvider.mjs";
13
+ import "./providers/index.mjs";
14
+ import { QuestionAnswerApi as QuestionAnswerApi$1 } from "./questionAnswer/QuestionAnswerApi.mjs";
15
+ import { AnonCredsDidCommCredentialFormatService, AnonCredsDidCommProofFormatService, AnonCredsModule, DataIntegrityDidCommCredentialFormatService, LegacyIndyDidCommCredentialFormatService, LegacyIndyDidCommProofFormatService } from "@credo-ts/anoncreds";
16
+ import { DidCommAutoAcceptCredential, DidCommAutoAcceptProof, DidCommCredentialV2Protocol, DidCommDifPresentationExchangeProofFormatService, DidCommHttpOutboundTransport, DidCommJsonLdCredentialFormatService, DidCommModule, DidCommProofV2Protocol, DidCommWsOutboundTransport } from "@credo-ts/didcomm";
17
+ import { IndyVdrAnonCredsRegistry, IndyVdrModule } from "@credo-ts/indy-vdr";
18
+ import { QuestionAnswerModule } from "@credo-ts/question-answer";
19
+ import { anoncreds } from "@hyperledger/anoncreds-react-native";
20
+ import { indyVdr } from "@hyperledger/indy-vdr-react-native";
21
+ import { jsx } from "react/jsx-runtime";
22
+
23
+ //#region src/DidCommSdk.tsx
24
+ const getDidCommModules = (configuration) => ({
25
+ didcomm: new DidCommModule({
26
+ connections: {
27
+ autoAcceptConnections: true,
28
+ peerNumAlgoForDidExchangeRequests: configuration.peerNumAlgoForDidExchangeRequests,
29
+ peerNumAlgoForDidRotation: configuration.peerNumAlgoForDidRotation
30
+ },
31
+ credentials: {
32
+ autoAcceptCredentials: DidCommAutoAcceptCredential.ContentApproved,
33
+ credentialProtocols: [new DidCommCredentialV2Protocol({ credentialFormats: [
34
+ new LegacyIndyDidCommCredentialFormatService(),
35
+ new AnonCredsDidCommCredentialFormatService(),
36
+ new DataIntegrityDidCommCredentialFormatService(),
37
+ new DidCommJsonLdCredentialFormatService()
38
+ ] })]
39
+ },
40
+ proofs: {
41
+ autoAcceptProofs: DidCommAutoAcceptProof.ContentApproved,
42
+ proofProtocols: [new DidCommProofV2Protocol({ proofFormats: [
43
+ new LegacyIndyDidCommProofFormatService(),
44
+ new AnonCredsDidCommProofFormatService(),
45
+ new DidCommDifPresentationExchangeProofFormatService()
46
+ ] })]
47
+ },
48
+ mediationRecipient: { mediatorPickupStrategy: configuration.mediatorPickupStrategy },
49
+ processDidCommMessagesConcurrently: configuration.processDidCommMessagesConcurrently,
50
+ transports: { outbound: [new DidCommHttpOutboundTransport(), new DidCommWsOutboundTransport()] }
51
+ }),
52
+ questionAnswer: new QuestionAnswerModule(),
53
+ anoncreds: new AnonCredsModule({
54
+ registries: [new IndyVdrAnonCredsRegistry(), ...configuration.anoncreds?.registries ?? []],
55
+ anoncreds
56
+ }),
57
+ ...configuration.indyVdr && { indyVdr: new IndyVdrModule({
58
+ indyVdr,
59
+ networks: configuration.indyVdr.networks
60
+ }) }
61
+ });
62
+ var DidCommSDK = class {
63
+ constructor(configuration) {
64
+ this.configuration = configuration;
65
+ }
66
+ initialize(agent) {
67
+ this._agent = agent;
68
+ this._connections = new ConnectionsApi(agent);
69
+ this._credentials = new CredentialsApi(agent);
70
+ this._proofs = new ProofsApi(agent);
71
+ this._basicMessages = new BasicMessagesApi(agent);
72
+ this._questionAnswer = new QuestionAnswerApi$1(agent);
73
+ this._mediatorRecipient = new MediationRecipientApi(agent);
74
+ }
75
+ get agent() {
76
+ if (!this._agent) throw new Error("Agent not initialized. Call initialize() first.");
77
+ return this._agent;
78
+ }
79
+ getAgentModules() {
80
+ return getDidCommModules(this.configuration);
81
+ }
82
+ static DidCommProvider({ agent, children }) {
83
+ return /* @__PURE__ */ jsx(ConnectionProvider, {
84
+ agent,
85
+ children: /* @__PURE__ */ jsx(CredentialProvider, {
86
+ agent,
87
+ children: /* @__PURE__ */ jsx(ProofProvider, {
88
+ agent,
89
+ children: /* @__PURE__ */ jsx(CredentialFormatDataProvider, {
90
+ agent,
91
+ children: /* @__PURE__ */ jsx(ProofFormatDataProvider, {
92
+ agent,
93
+ children: /* @__PURE__ */ jsx(BasicMessageProvider, {
94
+ agent,
95
+ children: /* @__PURE__ */ jsx(QuestionAnswerProvider, {
96
+ agent,
97
+ children
98
+ })
99
+ })
100
+ })
101
+ })
102
+ })
103
+ })
104
+ });
105
+ }
106
+ get connections() {
107
+ if (!this._connections) throw new Error("Agent not initialized. Call initialize() first.");
108
+ return this._connections;
109
+ }
110
+ get credentials() {
111
+ if (!this._credentials) throw new Error("Agent not initialized. Call initialize() first.");
112
+ return this._credentials;
113
+ }
114
+ get proofs() {
115
+ if (!this._proofs) throw new Error("Agent not initialized. Call initialize() first.");
116
+ return this._proofs;
117
+ }
118
+ get basicMessages() {
119
+ if (!this._basicMessages) throw new Error("Agent not initialized. Call initialize() first.");
120
+ return this._basicMessages;
121
+ }
122
+ get questionAnswer() {
123
+ if (!this._questionAnswer) throw new Error("Agent not initialized. Call initialize() first.");
124
+ return this._questionAnswer;
125
+ }
126
+ get mediatorRecipient() {
127
+ if (!this._mediatorRecipient) throw new Error("Agent not initialized. Call initialize() first.");
128
+ return this._mediatorRecipient;
129
+ }
130
+ };
131
+
132
+ //#endregion
133
+ export { DidCommSDK, getDidCommModules };
134
+ //# sourceMappingURL=DidCommSdk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DidCommSdk.mjs","names":["QuestionAnswerApi"],"sources":["../src/DidCommSdk.tsx"],"sourcesContent":["import type { MobileSDKModule } from '@credebl/ssi-mobile-core'\nimport {\n AnonCredsDidCommCredentialFormatService,\n AnonCredsDidCommProofFormatService,\n AnonCredsModule,\n type AnonCredsRegistry,\n DataIntegrityDidCommCredentialFormatService,\n LegacyIndyDidCommCredentialFormatService,\n LegacyIndyDidCommProofFormatService,\n} from '@credo-ts/anoncreds'\nimport { Agent } from '@credo-ts/core'\nimport type { DidCommMediatorPickupStrategy } from '@credo-ts/didcomm'\nimport {\n DidCommAutoAcceptCredential,\n DidCommAutoAcceptProof,\n DidCommConnectionsModuleConfigOptions,\n DidCommCredentialV2Protocol,\n DidCommDifPresentationExchangeProofFormatService,\n DidCommHttpOutboundTransport,\n DidCommJsonLdCredentialFormatService,\n DidCommModule,\n DidCommModuleConfigOptions,\n DidCommProofV2Protocol,\n DidCommWsOutboundTransport,\n} from '@credo-ts/didcomm'\nimport { IndyVdrAnonCredsRegistry, IndyVdrModule, type IndyVdrPoolConfig } from '@credo-ts/indy-vdr'\nimport { QuestionAnswerModule } from '@credo-ts/question-answer'\nimport { anoncreds } from '@hyperledger/anoncreds-react-native'\nimport { indyVdr } from '@hyperledger/indy-vdr-react-native'\nimport { PropsWithChildren } from 'react'\nimport { BasicMessagesApi } from './basicMessages'\nimport { ConnectionsApi } from './connections'\nimport { CredentialsApi } from './credentials'\nimport { MediationRecipientApi } from './mediationRecipient'\nimport { ProofsApi } from './proofs'\nimport {\n BasicMessageProvider,\n ConnectionProvider,\n CredentialFormatDataProvider,\n CredentialProvider,\n ProofFormatDataProvider,\n ProofProvider,\n QuestionAnswerProvider,\n} from './providers'\nimport { QuestionAnswerApi } from './questionAnswer'\n\nexport interface DidCommConfiguration\n extends Pick<\n DidCommConnectionsModuleConfigOptions,\n 'peerNumAlgoForDidExchangeRequests' | 'peerNumAlgoForDidRotation'\n >,\n Pick<DidCommModuleConfigOptions, 'processDidCommMessagesConcurrently'> {\n /**\n * Strategy to use for picking up messages from the mediator. If no strategy is provided, the agent will use the discover\n * features protocol to determine the best strategy.\n *\n *\n * - `DidCommMediatorPickupStrategy.PickUpV1` - explicitly pick up messages from the mediator in periodic loops according to [RFC 0212 Pickup Protocol](https://github.com/hyperledger/aries-rfcs/blob/main/features/0212-pickup/README.md)\n * - `DidCommMediatorPickupStrategy.PickUpV2` - pick up messages from the mediator in periodic loops according to [RFC 0685 Pickup V2 Protocol](https://github.com/hyperledger/aries-rfcs/tree/main/features/0685-pickup-v2/README.md).\n * - `DidCommMediatorPickupStrategy.PickUpV2LiveMode` - pick up messages from the mediator using Live Mode as specified in [RFC 0685 Pickup V2 Protocol](https://github.com/hyperledger/aries-rfcs/tree/main/features/0685-pickup-v2/README.md).\n * - `DidCommMediatorPickupStrategy.Implicit` - Open a WebSocket with the mediator to implicitly receive messages. (currently used by Aries Cloud Agent Python)\n * - `DidCommMediatorPickupStrategy.None` - Do not retrieve messages from the mediator automatically. You can launch manual pickup flows afterwards.\n *\n * @default undefined\n */\n mediatorPickupStrategy?: DidCommMediatorPickupStrategy\n anoncreds?: {\n registries: AnonCredsRegistry[]\n }\n indyVdr?: {\n networks: [IndyVdrPoolConfig, ...IndyVdrPoolConfig[]]\n }\n}\n\nexport const getDidCommModules = (configuration: DidCommConfiguration) => ({\n didcomm: new DidCommModule({\n connections: {\n autoAcceptConnections: true,\n peerNumAlgoForDidExchangeRequests: configuration.peerNumAlgoForDidExchangeRequests,\n peerNumAlgoForDidRotation: configuration.peerNumAlgoForDidRotation,\n },\n credentials: {\n autoAcceptCredentials: DidCommAutoAcceptCredential.ContentApproved,\n credentialProtocols: [\n new DidCommCredentialV2Protocol({\n credentialFormats: [\n new LegacyIndyDidCommCredentialFormatService(),\n new AnonCredsDidCommCredentialFormatService(),\n new DataIntegrityDidCommCredentialFormatService(),\n new DidCommJsonLdCredentialFormatService(),\n ],\n }),\n ],\n },\n proofs: {\n autoAcceptProofs: DidCommAutoAcceptProof.ContentApproved,\n proofProtocols: [\n new DidCommProofV2Protocol({\n proofFormats: [\n new LegacyIndyDidCommProofFormatService(),\n new AnonCredsDidCommProofFormatService(),\n new DidCommDifPresentationExchangeProofFormatService(),\n ],\n }),\n ],\n },\n mediationRecipient: {\n mediatorPickupStrategy: configuration.mediatorPickupStrategy,\n },\n processDidCommMessagesConcurrently: configuration.processDidCommMessagesConcurrently,\n transports: {\n outbound: [new DidCommHttpOutboundTransport(), new DidCommWsOutboundTransport()],\n },\n }),\n questionAnswer: new QuestionAnswerModule(),\n\n anoncreds: new AnonCredsModule({\n registries: [new IndyVdrAnonCredsRegistry(), ...(configuration.anoncreds?.registries ?? [])],\n anoncreds,\n }),\n\n ...(configuration.indyVdr && {\n indyVdr: new IndyVdrModule({\n indyVdr,\n networks: configuration.indyVdr.networks,\n }),\n }),\n})\n\nexport type DidCommAgentModules = ReturnType<typeof getDidCommModules>\n\nexport type DidCommAgent = Agent<DidCommAgentModules>\n\nexport class DidCommSDK implements MobileSDKModule {\n private _agent?: DidCommAgent\n private configuration: DidCommConfiguration\n\n private _connections?: ConnectionsApi\n private _credentials?: CredentialsApi\n private _proofs?: ProofsApi\n private _basicMessages?: BasicMessagesApi\n private _questionAnswer?: QuestionAnswerApi\n private _mediatorRecipient?: MediationRecipientApi\n\n public constructor(configuration: DidCommConfiguration) {\n this.configuration = configuration\n }\n\n public initialize(agent: DidCommAgent): void {\n this._agent = agent\n this._connections = new ConnectionsApi(agent)\n this._credentials = new CredentialsApi(agent)\n this._proofs = new ProofsApi(agent)\n this._basicMessages = new BasicMessagesApi(agent)\n this._questionAnswer = new QuestionAnswerApi(agent)\n this._mediatorRecipient = new MediationRecipientApi(agent)\n }\n\n public get agent(): DidCommAgent {\n if (!this._agent) {\n throw new Error('Agent not initialized. Call initialize() first.')\n }\n return this._agent\n }\n\n public getAgentModules() {\n return getDidCommModules(this.configuration)\n }\n\n public static DidCommProvider({ agent, children }: PropsWithChildren<{ agent: Agent }>) {\n return (\n <ConnectionProvider agent={agent}>\n <CredentialProvider agent={agent}>\n <ProofProvider agent={agent}>\n <CredentialFormatDataProvider agent={agent}>\n <ProofFormatDataProvider agent={agent}>\n <BasicMessageProvider agent={agent}>\n <QuestionAnswerProvider agent={agent}>{children}</QuestionAnswerProvider>\n </BasicMessageProvider>\n </ProofFormatDataProvider>\n </CredentialFormatDataProvider>\n </ProofProvider>\n </CredentialProvider>\n </ConnectionProvider>\n )\n }\n\n public get connections(): ConnectionsApi {\n if (!this._connections) {\n throw new Error('Agent not initialized. Call initialize() first.')\n }\n return this._connections\n }\n\n public get credentials(): CredentialsApi {\n if (!this._credentials) {\n throw new Error('Agent not initialized. Call initialize() first.')\n }\n return this._credentials\n }\n\n public get proofs(): ProofsApi {\n if (!this._proofs) {\n throw new Error('Agent not initialized. Call initialize() first.')\n }\n return this._proofs\n }\n\n public get basicMessages(): BasicMessagesApi {\n if (!this._basicMessages) {\n throw new Error('Agent not initialized. Call initialize() first.')\n }\n return this._basicMessages\n }\n\n public get questionAnswer(): QuestionAnswerApi {\n if (!this._questionAnswer) {\n throw new Error('Agent not initialized. Call initialize() first.')\n }\n return this._questionAnswer\n }\n\n public get mediatorRecipient(): MediationRecipientApi {\n if (!this._mediatorRecipient) {\n throw new Error('Agent not initialized. Call initialize() first.')\n }\n return this._mediatorRecipient\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0EA,MAAa,qBAAqB,mBAAyC;CACzE,SAAS,IAAI,cAAc;EACzB,aAAa;GACX,uBAAuB;GACvB,mCAAmC,cAAc;GACjD,2BAA2B,cAAc;GAC1C;EACD,aAAa;GACX,uBAAuB,4BAA4B;GACnD,qBAAqB,CACnB,IAAI,4BAA4B,EAC9B,mBAAmB;IACjB,IAAI,0CAA0C;IAC9C,IAAI,yCAAyC;IAC7C,IAAI,6CAA6C;IACjD,IAAI,sCAAsC;IAC3C,EACF,CAAC,CACH;GACF;EACD,QAAQ;GACN,kBAAkB,uBAAuB;GACzC,gBAAgB,CACd,IAAI,uBAAuB,EACzB,cAAc;IACZ,IAAI,qCAAqC;IACzC,IAAI,oCAAoC;IACxC,IAAI,kDAAkD;IACvD,EACF,CAAC,CACH;GACF;EACD,oBAAoB,EAClB,wBAAwB,cAAc,wBACvC;EACD,oCAAoC,cAAc;EAClD,YAAY,EACV,UAAU,CAAC,IAAI,8BAA8B,EAAE,IAAI,4BAA4B,CAAC,EACjF;EACF,CAAC;CACF,gBAAgB,IAAI,sBAAsB;CAE1C,WAAW,IAAI,gBAAgB;EAC7B,YAAY,CAAC,IAAI,0BAA0B,EAAE,GAAI,cAAc,WAAW,cAAc,EAAE,CAAE;EAC5F;EACD,CAAC;CAEF,GAAI,cAAc,WAAW,EAC3B,SAAS,IAAI,cAAc;EACzB;EACA,UAAU,cAAc,QAAQ;EACjC,CAAC,EACH;CACF;AAMD,IAAa,aAAb,MAAmD;CAWjD,AAAO,YAAY,eAAqC;AACtD,OAAK,gBAAgB;;CAGvB,AAAO,WAAW,OAA2B;AAC3C,OAAK,SAAS;AACd,OAAK,eAAe,IAAI,eAAe,MAAM;AAC7C,OAAK,eAAe,IAAI,eAAe,MAAM;AAC7C,OAAK,UAAU,IAAI,UAAU,MAAM;AACnC,OAAK,iBAAiB,IAAI,iBAAiB,MAAM;AACjD,OAAK,kBAAkB,IAAIA,oBAAkB,MAAM;AACnD,OAAK,qBAAqB,IAAI,sBAAsB,MAAM;;CAG5D,IAAW,QAAsB;AAC/B,MAAI,CAAC,KAAK,OACR,OAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAO,KAAK;;CAGd,AAAO,kBAAkB;AACvB,SAAO,kBAAkB,KAAK,cAAc;;CAG9C,OAAc,gBAAgB,EAAE,OAAO,YAAiD;AACtF,SACE,oBAAC;GAA0B;aACzB,oBAAC;IAA0B;cACzB,oBAAC;KAAqB;eACpB,oBAAC;MAAoC;gBACnC,oBAAC;OAA+B;iBAC9B,oBAAC;QAA4B;kBAC3B,oBAAC;SAA8B;SAAQ;UAAkC;SACpD;QACC;OACG;MACjB;KACG;IACF;;CAIzB,IAAW,cAA8B;AACvC,MAAI,CAAC,KAAK,aACR,OAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAO,KAAK;;CAGd,IAAW,cAA8B;AACvC,MAAI,CAAC,KAAK,aACR,OAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAO,KAAK;;CAGd,IAAW,SAAoB;AAC7B,MAAI,CAAC,KAAK,QACR,OAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAO,KAAK;;CAGd,IAAW,gBAAkC;AAC3C,MAAI,CAAC,KAAK,eACR,OAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAO,KAAK;;CAGd,IAAW,iBAAoC;AAC7C,MAAI,CAAC,KAAK,gBACR,OAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAO,KAAK;;CAGd,IAAW,oBAA2C;AACpD,MAAI,CAAC,KAAK,mBACR,OAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAO,KAAK"}
@@ -0,0 +1,18 @@
1
+ import { DidCommAgent } from "../DidCommSdk.mjs";
2
+ import * as _credo_ts_didcomm0 from "@credo-ts/didcomm";
3
+
4
+ //#region src/basicMessages/BasicMessagesApi.d.ts
5
+ declare class BasicMessagesApi {
6
+ private agent;
7
+ constructor(agent: DidCommAgent);
8
+ /**
9
+ * Sends a basic message to the connection with the given connection id.
10
+ *
11
+ * @param connectionId The connection id.
12
+ * @param message The message to send.
13
+ */
14
+ sendBasicMessage(connectionId: string, message: string): Promise<_credo_ts_didcomm0.DidCommBasicMessageRecord>;
15
+ }
16
+ //#endregion
17
+ export { BasicMessagesApi };
18
+ //# sourceMappingURL=BasicMessagesApi.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasicMessagesApi.d.mts","names":[],"sources":["../../src/basicMessages/BasicMessagesApi.ts"],"mappings":";;;;cAEa,gBAAA;EAAA,QACH,KAAA;cAEW,KAAA,EAAO,YAAA;EAHf;;;;;;EAaE,gBAAA,CAAiB,YAAA,UAAsB,OAAA,WAAe,OAAA,CAV7B,kBAAA,CAU6B,yBAAA;AAAA"}
@@ -0,0 +1,19 @@
1
+ //#region src/basicMessages/BasicMessagesApi.ts
2
+ var BasicMessagesApi = class {
3
+ constructor(agent) {
4
+ this.agent = agent;
5
+ }
6
+ /**
7
+ * Sends a basic message to the connection with the given connection id.
8
+ *
9
+ * @param connectionId The connection id.
10
+ * @param message The message to send.
11
+ */
12
+ async sendBasicMessage(connectionId, message) {
13
+ return this.agent.didcomm.basicMessages.sendMessage(connectionId, message);
14
+ }
15
+ };
16
+
17
+ //#endregion
18
+ export { BasicMessagesApi };
19
+ //# sourceMappingURL=BasicMessagesApi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasicMessagesApi.mjs","names":[],"sources":["../../src/basicMessages/BasicMessagesApi.ts"],"sourcesContent":["import { DidCommAgent } from '../DidCommSdk'\n\nexport class BasicMessagesApi {\n private agent: DidCommAgent\n\n public constructor(agent: DidCommAgent) {\n this.agent = agent\n }\n\n /**\n * Sends a basic message to the connection with the given connection id.\n *\n * @param connectionId The connection id.\n * @param message The message to send.\n */\n public async sendBasicMessage(connectionId: string, message: string) {\n return this.agent.didcomm.basicMessages.sendMessage(connectionId, message)\n }\n}\n"],"mappings":";AAEA,IAAa,mBAAb,MAA8B;CAG5B,AAAO,YAAY,OAAqB;AACtC,OAAK,QAAQ;;;;;;;;CASf,MAAa,iBAAiB,cAAsB,SAAiB;AACnE,SAAO,KAAK,MAAM,QAAQ,cAAc,YAAY,cAAc,QAAQ"}
@@ -0,0 +1 @@
1
+ import { BasicMessagesApi } from "./BasicMessagesApi.mjs";
@@ -0,0 +1,100 @@
1
+ import { DidCommAgent } from "../DidCommSdk.mjs";
2
+ import * as _credo_ts_didcomm13 from "@credo-ts/didcomm";
3
+ import { CreateOutOfBandInvitationConfig, DidCommConnectionInvitationMessage, DidCommOutOfBandInvitation, DidCommRouting, ReceiveOutOfBandInvitationConfig } from "@credo-ts/didcomm";
4
+
5
+ //#region src/connections/ConnectionsApi.d.ts
6
+ declare class ConnectionsApi {
7
+ private agent;
8
+ constructor(agent: DidCommAgent);
9
+ /**
10
+ * Creates an out-of-band invitation for establishing a connection with another agent.
11
+ */
12
+ createInvitation(domain: string, config?: CreateOutOfBandInvitationConfig): Promise<{
13
+ record: _credo_ts_didcomm13.DidCommOutOfBandRecord;
14
+ invitation: DidCommOutOfBandInvitation;
15
+ invitationUrl: string;
16
+ }>;
17
+ /**
18
+ * Accepts a connection invitation message or out-of-band invitation and returns the connection record.
19
+ */
20
+ acceptInvitation(invitation: DidCommOutOfBandInvitation | DidCommConnectionInvitationMessage, config: ReceiveOutOfBandInvitationConfig): Promise<{
21
+ outOfBandRecord: _credo_ts_didcomm13.DidCommOutOfBandRecord;
22
+ connectionRecord?: _credo_ts_didcomm13.DidCommConnectionRecord;
23
+ }>;
24
+ /**
25
+ * Parses an invitation from a URL.
26
+ */
27
+ parseInvitationFromUrl(invitationUrl: string): Promise<DidCommOutOfBandInvitation>;
28
+ /**
29
+ * Accepts a connection invitation from a URL.
30
+ */
31
+ acceptInvitationFromUrl(invitationUrl: string, config: ReceiveOutOfBandInvitationConfig): Promise<{
32
+ outOfBandRecord: _credo_ts_didcomm13.DidCommOutOfBandRecord;
33
+ connectionRecord?: _credo_ts_didcomm13.DidCommConnectionRecord;
34
+ }>;
35
+ /**
36
+ * Returns all connections from the agent.
37
+ */
38
+ getAll(): Promise<_credo_ts_didcomm13.DidCommConnectionRecord[]>;
39
+ /**
40
+ * Retrieves a connection record by connectionId.
41
+ */
42
+ getById(connectionId: string): Promise<_credo_ts_didcomm13.DidCommConnectionRecord>;
43
+ /**
44
+ * Finds a connection record by its ID.
45
+ */
46
+ findById(connectionId: string): Promise<_credo_ts_didcomm13.DidCommConnectionRecord | null>;
47
+ /**
48
+ * Finds an out-of-band record by its ID.
49
+ */
50
+ findOutOfBandRecordById(outOfBandId: string): Promise<_credo_ts_didcomm13.DidCommOutOfBandRecord | null>;
51
+ /**
52
+ * Finds an out-of-band record by its invitation ID.
53
+ */
54
+ findByReceivedInvitationId(receivedInvitationId: string): Promise<_credo_ts_didcomm13.DidCommOutOfBandRecord | null>;
55
+ /**
56
+ * Deletes a connection record by its ID.
57
+ */
58
+ deleteById(connectionId: string): Promise<boolean>;
59
+ /**
60
+ * Deletes an out-of-band record by its ID.
61
+ */
62
+ deleteOobRecordById(outOfBandId: string): Promise<boolean>;
63
+ /**
64
+ * Initiate message pickup.
65
+ *
66
+ * @param connectionId connection Id.
67
+ * @param timeoutMs wait for time in ms
68
+ */
69
+ waitForConnectionToComplete(connectionId: string, timeoutMs?: number): Promise<_credo_ts_didcomm13.DidCommConnectionRecord>;
70
+ /**
71
+ * Hangup connection.
72
+ *
73
+ * @param connectionId connection Id.
74
+ * @param deleteAfterHangup The connection record itself and any
75
+ * keys used for mediation will only be deleted if `deleteAfterHangup` flag is set.
76
+ */
77
+ hangup(connectionId: string, deleteAfterHangup?: boolean): Promise<void>;
78
+ /**
79
+ * Rotate the DID used for a given connection, notifying the other party immediately.
80
+ *
81
+ * If `toDid` is not specified, a new peer did will be created. Optionally, routing
82
+ * configuration can be set.
83
+ *
84
+ * Note: any did created or imported in agent wallet can be used as `toDid`, as long as
85
+ * there are valid DIDComm services in its DID Document.
86
+ *
87
+ * @param options connectionId and optional target did and routing configuration
88
+ * @returns object containing the new did
89
+ */
90
+ rotate(options: {
91
+ connectionId: string;
92
+ toDid?: string;
93
+ routing?: DidCommRouting;
94
+ }): Promise<{
95
+ newDid: string;
96
+ }>;
97
+ }
98
+ //#endregion
99
+ export { ConnectionsApi };
100
+ //# sourceMappingURL=ConnectionsApi.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionsApi.d.mts","names":[],"sources":["../../src/connections/ConnectionsApi.ts"],"mappings":";;;;;cASa,cAAA;EAAA,QACH,KAAA;cAEW,KAAA,EAAO,YAAA;EAHf;;;EAUE,gBAAA,CAAiB,MAAA,UAAgB,MAAA,GAAS,+BAAA,GAA+B,OAAA;YAAA,mBAAA,CAAA,sBAAA;;;;EAexE;;;EADD,gBAAA,CACX,UAAA,EAAY,0BAAA,GAA6B,kCAAA,EACzC,MAAA,EAAQ,gCAAA,GAAgC,OAAA;qBAAA,mBAAA,CAAA,sBAAA;;;EAQe;;;EAA5C,sBAAA,CAAuB,aAAA,WAAqB,OAAA,CAAA,0BAAA;EAO2C;;;EAAvF,uBAAA,CAAwB,aAAA,UAAuB,MAAA,EAAQ,gCAAA,GAAgC,OAAA;qBAAA,mBAAA,CAAA,sBAAA;;;EAkC1D;;;EAd7B,MAAA,CAAA,GAAM,OAAA,CApBiF,mBAAA,CAoBjF,uBAAA;EAmCyB;;;EA5B/B,OAAA,CAAQ,YAAA,WAAoB,OAAA,CAPtB,mBAAA,CAOsB,uBAAA;EAiE4B;;;EA1DxD,QAAA,CAAS,YAAA,WAAoB,OAAA,CAPD,mBAAA,CAOC,uBAAA;EA6EqD;;;EAtElF,uBAAA,CAAwB,WAAA,WAAmB,OAAA,CAPd,mBAAA,CAOc,sBAAA;EA/ErC;;;EAsFN,0BAAA,CAA2B,oBAAA,WAA4B,OAAA,CAPZ,mBAAA,CAOY,sBAAA;EA/EtB;;;EAsFjC,UAAA,CAAW,YAAA,WAAoB,OAAA;;;;EAQ/B,mBAAA,CAAoB,WAAA,WAAmB,OAAA;EA/EtC;;;;;;EA0FD,2BAAA,CAA4B,YAAA,UAAsB,SAAA,YAAkB,OAAA,CAX7B,mBAAA,CAW6B,uBAAA;;;;;;;;EAkBpE,MAAA,CAAO,YAAA,UAAsB,iBAAA,aAA2B,OAAA;EA5FhC;;;;;;;;;;;;EA+GxB,MAAA,CAAO,OAAA;IAAW,YAAA;IAAsB,KAAA;IAAgB,OAAA,GAAU,cAAA;EAAA,IAAgB,OAAA"}
@@ -0,0 +1,125 @@
1
+ //#region src/connections/ConnectionsApi.ts
2
+ var ConnectionsApi = class {
3
+ constructor(agent) {
4
+ this.agent = agent;
5
+ }
6
+ /**
7
+ * Creates an out-of-band invitation for establishing a connection with another agent.
8
+ */
9
+ async createInvitation(domain, config) {
10
+ const record = await this.agent.didcomm.oob.createInvitation(config);
11
+ const invitationUrl = record.outOfBandInvitation.toUrl({ domain });
12
+ return {
13
+ record,
14
+ invitation: record.outOfBandInvitation,
15
+ invitationUrl
16
+ };
17
+ }
18
+ /**
19
+ * Accepts a connection invitation message or out-of-band invitation and returns the connection record.
20
+ */
21
+ async acceptInvitation(invitation, config) {
22
+ return this.agent.didcomm.oob.receiveInvitation(invitation, config);
23
+ }
24
+ /**
25
+ * Parses an invitation from a URL.
26
+ */
27
+ async parseInvitationFromUrl(invitationUrl) {
28
+ return this.agent.didcomm.oob.parseInvitation(invitationUrl);
29
+ }
30
+ /**
31
+ * Accepts a connection invitation from a URL.
32
+ */
33
+ async acceptInvitationFromUrl(invitationUrl, config) {
34
+ const invitation = await this.agent.didcomm.oob.parseInvitation(invitationUrl);
35
+ if (!invitation) throw new Error("Could not parse invitation from URL");
36
+ const record = await this.agent.didcomm.oob.receiveInvitation(invitation, config);
37
+ if (!(record?.connectionRecord)?.id) throw new Error("Connection does not have an ID");
38
+ return record;
39
+ }
40
+ /**
41
+ * Returns all connections from the agent.
42
+ */
43
+ async getAll() {
44
+ return this.agent.didcomm.connections.getAll();
45
+ }
46
+ /**
47
+ * Retrieves a connection record by connectionId.
48
+ */
49
+ async getById(connectionId) {
50
+ return this.agent.didcomm.connections.getById(connectionId);
51
+ }
52
+ /**
53
+ * Finds a connection record by its ID.
54
+ */
55
+ async findById(connectionId) {
56
+ return this.agent.didcomm.connections.findById(connectionId);
57
+ }
58
+ /**
59
+ * Finds an out-of-band record by its ID.
60
+ */
61
+ async findOutOfBandRecordById(outOfBandId) {
62
+ return this.agent.didcomm.oob.findById(outOfBandId);
63
+ }
64
+ /**
65
+ * Finds an out-of-band record by its invitation ID.
66
+ */
67
+ async findByReceivedInvitationId(receivedInvitationId) {
68
+ return this.agent.didcomm.oob.findByReceivedInvitationId(receivedInvitationId);
69
+ }
70
+ /**
71
+ * Deletes a connection record by its ID.
72
+ */
73
+ async deleteById(connectionId) {
74
+ await this.agent.didcomm.connections.deleteById(connectionId);
75
+ return true;
76
+ }
77
+ /**
78
+ * Deletes an out-of-band record by its ID.
79
+ */
80
+ async deleteOobRecordById(outOfBandId) {
81
+ await this.agent.didcomm.oob.deleteById(outOfBandId);
82
+ return true;
83
+ }
84
+ /**
85
+ * Initiate message pickup.
86
+ *
87
+ * @param connectionId connection Id.
88
+ * @param timeoutMs wait for time in ms
89
+ */
90
+ async waitForConnectionToComplete(connectionId, timeoutMs) {
91
+ return this.agent.didcomm.connections.returnWhenIsConnected(connectionId, timeoutMs ? { timeoutMs } : void 0);
92
+ }
93
+ /**
94
+ * Hangup connection.
95
+ *
96
+ * @param connectionId connection Id.
97
+ * @param deleteAfterHangup The connection record itself and any
98
+ * keys used for mediation will only be deleted if `deleteAfterHangup` flag is set.
99
+ */
100
+ async hangup(connectionId, deleteAfterHangup) {
101
+ return this.agent.didcomm.connections.hangup({
102
+ connectionId,
103
+ deleteAfterHangup
104
+ });
105
+ }
106
+ /**
107
+ * Rotate the DID used for a given connection, notifying the other party immediately.
108
+ *
109
+ * If `toDid` is not specified, a new peer did will be created. Optionally, routing
110
+ * configuration can be set.
111
+ *
112
+ * Note: any did created or imported in agent wallet can be used as `toDid`, as long as
113
+ * there are valid DIDComm services in its DID Document.
114
+ *
115
+ * @param options connectionId and optional target did and routing configuration
116
+ * @returns object containing the new did
117
+ */
118
+ async rotate(options) {
119
+ return this.agent.didcomm.connections.rotate(options);
120
+ }
121
+ };
122
+
123
+ //#endregion
124
+ export { ConnectionsApi };
125
+ //# sourceMappingURL=ConnectionsApi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionsApi.mjs","names":[],"sources":["../../src/connections/ConnectionsApi.ts"],"sourcesContent":["import type {\n CreateOutOfBandInvitationConfig,\n DidCommConnectionInvitationMessage,\n DidCommOutOfBandInvitation,\n DidCommRouting,\n ReceiveOutOfBandInvitationConfig,\n} from '@credo-ts/didcomm'\nimport type { DidCommAgent } from '../DidCommSdk'\n\nexport class ConnectionsApi {\n private agent: DidCommAgent\n\n public constructor(agent: DidCommAgent) {\n this.agent = agent\n }\n\n /**\n * Creates an out-of-band invitation for establishing a connection with another agent.\n */\n public async createInvitation(domain: string, config?: CreateOutOfBandInvitationConfig) {\n const record = await this.agent.didcomm.oob.createInvitation(config)\n const invitationUrl = record.outOfBandInvitation.toUrl({ domain })\n\n return {\n record,\n invitation: record.outOfBandInvitation,\n invitationUrl,\n }\n }\n\n /**\n * Accepts a connection invitation message or out-of-band invitation and returns the connection record.\n */\n public async acceptInvitation(\n invitation: DidCommOutOfBandInvitation | DidCommConnectionInvitationMessage,\n config: ReceiveOutOfBandInvitationConfig\n ) {\n return this.agent.didcomm.oob.receiveInvitation(invitation, config)\n }\n\n /**\n * Parses an invitation from a URL.\n */\n public async parseInvitationFromUrl(invitationUrl: string) {\n return this.agent.didcomm.oob.parseInvitation(invitationUrl)\n }\n\n /**\n * Accepts a connection invitation from a URL.\n */\n public async acceptInvitationFromUrl(invitationUrl: string, config: ReceiveOutOfBandInvitationConfig) {\n const invitation = await this.agent.didcomm.oob.parseInvitation(invitationUrl)\n\n if (!invitation) {\n throw new Error('Could not parse invitation from URL')\n }\n\n const record = await this.agent.didcomm.oob.receiveInvitation(invitation, config)\n const connectionRecord = record?.connectionRecord\n\n if (!connectionRecord?.id) {\n throw new Error('Connection does not have an ID')\n }\n\n return record\n }\n\n /**\n * Returns all connections from the agent.\n */\n public async getAll() {\n return this.agent.didcomm.connections.getAll()\n }\n\n /**\n * Retrieves a connection record by connectionId.\n */\n public async getById(connectionId: string) {\n return this.agent.didcomm.connections.getById(connectionId)\n }\n\n /**\n * Finds a connection record by its ID.\n */\n public async findById(connectionId: string) {\n return this.agent.didcomm.connections.findById(connectionId)\n }\n\n /**\n * Finds an out-of-band record by its ID.\n */\n public async findOutOfBandRecordById(outOfBandId: string) {\n return this.agent.didcomm.oob.findById(outOfBandId)\n }\n\n /**\n * Finds an out-of-band record by its invitation ID.\n */\n public async findByReceivedInvitationId(receivedInvitationId: string) {\n return this.agent.didcomm.oob.findByReceivedInvitationId(receivedInvitationId)\n }\n\n /**\n * Deletes a connection record by its ID.\n */\n public async deleteById(connectionId: string) {\n await this.agent.didcomm.connections.deleteById(connectionId)\n return true\n }\n\n /**\n * Deletes an out-of-band record by its ID.\n */\n public async deleteOobRecordById(outOfBandId: string) {\n await this.agent.didcomm.oob.deleteById(outOfBandId)\n return true\n }\n\n /**\n * Initiate message pickup.\n *\n * @param connectionId connection Id.\n * @param timeoutMs wait for time in ms\n */\n public async waitForConnectionToComplete(connectionId: string, timeoutMs?: number) {\n return this.agent.didcomm.connections.returnWhenIsConnected(\n connectionId,\n timeoutMs\n ? {\n timeoutMs: timeoutMs,\n }\n : undefined\n )\n }\n\n /**\n * Hangup connection.\n *\n * @param connectionId connection Id.\n * @param deleteAfterHangup The connection record itself and any\n * keys used for mediation will only be deleted if `deleteAfterHangup` flag is set.\n */\n public async hangup(connectionId: string, deleteAfterHangup?: boolean) {\n return this.agent.didcomm.connections.hangup({\n connectionId,\n deleteAfterHangup,\n })\n }\n\n /**\n * Rotate the DID used for a given connection, notifying the other party immediately.\n *\n * If `toDid` is not specified, a new peer did will be created. Optionally, routing\n * configuration can be set.\n *\n * Note: any did created or imported in agent wallet can be used as `toDid`, as long as\n * there are valid DIDComm services in its DID Document.\n *\n * @param options connectionId and optional target did and routing configuration\n * @returns object containing the new did\n */\n public async rotate(options: { connectionId: string; toDid?: string; routing?: DidCommRouting }) {\n return this.agent.didcomm.connections.rotate(options)\n }\n}\n"],"mappings":";AASA,IAAa,iBAAb,MAA4B;CAG1B,AAAO,YAAY,OAAqB;AACtC,OAAK,QAAQ;;;;;CAMf,MAAa,iBAAiB,QAAgB,QAA0C;EACtF,MAAM,SAAS,MAAM,KAAK,MAAM,QAAQ,IAAI,iBAAiB,OAAO;EACpE,MAAM,gBAAgB,OAAO,oBAAoB,MAAM,EAAE,QAAQ,CAAC;AAElE,SAAO;GACL;GACA,YAAY,OAAO;GACnB;GACD;;;;;CAMH,MAAa,iBACX,YACA,QACA;AACA,SAAO,KAAK,MAAM,QAAQ,IAAI,kBAAkB,YAAY,OAAO;;;;;CAMrE,MAAa,uBAAuB,eAAuB;AACzD,SAAO,KAAK,MAAM,QAAQ,IAAI,gBAAgB,cAAc;;;;;CAM9D,MAAa,wBAAwB,eAAuB,QAA0C;EACpG,MAAM,aAAa,MAAM,KAAK,MAAM,QAAQ,IAAI,gBAAgB,cAAc;AAE9E,MAAI,CAAC,WACH,OAAM,IAAI,MAAM,sCAAsC;EAGxD,MAAM,SAAS,MAAM,KAAK,MAAM,QAAQ,IAAI,kBAAkB,YAAY,OAAO;AAGjF,MAAI,EAFqB,QAAQ,mBAEV,GACrB,OAAM,IAAI,MAAM,iCAAiC;AAGnD,SAAO;;;;;CAMT,MAAa,SAAS;AACpB,SAAO,KAAK,MAAM,QAAQ,YAAY,QAAQ;;;;;CAMhD,MAAa,QAAQ,cAAsB;AACzC,SAAO,KAAK,MAAM,QAAQ,YAAY,QAAQ,aAAa;;;;;CAM7D,MAAa,SAAS,cAAsB;AAC1C,SAAO,KAAK,MAAM,QAAQ,YAAY,SAAS,aAAa;;;;;CAM9D,MAAa,wBAAwB,aAAqB;AACxD,SAAO,KAAK,MAAM,QAAQ,IAAI,SAAS,YAAY;;;;;CAMrD,MAAa,2BAA2B,sBAA8B;AACpE,SAAO,KAAK,MAAM,QAAQ,IAAI,2BAA2B,qBAAqB;;;;;CAMhF,MAAa,WAAW,cAAsB;AAC5C,QAAM,KAAK,MAAM,QAAQ,YAAY,WAAW,aAAa;AAC7D,SAAO;;;;;CAMT,MAAa,oBAAoB,aAAqB;AACpD,QAAM,KAAK,MAAM,QAAQ,IAAI,WAAW,YAAY;AACpD,SAAO;;;;;;;;CAST,MAAa,4BAA4B,cAAsB,WAAoB;AACjF,SAAO,KAAK,MAAM,QAAQ,YAAY,sBACpC,cACA,YACI,EACa,WACZ,GACD,OACL;;;;;;;;;CAUH,MAAa,OAAO,cAAsB,mBAA6B;AACrE,SAAO,KAAK,MAAM,QAAQ,YAAY,OAAO;GAC3C;GACA;GACD,CAAC;;;;;;;;;;;;;;CAeJ,MAAa,OAAO,SAA6E;AAC/F,SAAO,KAAK,MAAM,QAAQ,YAAY,OAAO,QAAQ"}
@@ -0,0 +1 @@
1
+ import { ConnectionsApi } from "./ConnectionsApi.mjs";
@@ -0,0 +1,7 @@
1
+ import "./contexts/index.mjs";
2
+ import "./providers/AgentProvider.mjs";
3
+ import { Agent } from "@credo-ts/core";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import "@credo-ts/askar";
6
+ import "@credo-ts/react-native";
7
+ import "@openwallet-foundation/askar-react-native";
@@ -0,0 +1,8 @@
1
+ import { createContext, useContext, useState } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+
4
+ //#region ../core/src/contexts/MobileSDKContext.tsx
5
+ const MobileSDKContext = createContext(void 0);
6
+
7
+ //#endregion
8
+ //# sourceMappingURL=MobileSDKContext.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileSDKContext.mjs","names":[],"sources":["../../../../../core/src/contexts/MobileSDKContext.tsx"],"sourcesContent":["import type React from 'react'\nimport { createContext, type ReactNode, useContext, useState } from 'react'\nimport type { MobileSDK, MobileSDKModule } from '../MobileSDK'\n\ninterface MobileSDKContextType {\n sdk: MobileSDK | null\n isInitialized: boolean\n initialize: (sdk: MobileSDK) => void\n shutdown: () => void\n}\n\nconst MobileSDKContext = createContext<MobileSDKContextType | undefined>(undefined)\n\nexport const useMobileSDK = <T extends Record<string, MobileSDKModule> = Record<string, MobileSDKModule>>() => {\n const context = useContext(MobileSDKContext)\n if (context === undefined) {\n throw new Error('useMobileSDK must be used within an MobileSDKProvider')\n }\n return {\n sdk: context.sdk as MobileSDK<T>,\n isInitialized: context.isInitialized,\n initialize: context.initialize,\n shutdown: context.shutdown,\n }\n}\n\ninterface SDKProviderProps {\n children: ReactNode\n}\n\nexport const MobileSDKProvider: React.FC<SDKProviderProps> = ({ children }) => {\n const [sdk, setSDK] = useState<MobileSDK | null>(null)\n const [isInitialized, setIsInitialized] = useState(false)\n\n const initialize = (newSDK: MobileSDK) => {\n setSDK(newSDK)\n setIsInitialized(true)\n }\n\n const shutdown = () => {\n setSDK(null)\n setIsInitialized(false)\n }\n\n return (\n <MobileSDKContext.Provider value={{ sdk, isInitialized, initialize, shutdown }}>\n {children}\n </MobileSDKContext.Provider>\n )\n}\n"],"mappings":";;;;AAWA,MAAM,mBAAmB,cAAgD,OAAU"}
@@ -0,0 +1 @@
1
+ import "./MobileSDKContext.mjs";
@@ -0,0 +1 @@
1
+ import "./useSDKInitializer.mjs";
@@ -0,0 +1,3 @@
1
+ import "../contexts/index.mjs";
2
+ import "../MobileSDK.mjs";
3
+ import { useCallback } from "react";
@@ -0,0 +1,6 @@
1
+ import "./contexts/index.mjs";
2
+ import "./MobileSDK.mjs";
3
+ import "./hooks/index.mjs";
4
+ import { addRecord, recordsAddedByType, recordsRemovedByType, recordsUpdatedByType, removeRecord, updateRecord } from "./providers/recordUtils.mjs";
5
+ import "./providers/index.mjs";
6
+ import "@credo-ts/core";
@@ -0,0 +1,8 @@
1
+ import { createContext, useContext } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+
4
+ //#region ../core/src/providers/AgentProvider.tsx
5
+ const AgentContext = createContext(void 0);
6
+
7
+ //#endregion
8
+ //# sourceMappingURL=AgentProvider.mjs.map