@enfuce/nextgen-sdk 0.0.7 → 0.0.9

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 (107) hide show
  1. package/README.md +209 -27
  2. package/dist/authorisation-control/api.d.ts +0 -56
  3. package/dist/authorisation-control/api.js +1 -115
  4. package/dist/authorisation-control/index.d.ts +0 -1
  5. package/dist/authorisation-control/index.js +0 -1
  6. package/dist/card/api.js +12 -12
  7. package/dist/card/client.d.ts +2 -2
  8. package/dist/cardholder/api.js +5 -5
  9. package/dist/cardholder/client.d.ts +2 -2
  10. package/dist/cards/client.d.ts +2 -2
  11. package/dist/esm/authorisation-control/api.d.ts +0 -56
  12. package/dist/esm/authorisation-control/api.js +0 -110
  13. package/dist/esm/authorisation-control/index.d.ts +0 -1
  14. package/dist/esm/authorisation-control/index.js +0 -1
  15. package/dist/esm/card/api.js +12 -12
  16. package/dist/esm/card/client.d.ts +2 -2
  17. package/dist/esm/cardholder/api.js +5 -5
  18. package/dist/esm/cardholder/client.d.ts +2 -2
  19. package/dist/esm/cards/client.d.ts +2 -2
  20. package/dist/esm/exchange-rate/client.d.ts +2 -2
  21. package/dist/esm/issuer-events/api.d.ts +0 -120
  22. package/dist/esm/issuer-events/api.js +0 -241
  23. package/dist/esm/issuer-events/index.d.ts +0 -1
  24. package/dist/esm/issuer-events/index.js +0 -1
  25. package/dist/esm/oauth/axios.d.ts +3 -3
  26. package/dist/esm/oauth/axios.js +1 -1
  27. package/dist/esm/oauth/clientCredentials.d.ts +31 -3
  28. package/dist/esm/oauth/clientCredentials.js +59 -4
  29. package/dist/esm/oauth/index.d.ts +2 -2
  30. package/dist/esm/oauth/index.js +2 -2
  31. package/dist/esm/oauth/tokenManager.d.ts +2 -2
  32. package/dist/esm/oauth/tokenManager.js +2 -2
  33. package/dist/esm/pin/api.d.ts +52 -0
  34. package/dist/esm/pin/api.js +80 -3
  35. package/dist/esm/pin/client.d.ts +2 -2
  36. package/dist/esm/threeds/client.d.ts +2 -2
  37. package/dist/esm/threeds-oob/api.d.ts +0 -56
  38. package/dist/esm/threeds-oob/api.js +0 -112
  39. package/dist/esm/threeds-oob/index.d.ts +0 -1
  40. package/dist/esm/threeds-oob/index.js +0 -1
  41. package/dist/esm/wallet/api.js +12 -12
  42. package/dist/esm/wallet/client.d.ts +2 -2
  43. package/dist/exchange-rate/client.d.ts +2 -2
  44. package/dist/issuer-events/api.d.ts +0 -120
  45. package/dist/issuer-events/api.js +1 -246
  46. package/dist/issuer-events/index.d.ts +0 -1
  47. package/dist/issuer-events/index.js +0 -1
  48. package/dist/oauth/axios.d.ts +3 -3
  49. package/dist/oauth/axios.js +1 -1
  50. package/dist/oauth/clientCredentials.d.ts +31 -3
  51. package/dist/oauth/clientCredentials.js +60 -3
  52. package/dist/oauth/index.d.ts +2 -2
  53. package/dist/oauth/index.js +4 -2
  54. package/dist/oauth/tokenManager.d.ts +2 -2
  55. package/dist/oauth/tokenManager.js +4 -4
  56. package/dist/pin/api.d.ts +52 -0
  57. package/dist/pin/api.js +80 -3
  58. package/dist/pin/client.d.ts +2 -2
  59. package/dist/threeds/client.d.ts +2 -2
  60. package/dist/threeds-oob/api.d.ts +0 -56
  61. package/dist/threeds-oob/api.js +1 -117
  62. package/dist/threeds-oob/index.d.ts +0 -1
  63. package/dist/threeds-oob/index.js +0 -1
  64. package/dist/wallet/api.js +12 -12
  65. package/dist/wallet/client.d.ts +2 -2
  66. package/package.json +1 -1
  67. package/src/authorisation-control/api.ts +0 -102
  68. package/src/authorisation-control/index.ts +0 -2
  69. package/src/card/api.ts +12 -12
  70. package/src/card/client.ts +3 -3
  71. package/src/cardholder/api.ts +5 -5
  72. package/src/cardholder/client.ts +3 -3
  73. package/src/cards/client.ts +3 -3
  74. package/src/exchange-rate/client.ts +3 -3
  75. package/src/issuer-events/api.ts +0 -237
  76. package/src/issuer-events/index.ts +0 -2
  77. package/src/oauth/axios.ts +3 -3
  78. package/src/oauth/clientCredentials.ts +87 -4
  79. package/src/oauth/index.ts +9 -2
  80. package/src/oauth/tokenManager.ts +2 -2
  81. package/src/pin/api.ts +99 -3
  82. package/src/pin/client.ts +3 -3
  83. package/src/threeds/client.ts +3 -3
  84. package/src/threeds-oob/api.ts +0 -105
  85. package/src/threeds-oob/index.ts +0 -2
  86. package/src/wallet/api.ts +12 -12
  87. package/src/wallet/client.ts +3 -3
  88. package/test/clientCredentials.test.ts +20 -0
  89. package/test/oauth.test.ts +12 -12
  90. package/dist/authorisation-control/client.d.ts +0 -47
  91. package/dist/authorisation-control/client.js +0 -80
  92. package/dist/esm/authorisation-control/client.d.ts +0 -47
  93. package/dist/esm/authorisation-control/client.js +0 -75
  94. package/dist/esm/issuer-events/client.d.ts +0 -47
  95. package/dist/esm/issuer-events/client.js +0 -75
  96. package/dist/esm/threeds-oob/client.d.ts +0 -47
  97. package/dist/esm/threeds-oob/client.js +0 -75
  98. package/dist/issuer-events/client.d.ts +0 -47
  99. package/dist/issuer-events/client.js +0 -80
  100. package/dist/threeds-oob/client.d.ts +0 -47
  101. package/dist/threeds-oob/client.js +0 -80
  102. package/src/authorisation-control/client.ts +0 -86
  103. package/src/issuer-events/client.ts +0 -86
  104. package/src/threeds-oob/client.ts +0 -86
  105. package/test/authorisation-control.test.ts +0 -71
  106. package/test/issuer-events.test.ts +0 -55
  107. package/test/threeds-oob.test.ts +0 -90
@@ -21,14 +21,14 @@ export type TokenFetcher = () => Promise<AccessToken>;
21
21
  * client's `Configuration`:
22
22
  *
23
23
  * ```ts
24
- * const tokens = new TokenManager(fetcher);
24
+ * const tokens = new OAuthClientCredentialsManager(fetcher);
25
25
  * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
26
26
  * ```
27
27
  *
28
28
  * A token is considered expired once the clock passes `expiry - skew`. Concurrent
29
29
  * refreshes share a single in-flight promise, so the token endpoint is hit once.
30
30
  */
31
- export class TokenManager {
31
+ export class OAuthClientCredentialsManager {
32
32
  private token?: string;
33
33
  private expiresAtMs?: number;
34
34
  private inflight?: Promise<string>;
package/src/pin/api.ts CHANGED
@@ -85,6 +85,22 @@ export interface SetPinRequestBody {
85
85
  */
86
86
  'zpkIndex'?: number;
87
87
  }
88
+ export interface SetPinTzpkRequestBody {
89
+ /**
90
+ * Control ID that was returned in the [Request PIN Control Access Token Endpoint](https://nextgen-docs.enfuce.com/api/cards/post-card/create-pin-control-access-token).
91
+ */
92
+ 'pinControlId': string;
93
+ /**
94
+ * RSA 2048 public key in PEM format (X.509 SubjectPublicKeyInfo). The key may contain: - new lines, - the PEM headers (\"-----BEGIN PUBLIC KEY-----\" and \"-----END PUBLIC KEY-----\") The key must not contain any spaces.
95
+ */
96
+ 'pubKey': string;
97
+ }
98
+ export interface SetTzpkResponseBody {
99
+ /**
100
+ * Base64 encoded encrypted Terminal Zone PIN Key (TZPK), encrypted with the pubKey passed as input.
101
+ */
102
+ 'tzpk': string;
103
+ }
88
104
  export interface ViewPinRequestBody {
89
105
  /**
90
106
  * Control ID that was returned in the [Request PIN Control Access Token Endpoint](https://nextgen-docs.enfuce.com/api/cards/post-card/create-pin-control-access-token).
@@ -111,6 +127,49 @@ export interface ViewPinResponseBody {
111
127
  */
112
128
  export const PINOperationsUsingPKIApiAxiosParamCreator = function (configuration?: Configuration) {
113
129
  return {
130
+ /**
131
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
132
+ * @summary Generate Set/Change PIN TZPK
133
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
134
+ * @param {string} [xAuditUser] Optional audit user header
135
+ * @param {*} [options] Override http request option.
136
+ * @throws {RequiredError}
137
+ */
138
+ setPinTzpk: async (setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
139
+ // verify required parameter 'setPinTzpkRequestBody' is not null or undefined
140
+ assertParamExists('setPinTzpk', 'setPinTzpkRequestBody', setPinTzpkRequestBody)
141
+ const localVarPath = `/v1/pin/pki/set/tzpk`;
142
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
143
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
144
+ let baseOptions;
145
+ if (configuration) {
146
+ baseOptions = configuration.baseOptions;
147
+ }
148
+
149
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
150
+ const localVarHeaderParameter = {} as any;
151
+ const localVarQueryParameter = {} as any;
152
+
153
+ // authentication bearerAuth required
154
+ // http bearer authentication required
155
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
156
+
157
+ localVarHeaderParameter['Content-Type'] = 'application/json';
158
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
159
+
160
+ if (xAuditUser != null) {
161
+ localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
162
+ }
163
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
164
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
165
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
166
+ localVarRequestOptions.data = serializeDataIfNeeded(setPinTzpkRequestBody, localVarRequestOptions, configuration)
167
+
168
+ return {
169
+ url: toPathString(localVarUrlObj),
170
+ options: localVarRequestOptions,
171
+ };
172
+ },
114
173
  /**
115
174
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
116
175
  * @summary Retrieve Encrypted PIN
@@ -139,7 +198,7 @@ export const PINOperationsUsingPKIApiAxiosParamCreator = function (configuration
139
198
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
140
199
 
141
200
  localVarHeaderParameter['Content-Type'] = 'application/json';
142
- localVarHeaderParameter['Accept'] = 'application/json';
201
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
143
202
 
144
203
  if (xAuditUser != null) {
145
204
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -163,6 +222,20 @@ export const PINOperationsUsingPKIApiAxiosParamCreator = function (configuration
163
222
  export const PINOperationsUsingPKIApiFp = function(configuration?: Configuration) {
164
223
  const localVarAxiosParamCreator = PINOperationsUsingPKIApiAxiosParamCreator(configuration)
165
224
  return {
225
+ /**
226
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
227
+ * @summary Generate Set/Change PIN TZPK
228
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
229
+ * @param {string} [xAuditUser] Optional audit user header
230
+ * @param {*} [options] Override http request option.
231
+ * @throws {RequiredError}
232
+ */
233
+ async setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SetTzpkResponseBody>> {
234
+ const localVarAxiosArgs = await localVarAxiosParamCreator.setPinTzpk(setPinTzpkRequestBody, xAuditUser, options);
235
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
236
+ const localVarOperationServerBasePath = operationServerMap['PINOperationsUsingPKIApi.setPinTzpk']?.[localVarOperationServerIndex]?.url;
237
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
238
+ },
166
239
  /**
167
240
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
168
241
  * @summary Retrieve Encrypted PIN
@@ -186,6 +259,17 @@ export const PINOperationsUsingPKIApiFp = function(configuration?: Configuration
186
259
  export const PINOperationsUsingPKIApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
187
260
  const localVarFp = PINOperationsUsingPKIApiFp(configuration)
188
261
  return {
262
+ /**
263
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
264
+ * @summary Generate Set/Change PIN TZPK
265
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
266
+ * @param {string} [xAuditUser] Optional audit user header
267
+ * @param {*} [options] Override http request option.
268
+ * @throws {RequiredError}
269
+ */
270
+ setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): AxiosPromise<SetTzpkResponseBody> {
271
+ return localVarFp.setPinTzpk(setPinTzpkRequestBody, xAuditUser, options).then((request) => request(axios, basePath));
272
+ },
189
273
  /**
190
274
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
191
275
  * @summary Retrieve Encrypted PIN
@@ -204,6 +288,18 @@ export const PINOperationsUsingPKIApiFactory = function (configuration?: Configu
204
288
  * PINOperationsUsingPKIApi - object-oriented interface
205
289
  */
206
290
  export class PINOperationsUsingPKIApi extends BaseAPI {
291
+ /**
292
+ * Send a request to this endpoint to generate a temporary Terminal Zone PIN Key (TZPK) for Set PIN or Change PIN flows. The TZPK is encrypted with the provided ephemeral RSA 2048 bit public key and returned as a base64 encoded value.
293
+ * @summary Generate Set/Change PIN TZPK
294
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
295
+ * @param {string} [xAuditUser] Optional audit user header
296
+ * @param {*} [options] Override http request option.
297
+ * @throws {RequiredError}
298
+ */
299
+ public setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig) {
300
+ return PINOperationsUsingPKIApiFp(this.configuration).setPinTzpk(setPinTzpkRequestBody, xAuditUser, options).then((request) => request(this.axios, this.basePath));
301
+ }
302
+
207
303
  /**
208
304
  * Send a request to this endpoint to retrieve the card PIN (ISO PIN Block Format 1) encrypted with temporary PIN encryption key (tzpk). The tzpk is encrypted with the provided ephemeral RSA 2048 bit public key. Steps for retrieving the ISO PIN Block Format 1: - Decrypt the tzpk with the RSA private key. Now you have the decrypted 3DES double length key. - Decrypt the PIN block with the decrypted tzpk using 3DES decryption.
209
305
  * @summary Retrieve Encrypted PIN
@@ -253,7 +349,7 @@ export const PINOperationsWithPreSharedKeyApiAxiosParamCreator = function (confi
253
349
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
254
350
 
255
351
  localVarHeaderParameter['Content-Type'] = 'application/json';
256
- localVarHeaderParameter['Accept'] = 'application/json';
352
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
257
353
 
258
354
  if (xIdempotencyKey != null) {
259
355
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -300,7 +396,7 @@ export const PINOperationsWithPreSharedKeyApiAxiosParamCreator = function (confi
300
396
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
301
397
 
302
398
  localVarHeaderParameter['Content-Type'] = 'application/json';
303
- localVarHeaderParameter['Accept'] = 'application/json';
399
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
304
400
 
305
401
  if (xIdempotencyKey != null) {
306
402
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
package/src/pin/client.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
7
  */
8
8
  import globalAxios, { type AxiosInstance } from 'axios';
9
- import { createOAuthAxios, type TokenManager } from '../oauth';
9
+ import { createOAuthAxios, type OAuthClientCredentialsManager } from '../oauth';
10
10
  import { Configuration } from './configuration';
11
11
  import {
12
12
  PINOperationsUsingPKIApi,
@@ -56,7 +56,7 @@ export class PinClient {
56
56
  export class PinClientBuilder {
57
57
 
58
58
  private _baseUrl?: string;
59
- private _tokens?: TokenManager;
59
+ private _tokens?: OAuthClientCredentialsManager;
60
60
  private _customizers: Array<(http: AxiosInstance) => void> = [];
61
61
 
62
62
  /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
@@ -66,7 +66,7 @@ export class PinClientBuilder {
66
66
  }
67
67
 
68
68
  /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
69
- oauth(tokens: TokenManager): this {
69
+ oauth(tokens: OAuthClientCredentialsManager): this {
70
70
  this._tokens = tokens;
71
71
  return this;
72
72
  }
@@ -6,7 +6,7 @@
6
6
  * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
7
  */
8
8
  import globalAxios, { type AxiosInstance } from 'axios';
9
- import { createOAuthAxios, type TokenManager } from '../oauth';
9
+ import { createOAuthAxios, type OAuthClientCredentialsManager } from '../oauth';
10
10
  import { Configuration } from './configuration';
11
11
  import {
12
12
  ThreeDSApi,
@@ -50,7 +50,7 @@ export class ThreedsClient {
50
50
  export class ThreedsClientBuilder {
51
51
 
52
52
  private _baseUrl?: string;
53
- private _tokens?: TokenManager;
53
+ private _tokens?: OAuthClientCredentialsManager;
54
54
  private _customizers: Array<(http: AxiosInstance) => void> = [];
55
55
 
56
56
  /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
@@ -60,7 +60,7 @@ export class ThreedsClientBuilder {
60
60
  }
61
61
 
62
62
  /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
63
- oauth(tokens: TokenManager): this {
63
+ oauth(tokens: OAuthClientCredentialsManager): this {
64
64
  this._tokens = tokens;
65
65
  return this;
66
66
  }
@@ -112,108 +112,3 @@ export const ThreeDsTransactionDeviceChannelEnum = {
112
112
  export type ThreeDsTransactionDeviceChannelEnum = typeof ThreeDsTransactionDeviceChannelEnum[keyof typeof ThreeDsTransactionDeviceChannelEnum];
113
113
 
114
114
 
115
- /**
116
- * OOBAuthenticationChallengeWebhookNotificationApi - axios parameter creator
117
- */
118
- export const OOBAuthenticationChallengeWebhookNotificationApiAxiosParamCreator = function (configuration?: Configuration) {
119
- return {
120
- /**
121
- * In Out-of-Band (OOB) authentication flow, Enfuce sends an authentication challenge webhook notification to the issuer\'s registered endpoint for cardholder\'s approval.
122
- * @summary Initiate OOB Authentication Challenge
123
- * @param {InitiateAuthenticationChallengeBody} initiateAuthenticationChallengeBody
124
- * @param {*} [options] Override http request option.
125
- * @throws {RequiredError}
126
- */
127
- initiateAuthenticationChallenge: async (initiateAuthenticationChallengeBody: InitiateAuthenticationChallengeBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
128
- // verify required parameter 'initiateAuthenticationChallengeBody' is not null or undefined
129
- assertParamExists('initiateAuthenticationChallenge', 'initiateAuthenticationChallengeBody', initiateAuthenticationChallengeBody)
130
- const localVarPath = `/v1/3ds/oob/challenge/initiate`;
131
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
132
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
133
- let baseOptions;
134
- if (configuration) {
135
- baseOptions = configuration.baseOptions;
136
- }
137
-
138
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
139
- const localVarHeaderParameter = {} as any;
140
- const localVarQueryParameter = {} as any;
141
-
142
- // authentication basicAuth required
143
- // http basic authentication required
144
- setBasicAuthToObject(localVarRequestOptions, configuration)
145
-
146
- localVarHeaderParameter['Content-Type'] = 'application/json';
147
-
148
- setSearchParams(localVarUrlObj, localVarQueryParameter);
149
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
150
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
151
- localVarRequestOptions.data = serializeDataIfNeeded(initiateAuthenticationChallengeBody, localVarRequestOptions, configuration)
152
-
153
- return {
154
- url: toPathString(localVarUrlObj),
155
- options: localVarRequestOptions,
156
- };
157
- },
158
- }
159
- };
160
-
161
- /**
162
- * OOBAuthenticationChallengeWebhookNotificationApi - functional programming interface
163
- */
164
- export const OOBAuthenticationChallengeWebhookNotificationApiFp = function(configuration?: Configuration) {
165
- const localVarAxiosParamCreator = OOBAuthenticationChallengeWebhookNotificationApiAxiosParamCreator(configuration)
166
- return {
167
- /**
168
- * In Out-of-Band (OOB) authentication flow, Enfuce sends an authentication challenge webhook notification to the issuer\'s registered endpoint for cardholder\'s approval.
169
- * @summary Initiate OOB Authentication Challenge
170
- * @param {InitiateAuthenticationChallengeBody} initiateAuthenticationChallengeBody
171
- * @param {*} [options] Override http request option.
172
- * @throws {RequiredError}
173
- */
174
- async initiateAuthenticationChallenge(initiateAuthenticationChallengeBody: InitiateAuthenticationChallengeBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
175
- const localVarAxiosArgs = await localVarAxiosParamCreator.initiateAuthenticationChallenge(initiateAuthenticationChallengeBody, options);
176
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
177
- const localVarOperationServerBasePath = operationServerMap['OOBAuthenticationChallengeWebhookNotificationApi.initiateAuthenticationChallenge']?.[localVarOperationServerIndex]?.url;
178
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
179
- },
180
- }
181
- };
182
-
183
- /**
184
- * OOBAuthenticationChallengeWebhookNotificationApi - factory interface
185
- */
186
- export const OOBAuthenticationChallengeWebhookNotificationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
187
- const localVarFp = OOBAuthenticationChallengeWebhookNotificationApiFp(configuration)
188
- return {
189
- /**
190
- * In Out-of-Band (OOB) authentication flow, Enfuce sends an authentication challenge webhook notification to the issuer\'s registered endpoint for cardholder\'s approval.
191
- * @summary Initiate OOB Authentication Challenge
192
- * @param {InitiateAuthenticationChallengeBody} initiateAuthenticationChallengeBody
193
- * @param {*} [options] Override http request option.
194
- * @throws {RequiredError}
195
- */
196
- initiateAuthenticationChallenge(initiateAuthenticationChallengeBody: InitiateAuthenticationChallengeBody, options?: RawAxiosRequestConfig): AxiosPromise<void> {
197
- return localVarFp.initiateAuthenticationChallenge(initiateAuthenticationChallengeBody, options).then((request) => request(axios, basePath));
198
- },
199
- };
200
- };
201
-
202
- /**
203
- * OOBAuthenticationChallengeWebhookNotificationApi - object-oriented interface
204
- */
205
- export class OOBAuthenticationChallengeWebhookNotificationApi extends BaseAPI {
206
- /**
207
- * In Out-of-Band (OOB) authentication flow, Enfuce sends an authentication challenge webhook notification to the issuer\'s registered endpoint for cardholder\'s approval.
208
- * @summary Initiate OOB Authentication Challenge
209
- * @param {InitiateAuthenticationChallengeBody} initiateAuthenticationChallengeBody
210
- * @param {*} [options] Override http request option.
211
- * @throws {RequiredError}
212
- */
213
- public initiateAuthenticationChallenge(initiateAuthenticationChallengeBody: InitiateAuthenticationChallengeBody, options?: RawAxiosRequestConfig) {
214
- return OOBAuthenticationChallengeWebhookNotificationApiFp(this.configuration).initiateAuthenticationChallenge(initiateAuthenticationChallengeBody, options).then((request) => request(this.axios, this.basePath));
215
- }
216
- }
217
-
218
-
219
-
@@ -16,5 +16,3 @@
16
16
  export * from "./api";
17
17
  export * from "./configuration";
18
18
 
19
-
20
- export * from './client';
package/src/wallet/api.ts CHANGED
@@ -475,7 +475,7 @@ export const ActivateTokenApiAxiosParamCreator = function (configuration?: Confi
475
475
  // http bearer authentication required
476
476
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
477
477
 
478
- localVarHeaderParameter['Accept'] = 'application/json';
478
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
479
479
 
480
480
  if (xAuditUser != null) {
481
481
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -518,7 +518,7 @@ export const ActivateTokenApiAxiosParamCreator = function (configuration?: Confi
518
518
  // http bearer authentication required
519
519
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
520
520
 
521
- localVarHeaderParameter['Accept'] = 'application/json';
521
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
522
522
 
523
523
  if (xIdempotencyKey != null) {
524
524
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -674,7 +674,7 @@ export const DeactivateTokenApiAxiosParamCreator = function (configuration?: Con
674
674
  // http bearer authentication required
675
675
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
676
676
 
677
- localVarHeaderParameter['Accept'] = 'application/json';
677
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
678
678
 
679
679
  if (xIdempotencyKey != null) {
680
680
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -790,7 +790,7 @@ export const EligibleTokenRequestorsApiAxiosParamCreator = function (configurati
790
790
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
791
791
 
792
792
  localVarHeaderParameter['Content-Type'] = 'application/json';
793
- localVarHeaderParameter['Accept'] = 'application/json';
793
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
794
794
 
795
795
  if (xAuditUser != null) {
796
796
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -913,7 +913,7 @@ export const GetTokensApiAxiosParamCreator = function (configuration?: Configura
913
913
  localVarQueryParameter['includeCardSchemePayload'] = includeCardSchemePayload;
914
914
  }
915
915
 
916
- localVarHeaderParameter['Accept'] = 'application/json';
916
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
917
917
 
918
918
  if (xAuditUser != null) {
919
919
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -965,7 +965,7 @@ export const GetTokensApiAxiosParamCreator = function (configuration?: Configura
965
965
  localVarQueryParameter['includeCardSchemePayload'] = includeCardSchemePayload;
966
966
  }
967
967
 
968
- localVarHeaderParameter['Accept'] = 'application/json';
968
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
969
969
 
970
970
  if (xAuditUser != null) {
971
971
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1126,7 +1126,7 @@ export const PushCardsApiAxiosParamCreator = function (configuration?: Configura
1126
1126
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1127
1127
 
1128
1128
  localVarHeaderParameter['Content-Type'] = 'application/json';
1129
- localVarHeaderParameter['Accept'] = 'application/json';
1129
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1130
1130
 
1131
1131
  if (xAuditUser != null) {
1132
1132
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1243,7 +1243,7 @@ export const PushProvisionApiAxiosParamCreator = function (configuration?: Confi
1243
1243
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1244
1244
 
1245
1245
  localVarHeaderParameter['Content-Type'] = 'application/json';
1246
- localVarHeaderParameter['Accept'] = 'application/json';
1246
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1247
1247
 
1248
1248
  if (xAuditUser != null) {
1249
1249
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1288,7 +1288,7 @@ export const PushProvisionApiAxiosParamCreator = function (configuration?: Confi
1288
1288
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1289
1289
 
1290
1290
  localVarHeaderParameter['Content-Type'] = 'application/json';
1291
- localVarHeaderParameter['Accept'] = 'application/json';
1291
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1292
1292
 
1293
1293
  if (xAuditUser != null) {
1294
1294
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1333,7 +1333,7 @@ export const PushProvisionApiAxiosParamCreator = function (configuration?: Confi
1333
1333
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1334
1334
 
1335
1335
  localVarHeaderParameter['Content-Type'] = 'application/json';
1336
- localVarHeaderParameter['Accept'] = 'application/json';
1336
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1337
1337
 
1338
1338
  if (xAuditUser != null) {
1339
1339
  localVarHeaderParameter['x-audit-user'] = String(xAuditUser);
@@ -1530,7 +1530,7 @@ export const SuspendTokenApiAxiosParamCreator = function (configuration?: Config
1530
1530
  // http bearer authentication required
1531
1531
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1532
1532
 
1533
- localVarHeaderParameter['Accept'] = 'application/json';
1533
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1534
1534
 
1535
1535
  if (xIdempotencyKey != null) {
1536
1536
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -1649,7 +1649,7 @@ export const UnsuspendTokenApiAxiosParamCreator = function (configuration?: Conf
1649
1649
  // http bearer authentication required
1650
1650
  await setBearerAuthToObject(localVarHeaderParameter, configuration)
1651
1651
 
1652
- localVarHeaderParameter['Accept'] = 'application/json';
1652
+ localVarHeaderParameter['Accept'] = 'application/json,application/problem+json';
1653
1653
 
1654
1654
  if (xIdempotencyKey != null) {
1655
1655
  localVarHeaderParameter['x-idempotency-key'] = String(xIdempotencyKey);
@@ -6,7 +6,7 @@
6
6
  * retry) to the module's Configuration and exposes each API. Nothing is shared across modules.
7
7
  */
8
8
  import globalAxios, { type AxiosInstance } from 'axios';
9
- import { createOAuthAxios, type TokenManager } from '../oauth';
9
+ import { createOAuthAxios, type OAuthClientCredentialsManager } from '../oauth';
10
10
  import { Configuration } from './configuration';
11
11
  import {
12
12
  ActivateTokenApi,
@@ -92,7 +92,7 @@ export class WalletClient {
92
92
  export class WalletClientBuilder {
93
93
 
94
94
  private _baseUrl?: string;
95
- private _tokens?: TokenManager;
95
+ private _tokens?: OAuthClientCredentialsManager;
96
96
  private _customizers: Array<(http: AxiosInstance) => void> = [];
97
97
 
98
98
  /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
@@ -102,7 +102,7 @@ export class WalletClientBuilder {
102
102
  }
103
103
 
104
104
  /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
105
- oauth(tokens: TokenManager): this {
105
+ oauth(tokens: OAuthClientCredentialsManager): this {
106
106
  this._tokens = tokens;
107
107
  return this;
108
108
  }
@@ -0,0 +1,20 @@
1
+ /** Tests for the ClientCredentials identity object and the clientCredentials overloads. */
2
+ import { describe, expect, it } from 'vitest';
3
+ import { oauth } from '../src';
4
+
5
+ describe('ClientCredentials pairing', () => {
6
+ it('clientCredentials(tokenUrl, credentials) builds an OAuthClientCredentialsManager', () => {
7
+ const creds: oauth.ClientCredentials = { clientId: 'id', clientSecret: 'secret', scopes: ['s.read'] };
8
+ const mgr = oauth.clientCredentials('https://auth.example.com/oauth2/token', creds);
9
+ expect(mgr).toBeInstanceOf(oauth.OAuthClientCredentialsManager);
10
+ });
11
+
12
+ it('still accepts a full OAuthConfig', () => {
13
+ const mgr = oauth.clientCredentials({
14
+ tokenUrl: 'https://auth.example.com/oauth2/token',
15
+ clientId: 'id',
16
+ clientSecret: 'secret',
17
+ });
18
+ expect(mgr).toBeInstanceOf(oauth.OAuthClientCredentialsManager);
19
+ });
20
+ });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Tests for the hand-written OAuth token-management helper (src/oauth).
3
3
  *
4
- * Covers the TokenManager cache/refresh/single-flight logic, the client-credentials
4
+ * Covers the OAuthClientCredentialsManager cache/refresh/single-flight logic, the client-credentials
5
5
  * fetcher and the reactive 401-retry axios instance, using capturing axios adapters
6
6
  * so nothing hits the network.
7
7
  */
@@ -9,7 +9,7 @@ import axios, { type AxiosAdapter, type InternalAxiosRequestConfig } from 'axios
9
9
  import { describe, expect, it } from 'vitest';
10
10
  import { oauth } from '../src';
11
11
 
12
- const { TokenManager, clientCredentialsFetcher, clientCredentials, createOAuthAxios } = oauth;
12
+ const { OAuthClientCredentialsManager, clientCredentialsFetcher, clientCredentials, createOAuthAxios } = oauth;
13
13
 
14
14
  function makeClock(start = 1000) {
15
15
  const state = { t: start };
@@ -25,11 +25,11 @@ function countingFetcher(expiresInSeconds = 300) {
25
25
  return { fetch, calls };
26
26
  }
27
27
 
28
- describe('TokenManager', () => {
28
+ describe('OAuthClientCredentialsManager', () => {
29
29
  it('caches the token within its validity window', async () => {
30
30
  const { fetch, calls } = countingFetcher();
31
31
  const clock = makeClock();
32
- const mgr = new TokenManager(fetch, 60, clock.now);
32
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, clock.now);
33
33
 
34
34
  expect(await mgr.getToken()).toBe('token-1');
35
35
  expect(await mgr.getToken()).toBe('token-1');
@@ -39,7 +39,7 @@ describe('TokenManager', () => {
39
39
  it('refreshes once past expiry minus skew', async () => {
40
40
  const { fetch, calls } = countingFetcher(300);
41
41
  const clock = makeClock();
42
- const mgr = new TokenManager(fetch, 60, clock.now);
42
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, clock.now);
43
43
 
44
44
  expect(await mgr.getToken()).toBe('token-1');
45
45
  clock.advance(239_000);
@@ -53,7 +53,7 @@ describe('TokenManager', () => {
53
53
 
54
54
  it('refetches every call when lifetime is unknown', async () => {
55
55
  const { fetch, calls } = countingFetcher(0);
56
- const mgr = new TokenManager(fetch, 60, makeClock().now);
56
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, makeClock().now);
57
57
  await mgr.getToken();
58
58
  await mgr.getToken();
59
59
  expect(calls.n).toBe(2);
@@ -61,7 +61,7 @@ describe('TokenManager', () => {
61
61
 
62
62
  it('shares a single in-flight fetch across concurrent callers', async () => {
63
63
  const { fetch, calls } = countingFetcher();
64
- const mgr = new TokenManager(fetch, 60, makeClock().now);
64
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, makeClock().now);
65
65
 
66
66
  const results = await Promise.all([mgr.getToken(), mgr.getToken(), mgr.getToken()]);
67
67
 
@@ -71,7 +71,7 @@ describe('TokenManager', () => {
71
71
 
72
72
  it('forceRefresh is a no-op when the cached token already moved on', async () => {
73
73
  const { fetch, calls } = countingFetcher();
74
- const mgr = new TokenManager(fetch, 60, makeClock().now);
74
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, makeClock().now);
75
75
 
76
76
  expect(await mgr.getToken()).toBe('token-1');
77
77
  expect(await mgr.forceRefresh('an-older-token')).toBe('token-1');
@@ -129,7 +129,7 @@ describe('clientCredentialsFetcher', () => {
129
129
  expect(captured.config?.auth).toBeUndefined();
130
130
  });
131
131
 
132
- it('clientCredentials returns a caching TokenManager', async () => {
132
+ it('clientCredentials returns a caching OAuthClientCredentialsManager', async () => {
133
133
  const { instance } = capturingAxios({ access_token: 'abc', expires_in: 120 });
134
134
  const mgr = clientCredentials(
135
135
  { tokenUrl: 'https://auth.example.com/oauth/token', clientId: 'id', clientSecret: 's', axiosInstance: instance },
@@ -141,7 +141,7 @@ describe('clientCredentialsFetcher', () => {
141
141
  describe('createOAuthAxios', () => {
142
142
  it('proactively attaches a bearer token to a request that has no Authorization header', async () => {
143
143
  const { fetch, calls } = countingFetcher();
144
- const mgr = new TokenManager(fetch, 60, makeClock().now);
144
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, makeClock().now);
145
145
 
146
146
  const seenAuth: (string | undefined)[] = [];
147
147
  const adapter: AxiosAdapter = async (config) => {
@@ -160,7 +160,7 @@ describe('createOAuthAxios', () => {
160
160
 
161
161
  it('retries the request with a refreshed token when the first call rejects with 401', async () => {
162
162
  const { fetch } = countingFetcher();
163
- const mgr = new TokenManager(fetch, 60, makeClock().now);
163
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, makeClock().now);
164
164
  await mgr.getToken(); // seed token-1
165
165
 
166
166
  const seenAuth: (string | undefined)[] = [];
@@ -196,7 +196,7 @@ describe('createOAuthAxios', () => {
196
196
 
197
197
  it('surfaces the error after a single retry (no infinite loop)', async () => {
198
198
  const { fetch } = countingFetcher();
199
- const mgr = new TokenManager(fetch, 60, makeClock().now);
199
+ const mgr = new OAuthClientCredentialsManager(fetch, 60, makeClock().now);
200
200
  await mgr.getToken();
201
201
 
202
202
  let calls = 0;
@@ -1,47 +0,0 @@
1
- import { type AxiosInstance } from 'axios';
2
- import { type TokenManager } from '../oauth';
3
- import { Configuration } from './configuration';
4
- import { AuthorisationRequestAPIApi } from './api';
5
- /**
6
- * Fluent entry point for this module. Build one with {@link AuthorisationControlClient.builder}:
7
- *
8
- * ```ts
9
- * const client = AuthorisationControlClient.builder()
10
- * .baseUrl('https://api.example.com/...')
11
- * .oauth(tokens)
12
- * .build();
13
- * ```
14
- */
15
- export declare class AuthorisationControlClient {
16
- /** The axios instance — OAuth interceptors and any customizations already applied. */
17
- readonly http: AxiosInstance;
18
- /** The module configuration — base path applied. */
19
- readonly configuration: Configuration;
20
- constructor(
21
- /** The axios instance — OAuth interceptors and any customizations already applied. */
22
- http: AxiosInstance,
23
- /** The module configuration — base path applied. */
24
- configuration: Configuration);
25
- /** Build any API in this module bound to this client (for APIs without a named getter). */
26
- api<T>(factory: (configuration: Configuration, http: AxiosInstance) => T): T;
27
- /** {@link AuthorisationRequestAPIApi} bound to this client. */
28
- authorisationRequestAPIApi(): AuthorisationRequestAPIApi;
29
- static builder(): AuthorisationControlClientBuilder;
30
- }
31
- /** Builds a {@link AuthorisationControlClient}: base URL + optional OAuth + transport customization. */
32
- export declare class AuthorisationControlClientBuilder {
33
- private _baseUrl?;
34
- private _tokens?;
35
- private _customizers;
36
- /** The module's host, e.g. `https://api.<tenant>.../issuer`. */
37
- baseUrl(baseUrl: string): this;
38
- /** Install OAuth: a fresh bearer token on every request + reactive 401 retry. */
39
- oauth(tokens: TokenManager): this;
40
- /**
41
- * Customize the underlying axios instance — set a timeout (`http.defaults.timeout = ...`), a proxy,
42
- * default headers, extra interceptors, etc. Runs after OAuth is installed. Composable: multiple
43
- * calls run in order.
44
- */
45
- configure(customizer: (http: AxiosInstance) => void): this;
46
- build(): AuthorisationControlClient;
47
- }