@tsg-dsp/tsg-sdk 0.0.0-stage → 0.21.0

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 (222) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +362 -2
  3. package/dist/.generated/control-plane.d.ts +7825 -0
  4. package/dist/.generated/sso-bridge.d.ts +3999 -0
  5. package/dist/.generated/wallet.d.ts +6248 -0
  6. package/dist/auth/auth.provider.d.ts +49 -0
  7. package/dist/auth/auth.provider.d.ts.map +1 -0
  8. package/dist/auth/auth.provider.js +166 -0
  9. package/dist/auth/auth.provider.js.map +1 -0
  10. package/dist/auth/auth.types.d.ts +27 -0
  11. package/dist/auth/auth.types.d.ts.map +1 -0
  12. package/dist/auth/auth.types.js +2 -0
  13. package/dist/auth/auth.types.js.map +1 -0
  14. package/dist/auth/index.d.ts +3 -0
  15. package/dist/auth/index.d.ts.map +1 -0
  16. package/dist/auth/index.js +3 -0
  17. package/dist/auth/index.js.map +1 -0
  18. package/dist/browser.d.ts +1245 -0
  19. package/dist/browser.d.ts.map +1 -0
  20. package/dist/browser.js +228 -0
  21. package/dist/browser.js.map +1 -0
  22. package/dist/catalog/catalog.sdk.d.ts +149 -0
  23. package/dist/catalog/catalog.sdk.d.ts.map +1 -0
  24. package/dist/catalog/catalog.sdk.js +155 -0
  25. package/dist/catalog/catalog.sdk.js.map +1 -0
  26. package/dist/catalog/index.d.ts +2 -0
  27. package/dist/catalog/index.d.ts.map +1 -0
  28. package/dist/catalog/index.js +2 -0
  29. package/dist/catalog/index.js.map +1 -0
  30. package/dist/client.d.ts +43 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +109 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/config/index.d.ts +2 -0
  35. package/dist/config/index.d.ts.map +1 -0
  36. package/dist/config/index.js +2 -0
  37. package/dist/config/index.js.map +1 -0
  38. package/dist/config/sdk.config.d.ts +97 -0
  39. package/dist/config/sdk.config.d.ts.map +1 -0
  40. package/dist/config/sdk.config.js +2 -0
  41. package/dist/config/sdk.config.js.map +1 -0
  42. package/dist/index.d.ts +18 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +25 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/metadata/index.d.ts +2 -0
  47. package/dist/metadata/index.d.ts.map +1 -0
  48. package/dist/metadata/index.js +2 -0
  49. package/dist/metadata/index.js.map +1 -0
  50. package/dist/metadata/metadata.sdk.d.ts +114 -0
  51. package/dist/metadata/metadata.sdk.d.ts.map +1 -0
  52. package/dist/metadata/metadata.sdk.js +145 -0
  53. package/dist/metadata/metadata.sdk.js.map +1 -0
  54. package/dist/negotiations/index.d.ts +2 -0
  55. package/dist/negotiations/index.d.ts.map +1 -0
  56. package/dist/negotiations/index.js +2 -0
  57. package/dist/negotiations/index.js.map +1 -0
  58. package/dist/negotiations/negotiations.sdk.d.ts +113 -0
  59. package/dist/negotiations/negotiations.sdk.d.ts.map +1 -0
  60. package/dist/negotiations/negotiations.sdk.js +146 -0
  61. package/dist/negotiations/negotiations.sdk.js.map +1 -0
  62. package/dist/requirements/index.d.ts +2 -0
  63. package/dist/requirements/index.d.ts.map +1 -0
  64. package/dist/requirements/index.js +2 -0
  65. package/dist/requirements/index.js.map +1 -0
  66. package/dist/requirements/requirements.sdk.d.ts +52 -0
  67. package/dist/requirements/requirements.sdk.d.ts.map +1 -0
  68. package/dist/requirements/requirements.sdk.js +123 -0
  69. package/dist/requirements/requirements.sdk.js.map +1 -0
  70. package/dist/sso/index.d.ts +3 -0
  71. package/dist/sso/index.d.ts.map +1 -0
  72. package/dist/sso/index.js +3 -0
  73. package/dist/sso/index.js.map +1 -0
  74. package/dist/sso/sso-management.sdk.d.ts +96 -0
  75. package/dist/sso/sso-management.sdk.d.ts.map +1 -0
  76. package/dist/sso/sso-management.sdk.js +152 -0
  77. package/dist/sso/sso-management.sdk.js.map +1 -0
  78. package/dist/sso/sso.sdk.d.ts +75 -0
  79. package/dist/sso/sso.sdk.d.ts.map +1 -0
  80. package/dist/sso/sso.sdk.js +149 -0
  81. package/dist/sso/sso.sdk.js.map +1 -0
  82. package/dist/tenants/tenant-management.sdk.d.ts +48 -0
  83. package/dist/tenants/tenant-management.sdk.d.ts.map +1 -0
  84. package/dist/tenants/tenant-management.sdk.js +107 -0
  85. package/dist/tenants/tenant-management.sdk.js.map +1 -0
  86. package/dist/transfers/index.d.ts +2 -0
  87. package/dist/transfers/index.d.ts.map +1 -0
  88. package/dist/transfers/index.js +2 -0
  89. package/dist/transfers/index.js.map +1 -0
  90. package/dist/transfers/transfers.sdk.d.ts +174 -0
  91. package/dist/transfers/transfers.sdk.d.ts.map +1 -0
  92. package/dist/transfers/transfers.sdk.js +200 -0
  93. package/dist/transfers/transfers.sdk.js.map +1 -0
  94. package/dist/tsg-sdk.d.ts +68 -0
  95. package/dist/tsg-sdk.d.ts.map +1 -0
  96. package/dist/tsg-sdk.js +145 -0
  97. package/dist/tsg-sdk.js.map +1 -0
  98. package/dist/utils/errors.d.ts +67 -0
  99. package/dist/utils/errors.d.ts.map +1 -0
  100. package/dist/utils/errors.js +79 -0
  101. package/dist/utils/errors.js.map +1 -0
  102. package/dist/utils/index.d.ts +5 -0
  103. package/dist/utils/index.d.ts.map +1 -0
  104. package/dist/utils/index.js +5 -0
  105. package/dist/utils/index.js.map +1 -0
  106. package/dist/utils/polling.d.ts +20 -0
  107. package/dist/utils/polling.d.ts.map +1 -0
  108. package/dist/utils/polling.js +35 -0
  109. package/dist/utils/polling.js.map +1 -0
  110. package/dist/utils/reason.d.ts +16 -0
  111. package/dist/utils/reason.d.ts.map +1 -0
  112. package/dist/utils/reason.js +34 -0
  113. package/dist/utils/reason.js.map +1 -0
  114. package/dist/utils/shape-validation.d.ts +59 -0
  115. package/dist/utils/shape-validation.d.ts.map +1 -0
  116. package/dist/utils/shape-validation.js +85 -0
  117. package/dist/utils/shape-validation.js.map +1 -0
  118. package/dist/utils/validate.d.ts +47 -0
  119. package/dist/utils/validate.d.ts.map +1 -0
  120. package/dist/utils/validate.js +68 -0
  121. package/dist/utils/validate.js.map +1 -0
  122. package/dist/vendor/common-dtos/abac.policy.d.ts +69 -0
  123. package/dist/vendor/common-dtos/abac.policy.js +5 -0
  124. package/dist/vendor/common-dtos/audit.types.d.ts +74 -0
  125. package/dist/vendor/common-dtos/audit.types.js +8 -0
  126. package/dist/vendor/common-dtos/credential-requirements.d.ts +18 -0
  127. package/dist/vendor/common-dtos/credential-requirements.dto.d.ts +46 -0
  128. package/dist/vendor/common-dtos/credential-requirements.dto.js +250 -0
  129. package/dist/vendor/common-dtos/credential-requirements.js +180 -0
  130. package/dist/vendor/common-dtos/dataplane.dto.d.ts +5 -0
  131. package/dist/vendor/common-dtos/dataplane.dto.js +28 -0
  132. package/dist/vendor/common-dtos/dcp.dto.d.ts +89 -0
  133. package/dist/vendor/common-dtos/dcp.dto.js +489 -0
  134. package/dist/vendor/common-dtos/dcql.dto.d.ts +88 -0
  135. package/dist/vendor/common-dtos/dcql.dto.js +449 -0
  136. package/dist/vendor/common-dtos/did.schemas.d.ts +39 -0
  137. package/dist/vendor/common-dtos/did.schemas.js +259 -0
  138. package/dist/vendor/common-dtos/index.d.ts +19 -0
  139. package/dist/vendor/common-dtos/index.js +19 -0
  140. package/dist/vendor/common-dtos/metadata.dto.d.ts +5 -0
  141. package/dist/vendor/common-dtos/metadata.dto.js +29 -0
  142. package/dist/vendor/common-dtos/negotiations.dto.d.ts +28 -0
  143. package/dist/vendor/common-dtos/negotiations.dto.js +204 -0
  144. package/dist/vendor/common-dtos/permission-resources.d.ts +3 -0
  145. package/dist/vendor/common-dtos/permission-resources.js +18 -0
  146. package/dist/vendor/common-dtos/permissions.d.ts +242 -0
  147. package/dist/vendor/common-dtos/permissions.js +409 -0
  148. package/dist/vendor/common-dtos/presentation.request.dto.d.ts +8 -0
  149. package/dist/vendor/common-dtos/presentation.request.dto.js +54 -0
  150. package/dist/vendor/common-dtos/presentation.status.dto.d.ts +12 -0
  151. package/dist/vendor/common-dtos/presentation.status.dto.js +82 -0
  152. package/dist/vendor/common-dtos/presentationdefinition.dto.d.ts +74 -0
  153. package/dist/vendor/common-dtos/presentationdefinition.dto.js +447 -0
  154. package/dist/vendor/common-dtos/signatures.dto.d.ts +31 -0
  155. package/dist/vendor/common-dtos/signatures.dto.js +209 -0
  156. package/dist/vendor/common-dtos/transfer.dto.d.ts +16 -0
  157. package/dist/vendor/common-dtos/transfer.dto.js +101 -0
  158. package/dist/vendor/common-dtos/utils.swagger.d.ts +12 -0
  159. package/dist/vendor/common-dtos/utils.swagger.js +62 -0
  160. package/dist/vendor/control-plane-dtos/index.d.ts +4 -0
  161. package/dist/vendor/control-plane-dtos/index.js +4 -0
  162. package/dist/vendor/control-plane-dtos/registry/registry.dto.d.ts +4 -0
  163. package/dist/vendor/control-plane-dtos/registry/registry.dto.js +25 -0
  164. package/dist/vendor/control-plane-dtos/registry/registry.search.dto.d.ts +28 -0
  165. package/dist/vendor/control-plane-dtos/registry/registry.search.dto.js +126 -0
  166. package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.d.ts +9 -0
  167. package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.js +43 -0
  168. package/dist/vendor/control-plane-dtos/status/status.dto.d.ts +37 -0
  169. package/dist/vendor/control-plane-dtos/status/status.dto.js +172 -0
  170. package/dist/vendor/sso-bridge-dtos/clients.dto.d.ts +25 -0
  171. package/dist/vendor/sso-bridge-dtos/clients.dto.js +147 -0
  172. package/dist/vendor/sso-bridge-dtos/grants.d.ts +4 -0
  173. package/dist/vendor/sso-bridge-dtos/grants.js +7 -0
  174. package/dist/vendor/sso-bridge-dtos/index.d.ts +5 -0
  175. package/dist/vendor/sso-bridge-dtos/index.js +5 -0
  176. package/dist/vendor/sso-bridge-dtos/tenant.dto.d.ts +70 -0
  177. package/dist/vendor/sso-bridge-dtos/tenant.dto.js +1 -0
  178. package/dist/vendor/sso-bridge-dtos/users.dto.d.ts +42 -0
  179. package/dist/vendor/sso-bridge-dtos/users.dto.js +173 -0
  180. package/dist/vendor/tenant-dtos/authorization.dto.d.ts +46 -0
  181. package/dist/vendor/tenant-dtos/authorization.dto.js +5 -0
  182. package/dist/vendor/tenant-dtos/consumer.dto.d.ts +29 -0
  183. package/dist/vendor/tenant-dtos/consumer.dto.js +1 -0
  184. package/dist/vendor/tenant-dtos/fixtures.d.ts +15 -0
  185. package/dist/vendor/tenant-dtos/fixtures.js +48 -0
  186. package/dist/vendor/tenant-dtos/index.d.ts +8 -0
  187. package/dist/vendor/tenant-dtos/index.js +8 -0
  188. package/dist/vendor/tenant-dtos/management.dto.d.ts +137 -0
  189. package/dist/vendor/tenant-dtos/management.dto.js +1 -0
  190. package/dist/vendor/tenant-dtos/membership.dto.d.ts +22 -0
  191. package/dist/vendor/tenant-dtos/membership.dto.js +7 -0
  192. package/dist/vendor/tenant-dtos/principal.dto.d.ts +13 -0
  193. package/dist/vendor/tenant-dtos/principal.dto.js +6 -0
  194. package/dist/vendor/tenant-dtos/provisioning.dto.d.ts +47 -0
  195. package/dist/vendor/tenant-dtos/provisioning.dto.js +1 -0
  196. package/dist/vendor/tenant-dtos/service-binding.dto.d.ts +9 -0
  197. package/dist/vendor/tenant-dtos/service-binding.dto.js +1 -0
  198. package/dist/vendor/tenant-dtos/tenant.dto.d.ts +15 -0
  199. package/dist/vendor/tenant-dtos/tenant.dto.js +1 -0
  200. package/dist/vendor/wallet-dtos/clients.dto.d.ts +21 -0
  201. package/dist/vendor/wallet-dtos/clients.dto.js +13 -0
  202. package/dist/vendor/wallet-dtos/credentials.dto.d.ts +31 -0
  203. package/dist/vendor/wallet-dtos/credentials.dto.js +46 -0
  204. package/dist/vendor/wallet-dtos/index.d.ts +6 -0
  205. package/dist/vendor/wallet-dtos/index.js +6 -0
  206. package/dist/vendor/wallet-dtos/issuance.dto.d.ts +237 -0
  207. package/dist/vendor/wallet-dtos/issuance.dto.js +1139 -0
  208. package/dist/vendor/wallet-dtos/scopes.dto.d.ts +24 -0
  209. package/dist/vendor/wallet-dtos/scopes.dto.js +151 -0
  210. package/dist/vendor/wallet-dtos/status.dto.d.ts +35 -0
  211. package/dist/vendor/wallet-dtos/status.dto.js +169 -0
  212. package/dist/vendor/wallet-dtos/utils/schema-converter.d.ts +13 -0
  213. package/dist/vendor/wallet-dtos/utils/schema-converter.js +42 -0
  214. package/dist/wallet/index.d.ts +2 -0
  215. package/dist/wallet/index.d.ts.map +1 -0
  216. package/dist/wallet/index.js +2 -0
  217. package/dist/wallet/index.js.map +1 -0
  218. package/dist/wallet/wallet.sdk.d.ts +285 -0
  219. package/dist/wallet/wallet.sdk.d.ts.map +1 -0
  220. package/dist/wallet/wallet.sdk.js +384 -0
  221. package/dist/wallet/wallet.sdk.js.map +1 -0
  222. package/package.json +79 -3
@@ -0,0 +1,285 @@
1
+ import type { VerifiablePresentationJwt } from "@tsg-dsp/common-dsp";
2
+ import type { CreatePresentationJwtRequest, CredentialStatusRequest, DIDDocumentDto, ServiceDto, SignedJwtResponse, SignRequestJwt, ValidateJWTRequest, VerifiedCredentialStatus } from "../vendor/common-dtos/index.js";
3
+ import type { AddScope, CredentialOffer, CredentialOfferRequest, CredentialOfferStatus, DCPCredentialRequestInitiation, KeyInfo, ScopeDto } from "../vendor/wallet-dtos/index.js";
4
+ import type { components as WalletComponents } from "../.generated/wallet.js";
5
+ import type { WalletClient } from "../client.js";
6
+ import { type JsonObject } from "../utils/shape-validation.js";
7
+ type WalletSchemas = WalletComponents["schemas"];
8
+ /**
9
+ * Definition of a DID service entry, as accepted by the wallet when
10
+ * registering or updating a service in the DID document.
11
+ */
12
+ export type DidServiceConfig = WalletSchemas["DidServiceConfigDto"];
13
+ /**
14
+ * Manage cryptographic keys, verifiable credentials, DIDs, and credential
15
+ * issuance through the TSG Wallet.
16
+ *
17
+ * Requires `walletBaseUrl` to be set in the SDK configuration.
18
+ * @example
19
+ * ```ts
20
+ * const keys = await sdk.wallet.listKeys();
21
+ * const did = await sdk.wallet.getDidDocument();
22
+ * const signed = await sdk.wallet.signJwt({ body: payload, audience: "did:web:other" });
23
+ * ```
24
+ */
25
+ export declare class WalletSdk {
26
+ private readonly client;
27
+ constructor(client: WalletClient);
28
+ /**
29
+ * Request a JWT signature from the wallet using a managed key.
30
+ * @param request - The signing request containing the JWT body, audience, key ID, etc.
31
+ * @returns A validated {@link SignedJwtResponse} containing the signed JWT.
32
+ */
33
+ signJwt(request: SignRequestJwt): Promise<SignedJwtResponse>;
34
+ /**
35
+ * Validate a JWT using the wallet's key material and trust configuration.
36
+ * @param request - The validation request containing the JWT string to verify.
37
+ * @returns The validation result.
38
+ */
39
+ validateJwt(request: ValidateJWTRequest): Promise<JsonObject>;
40
+ /**
41
+ * Create a VP-JWT from wallet credentials using the wallet's presentation service.
42
+ * @param request - Credential IDs and optional signing options for the presentation.
43
+ * @returns A validated {@link VerifiablePresentationJwt} containing the signed VP-JWT.
44
+ */
45
+ createPresentationJwt(request: CreatePresentationJwtRequest): Promise<VerifiablePresentationJwt>;
46
+ /**
47
+ * Store an immutable, versioned Presentation Definition for DCP scope resolution.
48
+ * @param scope - Scope alias, immutable revision metadata, and compiled definition.
49
+ * @returns The persisted wallet scope.
50
+ */
51
+ addPresentationScope(scope: AddScope): Promise<ScopeDto>;
52
+ /**
53
+ * List presentation scopes, optionally selecting an immutable revision.
54
+ * @param alias - Optional scope alias filter.
55
+ * @param revision - Optional immutable revision filter.
56
+ * @returns The paginated wallet scope response.
57
+ */
58
+ listPresentationScopes(alias?: string, revision?: number): Promise<{
59
+ data: ScopeDto[];
60
+ total: number;
61
+ }>;
62
+ /**
63
+ * Verify a bitstring status-list entry through the wallet.
64
+ * @param request - Status-list credential URL and entry index.
65
+ * @returns The validated revocation or suspension status.
66
+ */
67
+ verifyCredentialStatus(request: CredentialStatusRequest): Promise<VerifiedCredentialStatus>;
68
+ /**
69
+ * List all verifiable credentials stored in the wallet.
70
+ * @returns An array of credential objects.
71
+ */
72
+ listCredentials(): Promise<{
73
+ id: string;
74
+ targetDid: string;
75
+ credential: WalletComponents["schemas"]["Credential"];
76
+ proof: WalletComponents["schemas"]["DataIntegrityProof"][];
77
+ jwt?: string;
78
+ selfIssued: boolean;
79
+ revoked: boolean;
80
+ statusListIndex?: number;
81
+ createdDate: string;
82
+ modifiedDate: string;
83
+ deletedDate?: string;
84
+ }[]>;
85
+ /**
86
+ * Issue a new credential within this wallet.
87
+ * @param credentialConfig - Wallet credential configuration.
88
+ * @returns The created credential record.
89
+ */
90
+ addCredential(credentialConfig: WalletSchemas["CredentialConfigDto"]): Promise<{
91
+ id: string;
92
+ targetDid: string;
93
+ credential: WalletComponents["schemas"]["Credential"];
94
+ proof: WalletComponents["schemas"]["DataIntegrityProof"][];
95
+ jwt?: string;
96
+ selfIssued: boolean;
97
+ revoked: boolean;
98
+ statusListIndex?: number;
99
+ createdDate: string;
100
+ modifiedDate: string;
101
+ deletedDate?: string;
102
+ }>;
103
+ /**
104
+ * Import an externally issued credential into this wallet.
105
+ * @param credential - Verifiable Credential document to import.
106
+ * @returns The imported credential record.
107
+ */
108
+ importCredential(credential: WalletSchemas["VerifiableCredential"]): Promise<{
109
+ id: string;
110
+ targetDid: string;
111
+ credential: WalletComponents["schemas"]["Credential"];
112
+ proof: WalletComponents["schemas"]["DataIntegrityProof"][];
113
+ jwt?: string;
114
+ selfIssued: boolean;
115
+ revoked: boolean;
116
+ statusListIndex?: number;
117
+ createdDate: string;
118
+ modifiedDate: string;
119
+ deletedDate?: string;
120
+ }>;
121
+ /**
122
+ * Get a specific verifiable credential by its ID.
123
+ * @param credentialId - The credential identifier.
124
+ * @returns The credential object.
125
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the credential does not exist.
126
+ */
127
+ getCredential(credentialId: string): Promise<{
128
+ id: string;
129
+ targetDid: string;
130
+ credential: WalletComponents["schemas"]["Credential"];
131
+ proof: WalletComponents["schemas"]["DataIntegrityProof"][];
132
+ jwt?: string;
133
+ selfIssued: boolean;
134
+ revoked: boolean;
135
+ statusListIndex?: number;
136
+ createdDate: string;
137
+ modifiedDate: string;
138
+ deletedDate?: string;
139
+ }>;
140
+ /**
141
+ * Delete a verifiable credential from the wallet.
142
+ * @param credentialId - The credential identifier.
143
+ * @returns The deletion response.
144
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the credential does not exist.
145
+ */
146
+ deleteCredential(credentialId: string): Promise<undefined>;
147
+ /**
148
+ * Revoke a verifiable credential, making it invalid for future verification.
149
+ * @param credentialId - The credential identifier.
150
+ * @returns The revocation response.
151
+ */
152
+ revokeCredential(credentialId: string): Promise<undefined>;
153
+ /**
154
+ * Get the credential configuration, including trust anchors and issuer settings.
155
+ * @returns The credential configuration object.
156
+ */
157
+ getCredentialConfig(): Promise<JsonObject>;
158
+ /**
159
+ * List all dataspace-scoped verifiable credentials.
160
+ *
161
+ * Dataspace credentials are a subset of credentials specifically used
162
+ * for dataspace membership and trust establishment.
163
+ * @returns An array of dataspace credential objects.
164
+ */
165
+ listDataspaceCredentials(): Promise<{
166
+ id: string;
167
+ targetDid: string;
168
+ credential: WalletComponents["schemas"]["Credential"];
169
+ proof: WalletComponents["schemas"]["DataIntegrityProof"][];
170
+ jwt?: string;
171
+ selfIssued: boolean;
172
+ revoked: boolean;
173
+ statusListIndex?: number;
174
+ createdDate: string;
175
+ modifiedDate: string;
176
+ deletedDate?: string;
177
+ }[]>;
178
+ /**
179
+ * Get the DID document of this wallet's identity.
180
+ * @returns A validated {@link DIDDocumentDto}.
181
+ */
182
+ getDidDocument(): Promise<DIDDocumentDto>;
183
+ /**
184
+ * Get all DID services registered in the DID document.
185
+ * @returns An array of validated {@link ServiceDto} instances.
186
+ */
187
+ getDidServices(): Promise<ServiceDto[]>;
188
+ /**
189
+ * Register a new DID service in this wallet's DID document.
190
+ *
191
+ * Applications use this to advertise their own endpoints (an orchestration
192
+ * inbox, a connector address) so that peers can discover them by resolving
193
+ * the DID document instead of being configured with a static URL.
194
+ * @param service - Service identifier, type and endpoint.
195
+ * @returns A validated {@link ServiceDto} describing the registered service.
196
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.CONFLICT} if a service with the same id already exists.
197
+ */
198
+ addDidService(service: DidServiceConfig): Promise<ServiceDto>;
199
+ /**
200
+ * Update an already registered DID service.
201
+ * @param id - Identifier of the service to update.
202
+ * @param service - The new service definition.
203
+ * @returns A validated {@link ServiceDto} describing the updated service.
204
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the service does not exist.
205
+ */
206
+ updateDidService(id: string, service: DidServiceConfig): Promise<ServiceDto>;
207
+ /**
208
+ * Remove a DID service from this wallet's DID document.
209
+ * @param id - Identifier of the service to remove.
210
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the service does not exist.
211
+ */
212
+ removeDidService(id: string): Promise<void>;
213
+ /**
214
+ * List all cryptographic keys managed by the wallet.
215
+ * @returns An array of validated {@link KeyInfo} instances.
216
+ */
217
+ listKeys(): Promise<KeyInfo[]>;
218
+ /**
219
+ * Generate a new wallet key from the provided configuration.
220
+ * @param keyConfig - Wallet key configuration.
221
+ * @returns A validated {@link KeyInfo}.
222
+ */
223
+ addKey(keyConfig: WalletSchemas["KeyConfigDto"]): Promise<KeyInfo>;
224
+ /**
225
+ * Get a specific key by its ID.
226
+ * @param keyId - The key identifier.
227
+ * @returns A validated {@link KeyInfo}.
228
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the key does not exist.
229
+ */
230
+ getKey(keyId: string): Promise<KeyInfo>;
231
+ /**
232
+ * Delete a cryptographic key from the wallet.
233
+ * @param keyId - The key identifier.
234
+ * @returns The deletion response.
235
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the key does not exist.
236
+ */
237
+ deleteKey(keyId: string): Promise<undefined>;
238
+ /**
239
+ * Set a key as the default signing key for this wallet.
240
+ * @param keyId - The key identifier to make default.
241
+ * @returns The update response.
242
+ */
243
+ setDefaultKey(keyId: string): Promise<undefined>;
244
+ /**
245
+ * Create a new credential offer for issuance to another party.
246
+ * @param request - The credential offer details.
247
+ * @returns A validated {@link CredentialOffer}.
248
+ */
249
+ createOffer(request: CredentialOfferRequest): Promise<CredentialOffer>;
250
+ /**
251
+ * Request a credential offer via the Decentralized Claims Protocol (DCP).
252
+ *
253
+ * This initiates the issuance flow by sending a credential request to
254
+ * a remote issuer using the DCP standard.
255
+ * @param request - The DCP credential request initiation details.
256
+ */
257
+ requestOfferViaDcp(request: DCPCredentialRequestInitiation): Promise<void>;
258
+ /**
259
+ * Get the status and details of a credential offer.
260
+ * @param id - The credential offer identifier.
261
+ * @returns A validated {@link CredentialOfferStatus}.
262
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the offer does not exist.
263
+ */
264
+ getOffer(id: string): Promise<CredentialOfferStatus>;
265
+ /**
266
+ * Revoke a credential offer, preventing it from being claimed.
267
+ * @param id - The credential offer identifier.
268
+ * @returns The revocation response.
269
+ */
270
+ revokeOffer(id: string): Promise<{
271
+ id: string;
272
+ createdDate: string;
273
+ preAuthorizedCode: string;
274
+ holderId?: string;
275
+ credentialType: string;
276
+ credentialId?: string;
277
+ revoked: boolean;
278
+ credentialSubject: {
279
+ id: string;
280
+ };
281
+ remoteId?: string;
282
+ } | undefined>;
283
+ }
284
+ export {};
285
+ //# sourceMappingURL=wallet.sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.sdk.d.ts","sourceRoot":"","sources":["../../src/wallet/wallet.sdk.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,384 @@
1
+ import { hasArray, hasBoolean, hasNumber, hasString, isObject, requireArrayResponse, requireObject, requireObjectResponse } from "../utils/shape-validation.js";
2
+ /**
3
+ * Manage cryptographic keys, verifiable credentials, DIDs, and credential
4
+ * issuance through the TSG Wallet.
5
+ *
6
+ * Requires `walletBaseUrl` to be set in the SDK configuration.
7
+ * @example
8
+ * ```ts
9
+ * const keys = await sdk.wallet.listKeys();
10
+ * const did = await sdk.wallet.getDidDocument();
11
+ * const signed = await sdk.wallet.signJwt({ body: payload, audience: "did:web:other" });
12
+ * ```
13
+ */
14
+ export class WalletSdk {
15
+ client;
16
+ constructor(client) {
17
+ this.client = client;
18
+ }
19
+ // ── Signing ────────────────────────────────────────────────────────────
20
+ /**
21
+ * Request a JWT signature from the wallet using a managed key.
22
+ * @param request - The signing request containing the JWT body, audience, key ID, etc.
23
+ * @returns A validated {@link SignedJwtResponse} containing the signed JWT.
24
+ */
25
+ async signJwt(request) {
26
+ const { data } = await this.client.POST("/management/signature/sign/jwt", {
27
+ body: request
28
+ });
29
+ return requireObjectResponse(data, "SignedJwtResponse", (value) => hasString(value, "jwt"));
30
+ }
31
+ /**
32
+ * Validate a JWT using the wallet's key material and trust configuration.
33
+ * @param request - The validation request containing the JWT string to verify.
34
+ * @returns The validation result.
35
+ */
36
+ async validateJwt(request) {
37
+ const { data } = await this.client.POST("/management/signature/validate/jwt", {
38
+ body: request
39
+ });
40
+ return requireObject(data, "JWT validation");
41
+ }
42
+ /**
43
+ * Create a VP-JWT from wallet credentials using the wallet's presentation service.
44
+ * @param request - Credential IDs and optional signing options for the presentation.
45
+ * @returns A validated {@link VerifiablePresentationJwt} containing the signed VP-JWT.
46
+ */
47
+ async createPresentationJwt(request) {
48
+ const { data } = await this.client.POST("/management/presentation/jwt", {
49
+ body: request
50
+ });
51
+ return requireObjectResponse(data, "VerifiablePresentationJwt", (value) => hasString(value, "vp"));
52
+ }
53
+ /**
54
+ * Store an immutable, versioned Presentation Definition for DCP scope resolution.
55
+ * @param scope - Scope alias, immutable revision metadata, and compiled definition.
56
+ * @returns The persisted wallet scope.
57
+ */
58
+ async addPresentationScope(scope) {
59
+ const { data } = await this.client.POST("/management/presentation/scopes", {
60
+ body: scope
61
+ });
62
+ return requireObjectResponse(data, "ScopeDto", isScope);
63
+ }
64
+ /**
65
+ * List presentation scopes, optionally selecting an immutable revision.
66
+ * @param alias - Optional scope alias filter.
67
+ * @param revision - Optional immutable revision filter.
68
+ * @returns The paginated wallet scope response.
69
+ */
70
+ async listPresentationScopes(alias, revision) {
71
+ const { data } = await this.client.GET("/management/presentation/scopes", {
72
+ params: {
73
+ query: {
74
+ ...(alias ? { alias } : {}),
75
+ ...(revision ? { revision } : {})
76
+ }
77
+ }
78
+ });
79
+ return requireObjectResponse(data, "ScopeDtoPage", (value) => hasNumber(value, "total") &&
80
+ hasArray(value, "data") &&
81
+ value.data.every((item) => isObject(item) && isScope(item)));
82
+ }
83
+ /**
84
+ * Verify a bitstring status-list entry through the wallet.
85
+ * @param request - Status-list credential URL and entry index.
86
+ * @returns The validated revocation or suspension status.
87
+ */
88
+ async verifyCredentialStatus(request) {
89
+ const { data } = await this.client.POST("/management/presentation/status", {
90
+ body: request
91
+ });
92
+ return requireObjectResponse(data, "VerifiedCredentialStatus", (value) => hasString(value, "statusListCredential") &&
93
+ hasString(value, "statusListIndex") &&
94
+ hasString(value, "statusPurpose") &&
95
+ hasBoolean(value, "status"));
96
+ }
97
+ // ── Credentials ────────────────────────────────────────────────────────
98
+ /**
99
+ * List all verifiable credentials stored in the wallet.
100
+ * @returns An array of credential objects.
101
+ */
102
+ async listCredentials() {
103
+ const { data } = await this.client.GET("/management/credentials");
104
+ return requireArrayResponse(data ?? [], "CredentialsDto[]", isCredentialRecord);
105
+ }
106
+ /**
107
+ * Issue a new credential within this wallet.
108
+ * @param credentialConfig - Wallet credential configuration.
109
+ * @returns The created credential record.
110
+ */
111
+ async addCredential(credentialConfig) {
112
+ const { data } = await this.client.POST("/management/credentials", {
113
+ body: credentialConfig
114
+ });
115
+ return requireObjectResponse(data, "CredentialsDto", isCredentialRecord);
116
+ }
117
+ /**
118
+ * Import an externally issued credential into this wallet.
119
+ * @param credential - Verifiable Credential document to import.
120
+ * @returns The imported credential record.
121
+ */
122
+ async importCredential(credential) {
123
+ const { data } = await this.client.POST("/management/credentials/import", {
124
+ body: credential
125
+ });
126
+ return requireObjectResponse(data, "CredentialsDto", isCredentialRecord);
127
+ }
128
+ /**
129
+ * Get a specific verifiable credential by its ID.
130
+ * @param credentialId - The credential identifier.
131
+ * @returns The credential object.
132
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the credential does not exist.
133
+ */
134
+ async getCredential(credentialId) {
135
+ const { data } = await this.client.GET("/management/credentials/{credentialId}", {
136
+ params: { path: { credentialId } }
137
+ });
138
+ return requireObjectResponse(data, "CredentialsDto", isCredentialRecord);
139
+ }
140
+ /**
141
+ * Delete a verifiable credential from the wallet.
142
+ * @param credentialId - The credential identifier.
143
+ * @returns The deletion response.
144
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the credential does not exist.
145
+ */
146
+ async deleteCredential(credentialId) {
147
+ const { data } = await this.client.DELETE("/management/credentials/{credentialId}", {
148
+ params: { path: { credentialId } }
149
+ });
150
+ return data;
151
+ }
152
+ /**
153
+ * Revoke a verifiable credential, making it invalid for future verification.
154
+ * @param credentialId - The credential identifier.
155
+ * @returns The revocation response.
156
+ */
157
+ async revokeCredential(credentialId) {
158
+ const { data } = await this.client.POST("/management/credentials/{credentialId}/revoke", {
159
+ params: { path: { credentialId } }
160
+ });
161
+ return data;
162
+ }
163
+ /**
164
+ * Get the credential configuration, including trust anchors and issuer settings.
165
+ * @returns The credential configuration object.
166
+ */
167
+ async getCredentialConfig() {
168
+ const { data } = await this.client.GET("/management/credentials/config");
169
+ return requireObject(data, "CredentialConfigDto");
170
+ }
171
+ /**
172
+ * List all dataspace-scoped verifiable credentials.
173
+ *
174
+ * Dataspace credentials are a subset of credentials specifically used
175
+ * for dataspace membership and trust establishment.
176
+ * @returns An array of dataspace credential objects.
177
+ */
178
+ async listDataspaceCredentials() {
179
+ const { data } = await this.client.GET("/management/credentials/dataspace");
180
+ return requireArrayResponse(data ?? [], "CredentialsDto[]", isCredentialRecord);
181
+ }
182
+ // ── DID Management ─────────────────────────────────────────────────────
183
+ /**
184
+ * Get the DID document of this wallet's identity.
185
+ * @returns A validated {@link DIDDocumentDto}.
186
+ */
187
+ async getDidDocument() {
188
+ const { data } = await this.client.GET("/management/did");
189
+ return requireObjectResponse(data, "DIDDocumentDto", (value) => hasString(value, "id"));
190
+ }
191
+ /**
192
+ * Get all DID services registered in the DID document.
193
+ * @returns An array of validated {@link ServiceDto} instances.
194
+ */
195
+ async getDidServices() {
196
+ const { data } = await this.client.GET("/management/did/services");
197
+ return requireArrayResponse(data ?? [], "ServiceDto[]", isServiceDto);
198
+ }
199
+ /**
200
+ * Register a new DID service in this wallet's DID document.
201
+ *
202
+ * Applications use this to advertise their own endpoints (an orchestration
203
+ * inbox, a connector address) so that peers can discover them by resolving
204
+ * the DID document instead of being configured with a static URL.
205
+ * @param service - Service identifier, type and endpoint.
206
+ * @returns A validated {@link ServiceDto} describing the registered service.
207
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.CONFLICT} if a service with the same id already exists.
208
+ */
209
+ async addDidService(service) {
210
+ const { data } = await this.client.POST("/management/did/services", {
211
+ body: service
212
+ });
213
+ return requireObjectResponse(data, "ServiceDto", isServiceDto);
214
+ }
215
+ /**
216
+ * Update an already registered DID service.
217
+ * @param id - Identifier of the service to update.
218
+ * @param service - The new service definition.
219
+ * @returns A validated {@link ServiceDto} describing the updated service.
220
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the service does not exist.
221
+ */
222
+ async updateDidService(id, service) {
223
+ const { data } = await this.client.PUT("/management/did/services/{id}", {
224
+ params: { path: { id } },
225
+ body: service
226
+ });
227
+ return requireObjectResponse(data, "ServiceDto", isServiceDto);
228
+ }
229
+ /**
230
+ * Remove a DID service from this wallet's DID document.
231
+ * @param id - Identifier of the service to remove.
232
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the service does not exist.
233
+ */
234
+ async removeDidService(id) {
235
+ await this.client.DELETE("/management/did/services/{id}", {
236
+ params: { path: { id } }
237
+ });
238
+ }
239
+ // ── Key Management ─────────────────────────────────────────────────────
240
+ /**
241
+ * List all cryptographic keys managed by the wallet.
242
+ * @returns An array of validated {@link KeyInfo} instances.
243
+ */
244
+ async listKeys() {
245
+ const { data } = await this.client.GET("/management/keys");
246
+ return requireArrayResponse(data ?? [], "KeyInfo[]", isKeyInfo);
247
+ }
248
+ /**
249
+ * Generate a new wallet key from the provided configuration.
250
+ * @param keyConfig - Wallet key configuration.
251
+ * @returns A validated {@link KeyInfo}.
252
+ */
253
+ async addKey(keyConfig) {
254
+ const { data } = await this.client.POST("/management/keys", {
255
+ body: keyConfig
256
+ });
257
+ return requireObjectResponse(data, "KeyInfo", isKeyInfo);
258
+ }
259
+ /**
260
+ * Get a specific key by its ID.
261
+ * @param keyId - The key identifier.
262
+ * @returns A validated {@link KeyInfo}.
263
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the key does not exist.
264
+ */
265
+ async getKey(keyId) {
266
+ const { data } = await this.client.GET("/management/keys/{keyId}", {
267
+ params: { path: { keyId } }
268
+ });
269
+ return requireObjectResponse(data, "KeyInfo", isKeyInfo);
270
+ }
271
+ /**
272
+ * Delete a cryptographic key from the wallet.
273
+ * @param keyId - The key identifier.
274
+ * @returns The deletion response.
275
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the key does not exist.
276
+ */
277
+ async deleteKey(keyId) {
278
+ const { data } = await this.client.DELETE("/management/keys/{keyId}", {
279
+ params: { path: { keyId } }
280
+ });
281
+ return data;
282
+ }
283
+ /**
284
+ * Set a key as the default signing key for this wallet.
285
+ * @param keyId - The key identifier to make default.
286
+ * @returns The update response.
287
+ */
288
+ async setDefaultKey(keyId) {
289
+ const { data } = await this.client.PUT("/management/keys/{keyId}/default", {
290
+ params: { path: { keyId } }
291
+ });
292
+ return data;
293
+ }
294
+ // ── Issuance ───────────────────────────────────────────────────────────
295
+ /**
296
+ * Create a new credential offer for issuance to another party.
297
+ * @param request - The credential offer details.
298
+ * @returns A validated {@link CredentialOffer}.
299
+ */
300
+ async createOffer(request) {
301
+ const { data } = await this.client.POST("/management/issuance/offers", {
302
+ body: request
303
+ });
304
+ return requireObjectResponse(data, "CredentialOffer", (value) => hasString(value, "credential_issuer") &&
305
+ hasArray(value, "credential_configuration_ids"));
306
+ }
307
+ /**
308
+ * Request a credential offer via the Decentralized Claims Protocol (DCP).
309
+ *
310
+ * This initiates the issuance flow by sending a credential request to
311
+ * a remote issuer using the DCP standard.
312
+ * @param request - The DCP credential request initiation details.
313
+ */
314
+ async requestOfferViaDcp(request) {
315
+ await this.client.POST("/management/issuance/request/dcp", {
316
+ body: request
317
+ });
318
+ }
319
+ /**
320
+ * Get the status and details of a credential offer.
321
+ * @param id - The credential offer identifier.
322
+ * @returns A validated {@link CredentialOfferStatus}.
323
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the offer does not exist.
324
+ */
325
+ async getOffer(id) {
326
+ const { data } = await this.client.GET("/management/issuance/offers/{id}", {
327
+ params: { path: { id } }
328
+ });
329
+ return requireObjectResponse(data, "CredentialOfferStatus", (value) => hasString(value, "id") &&
330
+ hasString(value, "credentialType") &&
331
+ hasBoolean(value, "revoked"));
332
+ }
333
+ /**
334
+ * Revoke a credential offer, preventing it from being claimed.
335
+ * @param id - The credential offer identifier.
336
+ * @returns The revocation response.
337
+ */
338
+ async revokeOffer(id) {
339
+ const { data } = await this.client.PUT("/management/issuance/offers/{id}/revoke", {
340
+ params: { path: { id } }
341
+ });
342
+ return data;
343
+ }
344
+ }
345
+ /**
346
+ * Check the required shape of a DID service entry.
347
+ * @param value - Candidate response object.
348
+ * @returns Whether the candidate has the required fields.
349
+ */
350
+ function isServiceDto(value) {
351
+ return hasString(value, "id") && hasString(value, "type");
352
+ }
353
+ /**
354
+ * Check the required shape of a wallet scope.
355
+ * @param value - Candidate response object.
356
+ * @returns Whether the candidate has the required fields.
357
+ */
358
+ function isScope(value) {
359
+ return (hasString(value, "id") &&
360
+ hasString(value, "alias") &&
361
+ hasString(value, "discriminator") &&
362
+ hasString(value, "description") &&
363
+ isObject(value.presentationDefinition));
364
+ }
365
+ /**
366
+ * Check the required shape of a wallet key.
367
+ * @param value - Candidate response object.
368
+ * @returns Whether the candidate has the required fields.
369
+ */
370
+ function isKeyInfo(value) {
371
+ return (hasString(value, "id") &&
372
+ ["EdDSA", "ES384", "X509"].includes(String(value.type)) &&
373
+ hasBoolean(value, "default") &&
374
+ isObject(value.publicKey));
375
+ }
376
+ /**
377
+ * Check the required shape of a wallet credential record.
378
+ * @param value - Candidate response object.
379
+ * @returns Whether the candidate contains a credential identifier.
380
+ */
381
+ function isCredentialRecord(value) {
382
+ return hasString(value, "id");
383
+ }
384
+ //# sourceMappingURL=wallet.sdk.js.map