@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
@@ -11,21 +11,6 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- import globalAxios from 'axios';
24
- // Some imports not used depending on template conditions
25
- // @ts-ignore
26
- import { DUMMY_BASE_URL, assertParamExists, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
27
- // @ts-ignore
28
- import { BASE_PATH, BaseAPI, operationServerMap } from './base';
29
14
  /**
30
15
  * The wallets common name for authorization decision.
31
16
  */
@@ -1178,229 +1163,3 @@ export const TokenStatus = {
1178
1163
  Inactive: 'INACTIVE',
1179
1164
  Suspended: 'SUSPENDED',
1180
1165
  };
1181
- /**
1182
- * IssuerEventWebhooksApi - axios parameter creator
1183
- */
1184
- export const IssuerEventWebhooksApiAxiosParamCreator = function (configuration) {
1185
- return {
1186
- /**
1187
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1188
- * @summary Outgoing card event webhook endpoint
1189
- * @param {CardEvent} cardEvent Card event
1190
- * @param {*} [options] Override http request option.
1191
- * @throws {RequiredError}
1192
- */
1193
- cardEvent: (cardEvent_1, ...args_1) => __awaiter(this, [cardEvent_1, ...args_1], void 0, function* (cardEvent, options = {}) {
1194
- // verify required parameter 'cardEvent' is not null or undefined
1195
- assertParamExists('cardEvent', 'cardEvent', cardEvent);
1196
- const localVarPath = `/card`;
1197
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1198
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1199
- let baseOptions;
1200
- if (configuration) {
1201
- baseOptions = configuration.baseOptions;
1202
- }
1203
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
1204
- const localVarHeaderParameter = {};
1205
- const localVarQueryParameter = {};
1206
- localVarHeaderParameter['Content-Type'] = 'application/json';
1207
- setSearchParams(localVarUrlObj, localVarQueryParameter);
1208
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1209
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1210
- localVarRequestOptions.data = serializeDataIfNeeded(cardEvent, localVarRequestOptions, configuration);
1211
- return {
1212
- url: toPathString(localVarUrlObj),
1213
- options: localVarRequestOptions,
1214
- };
1215
- }),
1216
- /**
1217
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1218
- * @summary Outgoing cardholder event webhook endpoint
1219
- * @param {CardholderEvent} cardholderEvent Cardholder event
1220
- * @param {*} [options] Override http request option.
1221
- * @throws {RequiredError}
1222
- */
1223
- cardholderEvent: (cardholderEvent_1, ...args_1) => __awaiter(this, [cardholderEvent_1, ...args_1], void 0, function* (cardholderEvent, options = {}) {
1224
- // verify required parameter 'cardholderEvent' is not null or undefined
1225
- assertParamExists('cardholderEvent', 'cardholderEvent', cardholderEvent);
1226
- const localVarPath = `/cardholder`;
1227
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1228
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1229
- let baseOptions;
1230
- if (configuration) {
1231
- baseOptions = configuration.baseOptions;
1232
- }
1233
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
1234
- const localVarHeaderParameter = {};
1235
- const localVarQueryParameter = {};
1236
- localVarHeaderParameter['Content-Type'] = 'application/json';
1237
- setSearchParams(localVarUrlObj, localVarQueryParameter);
1238
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1239
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1240
- localVarRequestOptions.data = serializeDataIfNeeded(cardholderEvent, localVarRequestOptions, configuration);
1241
- return {
1242
- url: toPathString(localVarUrlObj),
1243
- options: localVarRequestOptions,
1244
- };
1245
- }),
1246
- /**
1247
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1248
- * @summary Outgoing token event webhook endpoint
1249
- * @param {TokenEvent} tokenEvent Token event
1250
- * @param {*} [options] Override http request option.
1251
- * @throws {RequiredError}
1252
- */
1253
- tokenEvent: (tokenEvent_1, ...args_1) => __awaiter(this, [tokenEvent_1, ...args_1], void 0, function* (tokenEvent, options = {}) {
1254
- // verify required parameter 'tokenEvent' is not null or undefined
1255
- assertParamExists('tokenEvent', 'tokenEvent', tokenEvent);
1256
- const localVarPath = `/token`;
1257
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
1258
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1259
- let baseOptions;
1260
- if (configuration) {
1261
- baseOptions = configuration.baseOptions;
1262
- }
1263
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
1264
- const localVarHeaderParameter = {};
1265
- const localVarQueryParameter = {};
1266
- localVarHeaderParameter['Content-Type'] = 'application/json';
1267
- setSearchParams(localVarUrlObj, localVarQueryParameter);
1268
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1269
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
1270
- localVarRequestOptions.data = serializeDataIfNeeded(tokenEvent, localVarRequestOptions, configuration);
1271
- return {
1272
- url: toPathString(localVarUrlObj),
1273
- options: localVarRequestOptions,
1274
- };
1275
- }),
1276
- };
1277
- };
1278
- /**
1279
- * IssuerEventWebhooksApi - functional programming interface
1280
- */
1281
- export const IssuerEventWebhooksApiFp = function (configuration) {
1282
- const localVarAxiosParamCreator = IssuerEventWebhooksApiAxiosParamCreator(configuration);
1283
- return {
1284
- /**
1285
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1286
- * @summary Outgoing card event webhook endpoint
1287
- * @param {CardEvent} cardEvent Card event
1288
- * @param {*} [options] Override http request option.
1289
- * @throws {RequiredError}
1290
- */
1291
- cardEvent(cardEvent, options) {
1292
- return __awaiter(this, void 0, void 0, function* () {
1293
- var _a, _b, _c;
1294
- const localVarAxiosArgs = yield localVarAxiosParamCreator.cardEvent(cardEvent, options);
1295
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1296
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['IssuerEventWebhooksApi.cardEvent']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1297
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1298
- });
1299
- },
1300
- /**
1301
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1302
- * @summary Outgoing cardholder event webhook endpoint
1303
- * @param {CardholderEvent} cardholderEvent Cardholder event
1304
- * @param {*} [options] Override http request option.
1305
- * @throws {RequiredError}
1306
- */
1307
- cardholderEvent(cardholderEvent, options) {
1308
- return __awaiter(this, void 0, void 0, function* () {
1309
- var _a, _b, _c;
1310
- const localVarAxiosArgs = yield localVarAxiosParamCreator.cardholderEvent(cardholderEvent, options);
1311
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1312
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['IssuerEventWebhooksApi.cardholderEvent']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1313
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1314
- });
1315
- },
1316
- /**
1317
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1318
- * @summary Outgoing token event webhook endpoint
1319
- * @param {TokenEvent} tokenEvent Token event
1320
- * @param {*} [options] Override http request option.
1321
- * @throws {RequiredError}
1322
- */
1323
- tokenEvent(tokenEvent, options) {
1324
- return __awaiter(this, void 0, void 0, function* () {
1325
- var _a, _b, _c;
1326
- const localVarAxiosArgs = yield localVarAxiosParamCreator.tokenEvent(tokenEvent, options);
1327
- const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
1328
- const localVarOperationServerBasePath = (_c = (_b = operationServerMap['IssuerEventWebhooksApi.tokenEvent']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
1329
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
1330
- });
1331
- },
1332
- };
1333
- };
1334
- /**
1335
- * IssuerEventWebhooksApi - factory interface
1336
- */
1337
- export const IssuerEventWebhooksApiFactory = function (configuration, basePath, axios) {
1338
- const localVarFp = IssuerEventWebhooksApiFp(configuration);
1339
- return {
1340
- /**
1341
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1342
- * @summary Outgoing card event webhook endpoint
1343
- * @param {CardEvent} cardEvent Card event
1344
- * @param {*} [options] Override http request option.
1345
- * @throws {RequiredError}
1346
- */
1347
- cardEvent(cardEvent, options) {
1348
- return localVarFp.cardEvent(cardEvent, options).then((request) => request(axios, basePath));
1349
- },
1350
- /**
1351
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1352
- * @summary Outgoing cardholder event webhook endpoint
1353
- * @param {CardholderEvent} cardholderEvent Cardholder event
1354
- * @param {*} [options] Override http request option.
1355
- * @throws {RequiredError}
1356
- */
1357
- cardholderEvent(cardholderEvent, options) {
1358
- return localVarFp.cardholderEvent(cardholderEvent, options).then((request) => request(axios, basePath));
1359
- },
1360
- /**
1361
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1362
- * @summary Outgoing token event webhook endpoint
1363
- * @param {TokenEvent} tokenEvent Token event
1364
- * @param {*} [options] Override http request option.
1365
- * @throws {RequiredError}
1366
- */
1367
- tokenEvent(tokenEvent, options) {
1368
- return localVarFp.tokenEvent(tokenEvent, options).then((request) => request(axios, basePath));
1369
- },
1370
- };
1371
- };
1372
- /**
1373
- * IssuerEventWebhooksApi - object-oriented interface
1374
- */
1375
- export class IssuerEventWebhooksApi extends BaseAPI {
1376
- /**
1377
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon card creation, update or closure.
1378
- * @summary Outgoing card event webhook endpoint
1379
- * @param {CardEvent} cardEvent Card event
1380
- * @param {*} [options] Override http request option.
1381
- * @throws {RequiredError}
1382
- */
1383
- cardEvent(cardEvent, options) {
1384
- return IssuerEventWebhooksApiFp(this.configuration).cardEvent(cardEvent, options).then((request) => request(this.axios, this.basePath));
1385
- }
1386
- /**
1387
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon cardholder creation or update.
1388
- * @summary Outgoing cardholder event webhook endpoint
1389
- * @param {CardholderEvent} cardholderEvent Cardholder event
1390
- * @param {*} [options] Override http request option.
1391
- * @throws {RequiredError}
1392
- */
1393
- cardholderEvent(cardholderEvent, options) {
1394
- return IssuerEventWebhooksApiFp(this.configuration).cardholderEvent(cardholderEvent, options).then((request) => request(this.axios, this.basePath));
1395
- }
1396
- /**
1397
- * This is not an endpoint. This is the description of a request that is sent to subscribed webhooks upon token creation or update.
1398
- * @summary Outgoing token event webhook endpoint
1399
- * @param {TokenEvent} tokenEvent Token event
1400
- * @param {*} [options] Override http request option.
1401
- * @throws {RequiredError}
1402
- */
1403
- tokenEvent(tokenEvent, options) {
1404
- return IssuerEventWebhooksApiFp(this.configuration).tokenEvent(tokenEvent, options).then((request) => request(this.axios, this.basePath));
1405
- }
1406
- }
@@ -11,4 +11,3 @@
11
11
  */
12
12
  export * from "./api";
13
13
  export * from "./configuration";
14
- export * from './client';
@@ -13,4 +13,3 @@
13
13
  */
14
14
  export * from "./api";
15
15
  export * from "./configuration";
16
- export * from './client';
@@ -1,10 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { TokenManager } from './tokenManager';
2
+ import { OAuthClientCredentialsManager } from './tokenManager';
3
3
  /**
4
4
  * Returns an {@link AxiosInstance} with OAuth bearer-token handling built in:
5
5
  *
6
6
  * - **Proactive:** a request interceptor attaches a fresh bearer token (from the
7
- * {@link TokenManager}) to *every* request. This authenticates API modules whose spec declares no
7
+ * {@link OAuthClientCredentialsManager}) to *every* request. This authenticates API modules whose spec declares no
8
8
  * security scheme (e.g. exchange-rate), so no `accessToken` on the `Configuration` is required.
9
9
  * - **Reactive:** a response interceptor, on a `401`, forces a token refresh and retries the request
10
10
  * exactly once with the new bearer token.
@@ -17,4 +17,4 @@ import { TokenManager } from './tokenManager';
17
17
  * const api = new card.CardApi(config, undefined, http);
18
18
  * ```
19
19
  */
20
- export declare function createOAuthAxios(manager: TokenManager, instance?: AxiosInstance): AxiosInstance;
20
+ export declare function createOAuthAxios(manager: OAuthClientCredentialsManager, instance?: AxiosInstance): AxiosInstance;
@@ -25,7 +25,7 @@ function stripBearer(header) {
25
25
  * Returns an {@link AxiosInstance} with OAuth bearer-token handling built in:
26
26
  *
27
27
  * - **Proactive:** a request interceptor attaches a fresh bearer token (from the
28
- * {@link TokenManager}) to *every* request. This authenticates API modules whose spec declares no
28
+ * {@link OAuthClientCredentialsManager}) to *every* request. This authenticates API modules whose spec declares no
29
29
  * security scheme (e.g. exchange-rate), so no `accessToken` on the `Configuration` is required.
30
30
  * - **Reactive:** a response interceptor, on a `401`, forces a token refresh and retries the request
31
31
  * exactly once with the new bearer token.
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { TokenFetcher, TokenManager } from './tokenManager';
2
+ import { TokenFetcher, OAuthClientCredentialsManager } from './tokenManager';
3
3
  /** Configuration for the OAuth2 `client_credentials` grant. */
4
4
  export interface OAuthConfig {
5
5
  tokenUrl: string;
@@ -14,11 +14,39 @@ export interface OAuthConfig {
14
14
  /** Axios instance used for the token request. Defaults to a fresh instance. */
15
15
  axiosInstance?: AxiosInstance;
16
16
  }
17
+ /**
18
+ * The OAuth2 client-credentials identity — the client id/secret and requested scopes. It carries
19
+ * no URL: pair it with a token URL (e.g. derived from a `TenantEnvironment`) via the
20
+ * `clientCredentials(tokenUrl, credentials)` overload below.
21
+ */
22
+ export interface ClientCredentials {
23
+ clientId: string;
24
+ /** May be omitted for a public client. */
25
+ clientSecret?: string;
26
+ /** Requested scopes; space-joined into a `scope` parameter. */
27
+ scopes?: string[];
28
+ }
17
29
  /**
18
30
  * Builds a {@link TokenFetcher} that performs the OAuth2 `client_credentials`
19
31
  * grant: a form-encoded POST to `config.tokenUrl`, parsing `access_token` and
20
32
  * `expires_in`. Server-side only — never ship a client secret to a browser.
21
33
  */
22
34
  export declare function clientCredentialsFetcher(config: OAuthConfig): TokenFetcher;
23
- /** Convenience: a caching {@link TokenManager} backed by the client-credentials grant. */
24
- export declare function clientCredentials(config: OAuthConfig, skewSeconds?: number): TokenManager;
35
+ /** Convenience: a caching {@link OAuthClientCredentialsManager} backed by the client-credentials grant. */
36
+ export declare function clientCredentials(config: OAuthConfig, skewSeconds?: number): OAuthClientCredentialsManager;
37
+ /** Convenience overload pairing a token URL with a {@link ClientCredentials} identity. */
38
+ export declare function clientCredentials(tokenUrl: string, credentials: ClientCredentials, skewSeconds?: number): OAuthClientCredentialsManager;
39
+ /**
40
+ * Decodes the granted scopes from a JWT access token's `scope` (space-delimited) or `scp` (array)
41
+ * claim, sorted and de-duplicated. Returns an empty array for an empty, opaque (non-JWT), or
42
+ * undecodable token — never throws. Server-side only (uses Node's `Buffer`).
43
+ */
44
+ export declare function scopesOf(accessToken: string): string[];
45
+ /**
46
+ * Discovers the scopes the client is entitled to. Requests a `client_credentials` token with NO
47
+ * `scope` narrowing (any scopes on the config/credentials are ignored) — most authorization servers
48
+ * then grant the client's full default scope set — and returns the granted scopes decoded from the
49
+ * access token, sorted and de-duplicated. Performs a live token request; does not cache.
50
+ */
51
+ export declare function availableScopes(config: OAuthConfig): Promise<string[]>;
52
+ export declare function availableScopes(tokenUrl: string, credentials: ClientCredentials): Promise<string[]>;
@@ -15,7 +15,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  * OpenAPI Generator to (re)produce it.
16
16
  */
17
17
  import axios from 'axios';
18
- import { TokenManager } from './tokenManager';
18
+ import { OAuthClientCredentialsManager } from './tokenManager';
19
19
  /**
20
20
  * Builds a {@link TokenFetcher} that performs the OAuth2 `client_credentials`
21
21
  * grant: a form-encoded POST to `config.tokenUrl`, parsing `access_token` and
@@ -53,7 +53,62 @@ export function clientCredentialsFetcher(config) {
53
53
  return { accessToken: data.access_token, expiresInSeconds: (_b = data.expires_in) !== null && _b !== void 0 ? _b : 0 };
54
54
  });
55
55
  }
56
- /** Convenience: a caching {@link TokenManager} backed by the client-credentials grant. */
57
- export function clientCredentials(config, skewSeconds = 60) {
58
- return new TokenManager(clientCredentialsFetcher(config), skewSeconds);
56
+ export function clientCredentials(configOrUrl, credsOrSkew, skewSeconds = 60) {
57
+ var _a;
58
+ let config;
59
+ let skew;
60
+ if (typeof configOrUrl === 'string') {
61
+ const creds = credsOrSkew;
62
+ config = {
63
+ tokenUrl: configOrUrl,
64
+ clientId: creds.clientId,
65
+ clientSecret: (_a = creds.clientSecret) !== null && _a !== void 0 ? _a : '',
66
+ scopes: creds.scopes,
67
+ };
68
+ skew = skewSeconds;
69
+ }
70
+ else {
71
+ config = configOrUrl;
72
+ skew = typeof credsOrSkew === 'number' ? credsOrSkew : 60;
73
+ }
74
+ return new OAuthClientCredentialsManager(clientCredentialsFetcher(config), skew);
75
+ }
76
+ /**
77
+ * Decodes the granted scopes from a JWT access token's `scope` (space-delimited) or `scp` (array)
78
+ * claim, sorted and de-duplicated. Returns an empty array for an empty, opaque (non-JWT), or
79
+ * undecodable token — never throws. Server-side only (uses Node's `Buffer`).
80
+ */
81
+ export function scopesOf(accessToken) {
82
+ const parts = accessToken ? accessToken.split('.') : [];
83
+ if (parts.length < 2)
84
+ return [];
85
+ try {
86
+ const b64 = parts[1].replace(/-/g, '+').replace(/_/g, '/'); // base64url -> base64 ('base64' tolerates missing padding)
87
+ const payload = JSON.parse(Buffer.from(b64, 'base64').toString('utf8'));
88
+ const scopes = new Set();
89
+ if (typeof payload.scope === 'string') {
90
+ for (const s of payload.scope.trim().split(/\s+/))
91
+ if (s)
92
+ scopes.add(s);
93
+ }
94
+ if (Array.isArray(payload.scp)) {
95
+ for (const s of payload.scp)
96
+ if (typeof s === 'string')
97
+ scopes.add(s);
98
+ }
99
+ return [...scopes].sort();
100
+ }
101
+ catch (_a) {
102
+ return [];
103
+ }
104
+ }
105
+ export function availableScopes(configOrUrl, credentials) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ var _a;
108
+ const config = typeof configOrUrl === 'string'
109
+ ? { tokenUrl: configOrUrl, clientId: credentials.clientId, clientSecret: (_a = credentials.clientSecret) !== null && _a !== void 0 ? _a : '' }
110
+ : configOrUrl;
111
+ const token = yield clientCredentialsFetcher(Object.assign(Object.assign({}, config), { scopes: [] }))();
112
+ return scopesOf(token.accessToken);
113
+ });
59
114
  }
@@ -1,3 +1,3 @@
1
- export { AccessToken, TokenFetcher, TokenManager } from './tokenManager';
2
- export { OAuthConfig, clientCredentials, clientCredentialsFetcher } from './clientCredentials';
1
+ export { AccessToken, TokenFetcher, OAuthClientCredentialsManager } from './tokenManager';
2
+ export { ClientCredentials, OAuthConfig, clientCredentials, clientCredentialsFetcher, availableScopes, scopesOf, } from './clientCredentials';
3
3
  export { createOAuthAxios } from './axios';
@@ -22,6 +22,6 @@
22
22
  *
23
23
  * Server-side only — a client secret must never ship to a browser.
24
24
  */
25
- export { TokenManager } from './tokenManager';
26
- export { clientCredentials, clientCredentialsFetcher } from './clientCredentials';
25
+ export { OAuthClientCredentialsManager } from './tokenManager';
26
+ export { clientCredentials, clientCredentialsFetcher, availableScopes, scopesOf, } from './clientCredentials';
27
27
  export { createOAuthAxios } from './axios';
@@ -11,14 +11,14 @@ export type TokenFetcher = () => Promise<AccessToken>;
11
11
  * client's `Configuration`:
12
12
  *
13
13
  * ```ts
14
- * const tokens = new TokenManager(fetcher);
14
+ * const tokens = new OAuthClientCredentialsManager(fetcher);
15
15
  * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
16
16
  * ```
17
17
  *
18
18
  * A token is considered expired once the clock passes `expiry - skew`. Concurrent
19
19
  * refreshes share a single in-flight promise, so the token endpoint is hit once.
20
20
  */
21
- export declare class TokenManager {
21
+ export declare class OAuthClientCredentialsManager {
22
22
  private readonly fetcher;
23
23
  private readonly skewSeconds;
24
24
  private readonly now;
@@ -19,14 +19,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
19
  * client's `Configuration`:
20
20
  *
21
21
  * ```ts
22
- * const tokens = new TokenManager(fetcher);
22
+ * const tokens = new OAuthClientCredentialsManager(fetcher);
23
23
  * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
24
24
  * ```
25
25
  *
26
26
  * A token is considered expired once the clock passes `expiry - skew`. Concurrent
27
27
  * refreshes share a single in-flight promise, so the token endpoint is hit once.
28
28
  */
29
- export class TokenManager {
29
+ export class OAuthClientCredentialsManager {
30
30
  constructor(fetcher, skewSeconds = 60, now = Date.now) {
31
31
  this.fetcher = fetcher;
32
32
  this.skewSeconds = skewSeconds;
@@ -75,6 +75,22 @@ export interface SetPinRequestBody {
75
75
  */
76
76
  'zpkIndex'?: number;
77
77
  }
78
+ export interface SetPinTzpkRequestBody {
79
+ /**
80
+ * 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).
81
+ */
82
+ 'pinControlId': string;
83
+ /**
84
+ * 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.
85
+ */
86
+ 'pubKey': string;
87
+ }
88
+ export interface SetTzpkResponseBody {
89
+ /**
90
+ * Base64 encoded encrypted Terminal Zone PIN Key (TZPK), encrypted with the pubKey passed as input.
91
+ */
92
+ 'tzpk': string;
93
+ }
78
94
  export interface ViewPinRequestBody {
79
95
  /**
80
96
  * 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).
@@ -99,6 +115,15 @@ export interface ViewPinResponseBody {
99
115
  * PINOperationsUsingPKIApi - axios parameter creator
100
116
  */
101
117
  export declare const PINOperationsUsingPKIApiAxiosParamCreator: (configuration?: Configuration) => {
118
+ /**
119
+ * 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.
120
+ * @summary Generate Set/Change PIN TZPK
121
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
122
+ * @param {string} [xAuditUser] Optional audit user header
123
+ * @param {*} [options] Override http request option.
124
+ * @throws {RequiredError}
125
+ */
126
+ setPinTzpk: (setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
102
127
  /**
103
128
  * 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.
104
129
  * @summary Retrieve Encrypted PIN
@@ -113,6 +138,15 @@ export declare const PINOperationsUsingPKIApiAxiosParamCreator: (configuration?:
113
138
  * PINOperationsUsingPKIApi - functional programming interface
114
139
  */
115
140
  export declare const PINOperationsUsingPKIApiFp: (configuration?: Configuration) => {
141
+ /**
142
+ * 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.
143
+ * @summary Generate Set/Change PIN TZPK
144
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
145
+ * @param {string} [xAuditUser] Optional audit user header
146
+ * @param {*} [options] Override http request option.
147
+ * @throws {RequiredError}
148
+ */
149
+ setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<SetTzpkResponseBody>>;
116
150
  /**
117
151
  * 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.
118
152
  * @summary Retrieve Encrypted PIN
@@ -127,6 +161,15 @@ export declare const PINOperationsUsingPKIApiFp: (configuration?: Configuration)
127
161
  * PINOperationsUsingPKIApi - factory interface
128
162
  */
129
163
  export declare const PINOperationsUsingPKIApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
164
+ /**
165
+ * 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.
166
+ * @summary Generate Set/Change PIN TZPK
167
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
168
+ * @param {string} [xAuditUser] Optional audit user header
169
+ * @param {*} [options] Override http request option.
170
+ * @throws {RequiredError}
171
+ */
172
+ setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): AxiosPromise<SetTzpkResponseBody>;
130
173
  /**
131
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.
132
175
  * @summary Retrieve Encrypted PIN
@@ -141,6 +184,15 @@ export declare const PINOperationsUsingPKIApiFactory: (configuration?: Configura
141
184
  * PINOperationsUsingPKIApi - object-oriented interface
142
185
  */
143
186
  export declare class PINOperationsUsingPKIApi extends BaseAPI {
187
+ /**
188
+ * 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.
189
+ * @summary Generate Set/Change PIN TZPK
190
+ * @param {SetPinTzpkRequestBody} setPinTzpkRequestBody Request payload for generating a temporary PIN encryption key.
191
+ * @param {string} [xAuditUser] Optional audit user header
192
+ * @param {*} [options] Override http request option.
193
+ * @throws {RequiredError}
194
+ */
195
+ setPinTzpk(setPinTzpkRequestBody: SetPinTzpkRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<SetTzpkResponseBody, any, {}>>;
144
196
  /**
145
197
  * 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.
146
198
  * @summary Retrieve Encrypted PIN