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

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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +273 -2
  3. package/dist/.generated/control-plane.d.ts +7882 -0
  4. package/dist/.generated/sso-bridge.d.ts +3062 -0
  5. package/dist/.generated/wallet.d.ts +6350 -0
  6. package/dist/auth/auth.provider.d.ts +45 -0
  7. package/dist/auth/auth.provider.d.ts.map +1 -0
  8. package/dist/auth/auth.provider.js +158 -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 +1243 -0
  19. package/dist/browser.d.ts.map +1 -0
  20. package/dist/browser.js +215 -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 +107 -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 +81 -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 +17 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +24 -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 +111 -0
  51. package/dist/metadata/metadata.sdk.d.ts.map +1 -0
  52. package/dist/metadata/metadata.sdk.js +142 -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 +147 -0
  81. package/dist/sso/sso.sdk.js.map +1 -0
  82. package/dist/transfers/index.d.ts +2 -0
  83. package/dist/transfers/index.d.ts.map +1 -0
  84. package/dist/transfers/index.js +2 -0
  85. package/dist/transfers/index.js.map +1 -0
  86. package/dist/transfers/transfers.sdk.d.ts +155 -0
  87. package/dist/transfers/transfers.sdk.d.ts.map +1 -0
  88. package/dist/transfers/transfers.sdk.js +186 -0
  89. package/dist/transfers/transfers.sdk.js.map +1 -0
  90. package/dist/tsg-sdk.d.ts +65 -0
  91. package/dist/tsg-sdk.d.ts.map +1 -0
  92. package/dist/tsg-sdk.js +128 -0
  93. package/dist/tsg-sdk.js.map +1 -0
  94. package/dist/utils/errors.d.ts +67 -0
  95. package/dist/utils/errors.d.ts.map +1 -0
  96. package/dist/utils/errors.js +79 -0
  97. package/dist/utils/errors.js.map +1 -0
  98. package/dist/utils/index.d.ts +4 -0
  99. package/dist/utils/index.d.ts.map +1 -0
  100. package/dist/utils/index.js +4 -0
  101. package/dist/utils/index.js.map +1 -0
  102. package/dist/utils/polling.d.ts +20 -0
  103. package/dist/utils/polling.d.ts.map +1 -0
  104. package/dist/utils/polling.js +35 -0
  105. package/dist/utils/polling.js.map +1 -0
  106. package/dist/utils/shape-validation.d.ts +59 -0
  107. package/dist/utils/shape-validation.d.ts.map +1 -0
  108. package/dist/utils/shape-validation.js +85 -0
  109. package/dist/utils/shape-validation.js.map +1 -0
  110. package/dist/utils/validate.d.ts +47 -0
  111. package/dist/utils/validate.d.ts.map +1 -0
  112. package/dist/utils/validate.js +68 -0
  113. package/dist/utils/validate.js.map +1 -0
  114. package/dist/vendor/common-dtos/abac.policy.d.ts +60 -0
  115. package/dist/vendor/common-dtos/abac.policy.js +2 -0
  116. package/dist/vendor/common-dtos/audit.types.d.ts +74 -0
  117. package/dist/vendor/common-dtos/audit.types.js +9 -0
  118. package/dist/vendor/common-dtos/credential-requirements.d.ts +19 -0
  119. package/dist/vendor/common-dtos/credential-requirements.dto.d.ts +47 -0
  120. package/dist/vendor/common-dtos/credential-requirements.dto.js +251 -0
  121. package/dist/vendor/common-dtos/credential-requirements.js +181 -0
  122. package/dist/vendor/common-dtos/dataplane.dto.d.ts +6 -0
  123. package/dist/vendor/common-dtos/dataplane.dto.js +29 -0
  124. package/dist/vendor/common-dtos/dcp.dto.d.ts +90 -0
  125. package/dist/vendor/common-dtos/dcp.dto.js +490 -0
  126. package/dist/vendor/common-dtos/dcql.dto.d.ts +89 -0
  127. package/dist/vendor/common-dtos/dcql.dto.js +450 -0
  128. package/dist/vendor/common-dtos/did.schemas.d.ts +40 -0
  129. package/dist/vendor/common-dtos/did.schemas.js +260 -0
  130. package/dist/vendor/common-dtos/index.d.ts +19 -0
  131. package/dist/vendor/common-dtos/index.js +19 -0
  132. package/dist/vendor/common-dtos/metadata.dto.d.ts +6 -0
  133. package/dist/vendor/common-dtos/metadata.dto.js +30 -0
  134. package/dist/vendor/common-dtos/negotiations.dto.d.ts +29 -0
  135. package/dist/vendor/common-dtos/negotiations.dto.js +205 -0
  136. package/dist/vendor/common-dtos/permissions.d.ts +237 -0
  137. package/dist/vendor/common-dtos/permissions.js +337 -0
  138. package/dist/vendor/common-dtos/presentation.request.dto.d.ts +9 -0
  139. package/dist/vendor/common-dtos/presentation.request.dto.js +55 -0
  140. package/dist/vendor/common-dtos/presentation.status.dto.d.ts +13 -0
  141. package/dist/vendor/common-dtos/presentation.status.dto.js +83 -0
  142. package/dist/vendor/common-dtos/presentationdefinition.dto.d.ts +75 -0
  143. package/dist/vendor/common-dtos/presentationdefinition.dto.js +448 -0
  144. package/dist/vendor/common-dtos/signatures.dto.d.ts +32 -0
  145. package/dist/vendor/common-dtos/signatures.dto.js +210 -0
  146. package/dist/vendor/common-dtos/transfer.dto.d.ts +17 -0
  147. package/dist/vendor/common-dtos/transfer.dto.js +102 -0
  148. package/dist/vendor/common-dtos/utils.swagger.d.ts +13 -0
  149. package/dist/vendor/common-dtos/utils.swagger.js +63 -0
  150. package/dist/vendor/control-plane-dtos/index.d.ts +5 -0
  151. package/dist/vendor/control-plane-dtos/index.js +5 -0
  152. package/dist/vendor/control-plane-dtos/registry/registry.dto.d.ts +5 -0
  153. package/dist/vendor/control-plane-dtos/registry/registry.dto.js +26 -0
  154. package/dist/vendor/control-plane-dtos/registry/registry.search.dto.d.ts +29 -0
  155. package/dist/vendor/control-plane-dtos/registry/registry.search.dto.js +127 -0
  156. package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.d.ts +10 -0
  157. package/dist/vendor/control-plane-dtos/ssi/verifiablePresentations.dto.js +44 -0
  158. package/dist/vendor/control-plane-dtos/status/status.dto.d.ts +38 -0
  159. package/dist/vendor/control-plane-dtos/status/status.dto.js +173 -0
  160. package/dist/vendor/sso-bridge-dtos/clients.dto.d.ts +22 -0
  161. package/dist/vendor/sso-bridge-dtos/clients.dto.js +113 -0
  162. package/dist/vendor/sso-bridge-dtos/grants.d.ts +3 -0
  163. package/dist/vendor/sso-bridge-dtos/grants.js +2 -0
  164. package/dist/vendor/sso-bridge-dtos/index.d.ts +5 -0
  165. package/dist/vendor/sso-bridge-dtos/index.js +5 -0
  166. package/dist/vendor/sso-bridge-dtos/users.dto.d.ts +24 -0
  167. package/dist/vendor/sso-bridge-dtos/users.dto.js +90 -0
  168. package/dist/vendor/wallet-dtos/clients.dto.d.ts +22 -0
  169. package/dist/vendor/wallet-dtos/clients.dto.js +14 -0
  170. package/dist/vendor/wallet-dtos/credentials.dto.d.ts +32 -0
  171. package/dist/vendor/wallet-dtos/credentials.dto.js +47 -0
  172. package/dist/vendor/wallet-dtos/index.d.ts +7 -0
  173. package/dist/vendor/wallet-dtos/index.js +7 -0
  174. package/dist/vendor/wallet-dtos/issuance.dto.d.ts +238 -0
  175. package/dist/vendor/wallet-dtos/issuance.dto.js +1140 -0
  176. package/dist/vendor/wallet-dtos/scopes.dto.d.ts +25 -0
  177. package/dist/vendor/wallet-dtos/scopes.dto.js +152 -0
  178. package/dist/vendor/wallet-dtos/status.dto.d.ts +36 -0
  179. package/dist/vendor/wallet-dtos/status.dto.js +170 -0
  180. package/dist/vendor/wallet-dtos/utils/schema-converter.d.ts +14 -0
  181. package/dist/vendor/wallet-dtos/utils/schema-converter.js +43 -0
  182. package/dist/wallet/index.d.ts +2 -0
  183. package/dist/wallet/index.d.ts.map +1 -0
  184. package/dist/wallet/index.js +2 -0
  185. package/dist/wallet/index.js.map +1 -0
  186. package/dist/wallet/wallet.sdk.d.ts +285 -0
  187. package/dist/wallet/wallet.sdk.d.ts.map +1 -0
  188. package/dist/wallet/wallet.sdk.js +384 -0
  189. package/dist/wallet/wallet.sdk.js.map +1 -0
  190. package/package.json +78 -3
@@ -0,0 +1,152 @@
1
+ import { ClientDto, UserDto } from "../vendor/sso-bridge-dtos/index.js";
2
+ import { validateResponse, validateResponseArray } from "../utils/validate.js";
3
+ /**
4
+ * Manage SSO Bridge users, OAuth clients, and permissions.
5
+ *
6
+ * Accessible via {@link SsoSdk.management}.
7
+ * @example
8
+ * ```ts
9
+ * const users = await sdk.sso.management.getUsers({ page: 1, perPage: 10 });
10
+ * const newClient = await sdk.sso.management.createClient({
11
+ * name: "my-app",
12
+ * redirectUris: ["http://localhost:3000/callback"],
13
+ * });
14
+ * ```
15
+ */
16
+ export class SsoManagementSdk {
17
+ client;
18
+ constructor(client) {
19
+ this.client = client;
20
+ }
21
+ // ── Users ──────────────────────────────────────────────────────────────
22
+ /**
23
+ * List SSO users with optional pagination.
24
+ * @param options - Pagination and sorting options.
25
+ * @returns An array of validated {@link UserDto} instances.
26
+ */
27
+ async getUsers(options) {
28
+ const { data } = await this.client.GET("/users", {
29
+ params: {
30
+ query: {
31
+ page: options?.page,
32
+ per_page: options?.perPage,
33
+ order: options?.order,
34
+ order_by: options?.orderBy
35
+ }
36
+ }
37
+ });
38
+ return validateResponseArray(UserDto, data ?? []);
39
+ }
40
+ /**
41
+ * Create a new SSO user.
42
+ * @param user - The user details.
43
+ * @returns The created {@link UserDto}.
44
+ */
45
+ async createUser(user) {
46
+ const { data } = await this.client.POST("/users/create", {
47
+ body: user
48
+ });
49
+ return validateResponse(UserDto, data);
50
+ }
51
+ /**
52
+ * Update an existing SSO user.
53
+ * @param id - The user ID.
54
+ * @param user - The fields to update.
55
+ * @returns The updated {@link UserDto}.
56
+ */
57
+ async updateUser(id, user) {
58
+ const { data } = await this.client.PATCH("/users/update/{id}", {
59
+ params: { path: { id } },
60
+ body: user
61
+ });
62
+ return validateResponse(UserDto, data);
63
+ }
64
+ /**
65
+ * Delete an SSO user.
66
+ * @param id - The user ID.
67
+ * @returns The deletion response.
68
+ */
69
+ async deleteUser(id) {
70
+ const { data } = await this.client.DELETE("/users/{id}", {
71
+ params: { path: { id } }
72
+ });
73
+ return data;
74
+ }
75
+ /**
76
+ * Reset two-factor authentication for an SSO user.
77
+ *
78
+ * The user will need to re-enroll in 2FA on their next login.
79
+ * @param id - The user ID.
80
+ * @returns The reset response.
81
+ */
82
+ async resetUser2FA(id) {
83
+ const { data } = await this.client.POST("/users/{id}/reset-2fa", {
84
+ params: { path: { id } }
85
+ });
86
+ return data;
87
+ }
88
+ // ── Clients ────────────────────────────────────────────────────────────
89
+ /**
90
+ * List OAuth clients with optional pagination.
91
+ * @param options - Pagination and sorting options.
92
+ * @returns An array of validated {@link ClientDto} instances.
93
+ */
94
+ async getClients(options) {
95
+ const { data } = await this.client.GET("/clients", {
96
+ params: {
97
+ query: {
98
+ page: options?.page,
99
+ per_page: options?.perPage,
100
+ order: options?.order,
101
+ order_by: options?.orderBy
102
+ }
103
+ }
104
+ });
105
+ return validateResponseArray(ClientDto, data ?? []);
106
+ }
107
+ /**
108
+ * Register a new OAuth client.
109
+ * @param client - The client details including name and redirect URIs.
110
+ * @returns The created {@link ClientDto}.
111
+ */
112
+ async createClient(client) {
113
+ const { data } = await this.client.POST("/clients/create", {
114
+ body: client
115
+ });
116
+ return validateResponse(ClientDto, data);
117
+ }
118
+ /**
119
+ * Update an existing OAuth client.
120
+ * @param id - The client ID.
121
+ * @param client - The fields to update.
122
+ * @returns The updated {@link ClientDto}.
123
+ */
124
+ async updateClient(id, client) {
125
+ const { data } = await this.client.PATCH("/clients/update/{id}", {
126
+ params: { path: { id } },
127
+ body: client
128
+ });
129
+ return validateResponse(ClientDto, data);
130
+ }
131
+ /**
132
+ * Delete an OAuth client.
133
+ * @param id - The client ID.
134
+ * @returns The deletion response.
135
+ */
136
+ async deleteClient(id) {
137
+ const { data } = await this.client.DELETE("/clients/{id}", {
138
+ params: { path: { id } }
139
+ });
140
+ return data;
141
+ }
142
+ // ── Permissions ────────────────────────────────────────────────────────
143
+ /**
144
+ * Get all available permissions in the SSO system.
145
+ * @returns The permissions configuration.
146
+ */
147
+ async getPermissions() {
148
+ const { data } = await this.client.GET("/permissions");
149
+ return data;
150
+ }
151
+ }
152
+ //# sourceMappingURL=sso-management.sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sso-management.sdk.js","sourceRoot":"","sources":["../../src/sso/sso-management.sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKT,OAAO,EACR,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAgB/E;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;IAAG,CAAC;IAExD,0EAA0E;IAE1E;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,OAA2B;QACxC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC/C,MAAM,EAAE;gBACN,KAAK,EAAE;oBACL,IAAI,EAAE,OAAO,EAAE,IAAI;oBACnB,QAAQ,EAAE,OAAO,EAAE,OAAO;oBAC1B,KAAK,EAAE,OAA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AAE,EAAE,EAAE,EAAE;SACzB,CAAC,CAAC;QACH,OAAO,IAAK,CAAC;IACf,CAAC;IAED,0EAA0E;IAE1E;;;OAGG;IACH,KAAK,CAAC,cAAc;QAClB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACvD,OAAO,IAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,75 @@
1
+ import type { OpenIDConfiguration, TokenResponse } from "../auth/auth.types.js";
2
+ import type { SsoBridgeClient } from "../client.js";
3
+ import type { TsgSdkAuthConfig } from "../config/sdk.config.js";
4
+ import { SsoManagementSdk } from "./sso-management.sdk.js";
5
+ /**
6
+ * OpenID Connect integration, token management, and user/client administration
7
+ * via the TSG SSO Bridge.
8
+ *
9
+ * Requires `ssoBridgeBaseUrl` to be set in the SDK configuration.
10
+ *
11
+ * This module provides:
12
+ * - Access token acquisition and refresh using OIDC flows.
13
+ * - Authorization code exchange (with optional PKCE).
14
+ * - OpenID discovery and JWKS retrieval.
15
+ * - User and OAuth client management via the {@link SsoManagementSdk | management} sub-module.
16
+ * @example
17
+ * ```ts
18
+ * const token = await sdk.sso.getAccessToken();
19
+ * const users = await sdk.sso.management.getUsers();
20
+ * ```
21
+ */
22
+ export declare class SsoSdk {
23
+ private readonly ssoBridgeBaseUrl;
24
+ private readonly authProvider;
25
+ /** User and OAuth client management operations. */
26
+ readonly management: SsoManagementSdk;
27
+ constructor(ssoBridgeBaseUrl: string, authConfig?: TsgSdkAuthConfig, ssoBridgeClient?: SsoBridgeClient);
28
+ /**
29
+ * Get an access token from the SSO bridge using the configured authentication method.
30
+ * @returns The access token string.
31
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.AUTH_FAILED} if no auth configuration is provided or token acquisition fails.
32
+ */
33
+ getAccessToken(): Promise<string>;
34
+ /**
35
+ * Fetch the OpenID Connect discovery document from the SSO bridge.
36
+ *
37
+ * The `.well-known/openid-configuration` endpoint is always resolved at
38
+ * the server origin, regardless of any path prefix in `ssoBridgeBaseUrl`.
39
+ * @returns The parsed {@link OpenIDConfiguration}.
40
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.REQUEST_FAILED} if the discovery request fails.
41
+ */
42
+ getOpenIdConfiguration(): Promise<OpenIDConfiguration>;
43
+ /**
44
+ * Fetch the JSON Web Key Set (JWKS) from the SSO bridge.
45
+ *
46
+ * The JWKS URI is discovered automatically via the OpenID configuration.
47
+ * These keys can be used to verify tokens issued by the SSO bridge.
48
+ * @returns An object containing an array of {@link JsonWebKey} entries.
49
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.REQUEST_FAILED} if the JWKS fetch fails.
50
+ */
51
+ getJwks(): Promise<{
52
+ keys: JsonWebKey[];
53
+ }>;
54
+ /**
55
+ * Exchange an OAuth 2.0 authorization code for access and refresh tokens.
56
+ *
57
+ * Supports PKCE by accepting an optional `codeVerifier`.
58
+ * @param code - The authorization code received from the authorization endpoint.
59
+ * @param redirectUri - The redirect URI that was used in the original authorization request.
60
+ * @param clientId - The OAuth client ID.
61
+ * @param codeVerifier - Optional PKCE code verifier for public clients.
62
+ * @returns A {@link TokenResponse} containing the access token and optional refresh token.
63
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.AUTH_FAILED} if the exchange fails.
64
+ */
65
+ exchangeAuthorizationCode(code: string, redirectUri: string, clientId: string, codeVerifier?: string): Promise<TokenResponse>;
66
+ /**
67
+ * Refresh an access token using an OAuth 2.0 refresh token.
68
+ * @param refreshToken - The refresh token.
69
+ * @param clientId - The OAuth client ID.
70
+ * @returns A {@link TokenResponse} containing the new access token.
71
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.AUTH_FAILED} if the refresh fails.
72
+ */
73
+ refreshAccessToken(refreshToken: string, clientId: string): Promise<TokenResponse>;
74
+ }
75
+ //# sourceMappingURL=sso.sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sso.sdk.d.ts","sourceRoot":"","sources":["../../src/sso/sso.sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,MAAM;IAMf,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IALnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,mDAAmD;IACnD,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;gBAGnB,gBAAgB,EAAE,MAAM,EACzC,UAAU,CAAC,EAAE,gBAAgB,EAC7B,eAAe,CAAC,EAAE,eAAe;IAoBnC;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAWvC;;;;;;;OAOG;IACG,sBAAsB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAe5D;;;;;;;OAOG;IACG,OAAO,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAahD;;;;;;;;;;OAUG;IACG,yBAAyB,CAC7B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,CAAC;IA6BzB;;;;;;OAMG;IACG,kBAAkB,CACtB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC;CAwB1B"}
@@ -0,0 +1,147 @@
1
+ import { AuthProvider } from "../auth/auth.provider.js";
2
+ import { SdkError, SdkErrorCode } from "../utils/errors.js";
3
+ import { SsoManagementSdk } from "./sso-management.sdk.js";
4
+ /**
5
+ * OpenID Connect integration, token management, and user/client administration
6
+ * via the TSG SSO Bridge.
7
+ *
8
+ * Requires `ssoBridgeBaseUrl` to be set in the SDK configuration.
9
+ *
10
+ * This module provides:
11
+ * - Access token acquisition and refresh using OIDC flows.
12
+ * - Authorization code exchange (with optional PKCE).
13
+ * - OpenID discovery and JWKS retrieval.
14
+ * - User and OAuth client management via the {@link SsoManagementSdk | management} sub-module.
15
+ * @example
16
+ * ```ts
17
+ * const token = await sdk.sso.getAccessToken();
18
+ * const users = await sdk.sso.management.getUsers();
19
+ * ```
20
+ */
21
+ export class SsoSdk {
22
+ ssoBridgeBaseUrl;
23
+ authProvider;
24
+ /** User and OAuth client management operations. */
25
+ management;
26
+ constructor(ssoBridgeBaseUrl, authConfig, ssoBridgeClient) {
27
+ this.ssoBridgeBaseUrl = ssoBridgeBaseUrl;
28
+ this.authProvider = new AuthProvider(authConfig, ssoBridgeBaseUrl);
29
+ if (ssoBridgeClient) {
30
+ this.management = new SsoManagementSdk(ssoBridgeClient);
31
+ }
32
+ else {
33
+ this.management = new Proxy({}, {
34
+ get(_target, prop) {
35
+ if (typeof prop === "symbol")
36
+ return undefined;
37
+ return () => {
38
+ throw new SdkError("SSO management client not available. This should not happen when ssoBridgeBaseUrl is configured.", SdkErrorCode.NOT_CONFIGURED);
39
+ };
40
+ }
41
+ });
42
+ }
43
+ }
44
+ /**
45
+ * Get an access token from the SSO bridge using the configured authentication method.
46
+ * @returns The access token string.
47
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.AUTH_FAILED} if no auth configuration is provided or token acquisition fails.
48
+ */
49
+ async getAccessToken() {
50
+ const token = await this.authProvider.getAccessToken();
51
+ if (!token) {
52
+ throw new SdkError("No auth configuration provided", SdkErrorCode.AUTH_FAILED);
53
+ }
54
+ return token;
55
+ }
56
+ /**
57
+ * Fetch the OpenID Connect discovery document from the SSO bridge.
58
+ *
59
+ * The `.well-known/openid-configuration` endpoint is always resolved at
60
+ * the server origin, regardless of any path prefix in `ssoBridgeBaseUrl`.
61
+ * @returns The parsed {@link OpenIDConfiguration}.
62
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.REQUEST_FAILED} if the discovery request fails.
63
+ */
64
+ async getOpenIdConfiguration() {
65
+ // .well-known is always at the server root, not under any API prefix
66
+ const origin = new URL(this.ssoBridgeBaseUrl).origin;
67
+ const url = `${origin}/.well-known/openid-configuration`;
68
+ const response = await fetch(url);
69
+ if (!response.ok) {
70
+ throw new SdkError(`Failed to fetch OpenID configuration (${response.status})`, SdkErrorCode.REQUEST_FAILED, response.status);
71
+ }
72
+ return response.json();
73
+ }
74
+ /**
75
+ * Fetch the JSON Web Key Set (JWKS) from the SSO bridge.
76
+ *
77
+ * The JWKS URI is discovered automatically via the OpenID configuration.
78
+ * These keys can be used to verify tokens issued by the SSO bridge.
79
+ * @returns An object containing an array of {@link JsonWebKey} entries.
80
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.REQUEST_FAILED} if the JWKS fetch fails.
81
+ */
82
+ async getJwks() {
83
+ const config = await this.getOpenIdConfiguration();
84
+ const response = await fetch(config.jwks_uri);
85
+ if (!response.ok) {
86
+ throw new SdkError(`Failed to fetch JWKS (${response.status})`, SdkErrorCode.REQUEST_FAILED, response.status);
87
+ }
88
+ return response.json();
89
+ }
90
+ /**
91
+ * Exchange an OAuth 2.0 authorization code for access and refresh tokens.
92
+ *
93
+ * Supports PKCE by accepting an optional `codeVerifier`.
94
+ * @param code - The authorization code received from the authorization endpoint.
95
+ * @param redirectUri - The redirect URI that was used in the original authorization request.
96
+ * @param clientId - The OAuth client ID.
97
+ * @param codeVerifier - Optional PKCE code verifier for public clients.
98
+ * @returns A {@link TokenResponse} containing the access token and optional refresh token.
99
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.AUTH_FAILED} if the exchange fails.
100
+ */
101
+ async exchangeAuthorizationCode(code, redirectUri, clientId, codeVerifier) {
102
+ const config = await this.getOpenIdConfiguration();
103
+ const params = new URLSearchParams();
104
+ params.set("grant_type", "authorization_code");
105
+ params.set("code", code);
106
+ params.set("redirect_uri", redirectUri);
107
+ params.set("client_id", clientId);
108
+ if (codeVerifier) {
109
+ params.set("code_verifier", codeVerifier);
110
+ }
111
+ const response = await fetch(config.token_endpoint, {
112
+ method: "POST",
113
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
114
+ body: params.toString()
115
+ });
116
+ if (!response.ok) {
117
+ const body = await response.text().catch(() => "");
118
+ throw new SdkError(`Authorization code exchange failed (${response.status}): ${body}`, SdkErrorCode.AUTH_FAILED, response.status);
119
+ }
120
+ return response.json();
121
+ }
122
+ /**
123
+ * Refresh an access token using an OAuth 2.0 refresh token.
124
+ * @param refreshToken - The refresh token.
125
+ * @param clientId - The OAuth client ID.
126
+ * @returns A {@link TokenResponse} containing the new access token.
127
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.AUTH_FAILED} if the refresh fails.
128
+ */
129
+ async refreshAccessToken(refreshToken, clientId) {
130
+ const config = await this.getOpenIdConfiguration();
131
+ const params = new URLSearchParams();
132
+ params.set("grant_type", "refresh_token");
133
+ params.set("refresh_token", refreshToken);
134
+ params.set("client_id", clientId);
135
+ const response = await fetch(config.token_endpoint, {
136
+ method: "POST",
137
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
138
+ body: params.toString()
139
+ });
140
+ if (!response.ok) {
141
+ const body = await response.text().catch(() => "");
142
+ throw new SdkError(`Token refresh failed (${response.status}): ${body}`, SdkErrorCode.AUTH_FAILED, response.status);
143
+ }
144
+ return response.json();
145
+ }
146
+ }
147
+ //# sourceMappingURL=sso.sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sso.sdk.js","sourceRoot":"","sources":["../../src/sso/sso.sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIxD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAA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EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YACnD,MAAM,IAAI,QAAQ,CAChB,yBAAyB,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,EACpD,YAAY,CAAC,WAAW,EACxB,QAAQ,CAAC,MAAM,CAChB,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from "./transfers.sdk.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transfers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./transfers.sdk.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transfers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,155 @@
1
+ import { DataPlaneAddressDto, TransferDetailDto, TransferProcess, TransferProcessDto } from "@tsg-dsp/common-dsp";
2
+ import type { ControlPlaneClient } from "../client.js";
3
+ import type { PollingOptions } from "../utils/polling.js";
4
+ /**
5
+ * Request, monitor, and control Dataspace Protocol data transfer processes.
6
+ *
7
+ * A transfer process follows the DSP state machine:
8
+ * `REQUESTED → STARTED → COMPLETED` (or `SUSPENDED` / `TERMINATED`).
9
+ *
10
+ * This module provides methods to:
11
+ * - Initiate transfers under an existing contract agreement.
12
+ * - Start, complete, suspend, or terminate transfers.
13
+ * - Poll for state transitions (e.g. wait until a transfer has started).
14
+ * @example
15
+ * ```ts
16
+ * const transfer = await sdk.transfers.transferAndWaitForStart(
17
+ * agreementId,
18
+ * participantId,
19
+ * remoteAddress,
20
+ * "application/json",
21
+ * );
22
+ * console.log(transfer.state); // "STARTED"
23
+ * ```
24
+ */
25
+ export declare class TransferSdk {
26
+ private readonly client;
27
+ constructor(client: ControlPlaneClient);
28
+ /**
29
+ * List all transfer processes known to the control plane.
30
+ * @returns An array of validated {@link TransferDetailDto} instances.
31
+ */
32
+ listTransfers(): Promise<TransferDetailDto[]>;
33
+ /**
34
+ * Initiate a new data transfer under an existing contract agreement.
35
+ * @param agreementId - The agreement ID that authorizes this transfer.
36
+ * @param participantId - The remote participant's ID (DID), used as audience.
37
+ * @param remoteAddress - The remote participant's DSP protocol endpoint.
38
+ * @param format - The desired transfer format (e.g. `"application/json"`).
39
+ * @param returnDto - When `true`, returns the raw {@link TransferProcessDto}.
40
+ * @returns The created {@link TransferProcess} (or raw DTO).
41
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.REQUEST_FAILED} if the request is rejected.
42
+ */
43
+ requestTransfer(agreementId: string, participantId: string, remoteAddress: string, format: string, returnDto: true): Promise<TransferProcessDto>;
44
+ requestTransfer(agreementId: string, participantId: string, remoteAddress: string, format: string, returnDto?: false): Promise<TransferProcess>;
45
+ /**
46
+ * List the dataflows tracked for a transfer process.
47
+ *
48
+ * Each dataflow represents the data plane's execution of the transfer, with
49
+ * its own signaling state (`PREPARED`, `STARTED`, …) and pull address.
50
+ * @param processId - The transfer process ID.
51
+ * @returns The dataflows tracked for the transfer.
52
+ */
53
+ getTransferDataflows(processId: string): Promise<{
54
+ id: string;
55
+ transferProcessId: string;
56
+ dataPlaneId: string;
57
+ datasetId?: string | undefined;
58
+ state: "INITIALIZED" | "PREPARING" | "PREPARED" | "STARTING" | "STARTED" | "SUSPENDED" | "COMPLETED" | "TERMINATED";
59
+ dataAddress?: {
60
+ endpoint: string;
61
+ properties: {
62
+ name: string;
63
+ value: string;
64
+ }[];
65
+ } | undefined;
66
+ }[]>;
67
+ /**
68
+ * Get the details of a transfer process by its process ID.
69
+ * @param processId - The unique transfer process ID.
70
+ * @returns A validated {@link TransferDetailDto}.
71
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.NOT_FOUND} if the transfer does not exist.
72
+ */
73
+ getTransfer(processId: string): Promise<TransferDetailDto>;
74
+ /**
75
+ * Start a transfer process (provider-side).
76
+ *
77
+ * Transitions the transfer from `REQUESTED` to `STARTED`.
78
+ * @param processId - The transfer process ID.
79
+ * @param dataAddress - Optional data plane address to use for the transfer.
80
+ * @returns The start response.
81
+ */
82
+ startTransfer(processId: string, dataAddress?: DataPlaneAddressDto): Promise<{
83
+ status?: string | undefined;
84
+ }>;
85
+ /**
86
+ * Mark a transfer process as completed.
87
+ * @param processId - The transfer process ID.
88
+ * @returns The completion response.
89
+ */
90
+ completeTransfer(processId: string): Promise<{
91
+ status?: string | undefined;
92
+ }>;
93
+ /**
94
+ * Terminate a transfer process.
95
+ * @param processId - The transfer process ID.
96
+ * @param code - Optional machine-readable termination reason code.
97
+ * @param reason - Optional human-readable termination reason.
98
+ * @returns The termination response.
99
+ */
100
+ terminateTransfer(processId: string, code?: string, reason?: string): Promise<{}>;
101
+ /**
102
+ * Suspend a transfer process.
103
+ *
104
+ * A suspended transfer can later be resumed or terminated.
105
+ * @param processId - The transfer process ID.
106
+ * @param reason - Optional human-readable suspension reason.
107
+ * @returns The suspension response.
108
+ */
109
+ suspendTransfer(processId: string, reason?: string): Promise<{
110
+ status?: string | undefined;
111
+ }>;
112
+ /**
113
+ * Poll until a transfer reaches the given target state.
114
+ * @param processId - The transfer process ID.
115
+ * @param targetState - The desired state (e.g. `"STARTED"`, `"COMPLETED"`).
116
+ * @param options - Polling interval and retry configuration.
117
+ * @returns The {@link TransferDetailDto} once the target state is reached.
118
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.POLLING_TIMEOUT} if the state is not reached within the configured retries.
119
+ */
120
+ waitForState(processId: string, targetState: TransferDetailDto["state"], options?: PollingOptions): Promise<TransferDetailDto>;
121
+ /**
122
+ * Poll until a transfer reaches the `STARTED` state.
123
+ *
124
+ * Shorthand for `waitForState(processId, "STARTED", options)`.
125
+ * @param processId - The transfer process ID.
126
+ * @param options - Polling interval and retry configuration.
127
+ * @returns The {@link TransferDetailDto} with `state === "STARTED"`.
128
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.POLLING_TIMEOUT} if the state is not reached in time.
129
+ */
130
+ waitForStart(processId: string, options?: PollingOptions): Promise<TransferDetailDto>;
131
+ /**
132
+ * Poll until a transfer reaches the `COMPLETED` state.
133
+ *
134
+ * Shorthand for `waitForState(processId, "COMPLETED", options)`.
135
+ * @param processId - The transfer process ID.
136
+ * @param options - Polling interval and retry configuration.
137
+ * @returns The {@link TransferDetailDto} with `state === "COMPLETED"`.
138
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.POLLING_TIMEOUT} if the state is not reached in time.
139
+ */
140
+ waitForCompletion(processId: string, options?: PollingOptions): Promise<TransferDetailDto>;
141
+ /**
142
+ * Initiate a transfer and wait for it to start in one call.
143
+ *
144
+ * Combines {@link requestTransfer} and {@link waitForStart}.
145
+ * @param agreementId - The agreement ID that authorizes this transfer.
146
+ * @param participantId - The remote participant's ID (DID).
147
+ * @param remoteAddress - The remote participant's DSP protocol endpoint.
148
+ * @param format - The desired transfer format.
149
+ * @param pollingOptions - Optional polling configuration.
150
+ * @returns The {@link TransferDetailDto} once the transfer has started.
151
+ * @throws Throws an {@link SdkError} with code {@link SdkErrorCode.POLLING_TIMEOUT} if the transfer does not start in time.
152
+ */
153
+ transferAndWaitForStart(agreementId: string, participantId: string, remoteAddress: string, format: string, pollingOptions?: PollingOptions): Promise<TransferDetailDto>;
154
+ }
155
+ //# sourceMappingURL=transfers.sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfers.sdk.d.ts","sourceRoot":"","sources":["../../src/transfers/transfers.sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAA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