@enfuce/nextgen-sdk 0.0.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 (313) hide show
  1. package/dist/authorisation-control/api.d.ts +771 -0
  2. package/dist/authorisation-control/api.js +240 -0
  3. package/dist/authorisation-control/base.d.ts +66 -0
  4. package/dist/authorisation-control/base.js +65 -0
  5. package/dist/authorisation-control/common.d.ts +65 -0
  6. package/dist/authorisation-control/common.js +161 -0
  7. package/dist/authorisation-control/configuration.d.ts +91 -0
  8. package/dist/authorisation-control/configuration.js +44 -0
  9. package/dist/authorisation-control/index.d.ts +13 -0
  10. package/dist/authorisation-control/index.js +31 -0
  11. package/dist/card/api.d.ts +2065 -0
  12. package/dist/card/api.js +1406 -0
  13. package/dist/card/base.d.ts +66 -0
  14. package/dist/card/base.js +65 -0
  15. package/dist/card/common.d.ts +65 -0
  16. package/dist/card/common.js +161 -0
  17. package/dist/card/configuration.d.ts +91 -0
  18. package/dist/card/configuration.js +44 -0
  19. package/dist/card/index.d.ts +13 -0
  20. package/dist/card/index.js +31 -0
  21. package/dist/cardholder/api.d.ts +1890 -0
  22. package/dist/cardholder/api.js +1239 -0
  23. package/dist/cardholder/base.d.ts +66 -0
  24. package/dist/cardholder/base.js +65 -0
  25. package/dist/cardholder/common.d.ts +65 -0
  26. package/dist/cardholder/common.js +161 -0
  27. package/dist/cardholder/configuration.d.ts +91 -0
  28. package/dist/cardholder/configuration.js +44 -0
  29. package/dist/cardholder/index.d.ts +13 -0
  30. package/dist/cardholder/index.js +31 -0
  31. package/dist/cards/api.d.ts +78 -0
  32. package/dist/cards/api.js +142 -0
  33. package/dist/cards/base.d.ts +66 -0
  34. package/dist/cards/base.js +65 -0
  35. package/dist/cards/common.d.ts +65 -0
  36. package/dist/cards/common.js +161 -0
  37. package/dist/cards/configuration.d.ts +91 -0
  38. package/dist/cards/configuration.js +44 -0
  39. package/dist/cards/index.d.ts +13 -0
  40. package/dist/cards/index.js +31 -0
  41. package/dist/clearing-file-copy/api.d.ts +1245 -0
  42. package/dist/clearing-file-copy/api.js +139 -0
  43. package/dist/clearing-file-copy/base.d.ts +66 -0
  44. package/dist/clearing-file-copy/base.js +65 -0
  45. package/dist/clearing-file-copy/common.d.ts +65 -0
  46. package/dist/clearing-file-copy/common.js +161 -0
  47. package/dist/clearing-file-copy/configuration.d.ts +91 -0
  48. package/dist/clearing-file-copy/configuration.js +44 -0
  49. package/dist/clearing-file-copy/index.d.ts +13 -0
  50. package/dist/clearing-file-copy/index.js +31 -0
  51. package/dist/esm/authorisation-control/api.d.ts +771 -0
  52. package/dist/esm/authorisation-control/api.js +233 -0
  53. package/dist/esm/authorisation-control/base.d.ts +66 -0
  54. package/dist/esm/authorisation-control/base.js +60 -0
  55. package/dist/esm/authorisation-control/common.d.ts +65 -0
  56. package/dist/esm/authorisation-control/common.js +149 -0
  57. package/dist/esm/authorisation-control/configuration.d.ts +91 -0
  58. package/dist/esm/authorisation-control/configuration.js +40 -0
  59. package/dist/esm/authorisation-control/index.d.ts +13 -0
  60. package/dist/esm/authorisation-control/index.js +15 -0
  61. package/dist/esm/card/api.d.ts +2065 -0
  62. package/dist/esm/card/api.js +1379 -0
  63. package/dist/esm/card/base.d.ts +66 -0
  64. package/dist/esm/card/base.js +60 -0
  65. package/dist/esm/card/common.d.ts +65 -0
  66. package/dist/esm/card/common.js +149 -0
  67. package/dist/esm/card/configuration.d.ts +91 -0
  68. package/dist/esm/card/configuration.js +40 -0
  69. package/dist/esm/card/index.d.ts +13 -0
  70. package/dist/esm/card/index.js +15 -0
  71. package/dist/esm/cardholder/api.d.ts +1890 -0
  72. package/dist/esm/cardholder/api.js +1220 -0
  73. package/dist/esm/cardholder/base.d.ts +66 -0
  74. package/dist/esm/cardholder/base.js +60 -0
  75. package/dist/esm/cardholder/common.d.ts +65 -0
  76. package/dist/esm/cardholder/common.js +149 -0
  77. package/dist/esm/cardholder/configuration.d.ts +91 -0
  78. package/dist/esm/cardholder/configuration.js +40 -0
  79. package/dist/esm/cardholder/index.d.ts +13 -0
  80. package/dist/esm/cardholder/index.js +15 -0
  81. package/dist/esm/cards/api.d.ts +78 -0
  82. package/dist/esm/cards/api.js +135 -0
  83. package/dist/esm/cards/base.d.ts +66 -0
  84. package/dist/esm/cards/base.js +60 -0
  85. package/dist/esm/cards/common.d.ts +65 -0
  86. package/dist/esm/cards/common.js +149 -0
  87. package/dist/esm/cards/configuration.d.ts +91 -0
  88. package/dist/esm/cards/configuration.js +40 -0
  89. package/dist/esm/cards/index.d.ts +13 -0
  90. package/dist/esm/cards/index.js +15 -0
  91. package/dist/esm/clearing-file-copy/api.d.ts +1245 -0
  92. package/dist/esm/clearing-file-copy/api.js +136 -0
  93. package/dist/esm/clearing-file-copy/base.d.ts +66 -0
  94. package/dist/esm/clearing-file-copy/base.js +60 -0
  95. package/dist/esm/clearing-file-copy/common.d.ts +65 -0
  96. package/dist/esm/clearing-file-copy/common.js +149 -0
  97. package/dist/esm/clearing-file-copy/configuration.d.ts +91 -0
  98. package/dist/esm/clearing-file-copy/configuration.js +40 -0
  99. package/dist/esm/clearing-file-copy/index.d.ts +13 -0
  100. package/dist/esm/clearing-file-copy/index.js +15 -0
  101. package/dist/esm/index.d.ts +12 -0
  102. package/dist/esm/index.js +14 -0
  103. package/dist/esm/issuer-events/api.d.ts +1721 -0
  104. package/dist/esm/issuer-events/api.js +940 -0
  105. package/dist/esm/issuer-events/base.d.ts +66 -0
  106. package/dist/esm/issuer-events/base.js +60 -0
  107. package/dist/esm/issuer-events/common.d.ts +65 -0
  108. package/dist/esm/issuer-events/common.js +149 -0
  109. package/dist/esm/issuer-events/configuration.d.ts +91 -0
  110. package/dist/esm/issuer-events/configuration.js +40 -0
  111. package/dist/esm/issuer-events/index.d.ts +13 -0
  112. package/dist/esm/issuer-events/index.js +15 -0
  113. package/dist/esm/oauth/axios.d.ts +14 -0
  114. package/dist/esm/oauth/axios.js +58 -0
  115. package/dist/esm/oauth/clientCredentials.d.ts +24 -0
  116. package/dist/esm/oauth/clientCredentials.js +59 -0
  117. package/dist/esm/oauth/index.d.ts +3 -0
  118. package/dist/esm/oauth/index.js +24 -0
  119. package/dist/esm/oauth/tokenManager.d.ts +38 -0
  120. package/dist/esm/oauth/tokenManager.js +77 -0
  121. package/dist/esm/pin/api.d.ts +329 -0
  122. package/dist/esm/pin/api.js +341 -0
  123. package/dist/esm/pin/base.d.ts +66 -0
  124. package/dist/esm/pin/base.js +60 -0
  125. package/dist/esm/pin/common.d.ts +65 -0
  126. package/dist/esm/pin/common.js +149 -0
  127. package/dist/esm/pin/configuration.d.ts +91 -0
  128. package/dist/esm/pin/configuration.js +40 -0
  129. package/dist/esm/pin/index.d.ts +13 -0
  130. package/dist/esm/pin/index.js +15 -0
  131. package/dist/esm/threeds/api.d.ts +104 -0
  132. package/dist/esm/threeds/api.js +136 -0
  133. package/dist/esm/threeds/base.d.ts +66 -0
  134. package/dist/esm/threeds/base.js +60 -0
  135. package/dist/esm/threeds/common.d.ts +65 -0
  136. package/dist/esm/threeds/common.js +149 -0
  137. package/dist/esm/threeds/configuration.d.ts +91 -0
  138. package/dist/esm/threeds/configuration.js +40 -0
  139. package/dist/esm/threeds/index.d.ts +13 -0
  140. package/dist/esm/threeds/index.js +15 -0
  141. package/dist/esm/threeds-oob/api.d.ts +241 -0
  142. package/dist/esm/threeds-oob/api.js +141 -0
  143. package/dist/esm/threeds-oob/base.d.ts +66 -0
  144. package/dist/esm/threeds-oob/base.js +60 -0
  145. package/dist/esm/threeds-oob/common.d.ts +65 -0
  146. package/dist/esm/threeds-oob/common.js +149 -0
  147. package/dist/esm/threeds-oob/configuration.d.ts +91 -0
  148. package/dist/esm/threeds-oob/configuration.js +40 -0
  149. package/dist/esm/threeds-oob/index.d.ts +13 -0
  150. package/dist/esm/threeds-oob/index.js +15 -0
  151. package/dist/esm/transaction-event/api.d.ts +1082 -0
  152. package/dist/esm/transaction-event/api.js +163 -0
  153. package/dist/esm/transaction-event/base.d.ts +66 -0
  154. package/dist/esm/transaction-event/base.js +60 -0
  155. package/dist/esm/transaction-event/common.d.ts +65 -0
  156. package/dist/esm/transaction-event/common.js +149 -0
  157. package/dist/esm/transaction-event/configuration.d.ts +91 -0
  158. package/dist/esm/transaction-event/configuration.js +40 -0
  159. package/dist/esm/transaction-event/index.d.ts +13 -0
  160. package/dist/esm/transaction-event/index.js +15 -0
  161. package/dist/esm/wallet/api.d.ts +1385 -0
  162. package/dist/esm/wallet/api.js +1342 -0
  163. package/dist/esm/wallet/base.d.ts +66 -0
  164. package/dist/esm/wallet/base.js +60 -0
  165. package/dist/esm/wallet/common.d.ts +65 -0
  166. package/dist/esm/wallet/common.js +149 -0
  167. package/dist/esm/wallet/configuration.d.ts +91 -0
  168. package/dist/esm/wallet/configuration.js +40 -0
  169. package/dist/esm/wallet/index.d.ts +13 -0
  170. package/dist/esm/wallet/index.js +15 -0
  171. package/dist/index.d.ts +12 -0
  172. package/dist/index.js +17 -0
  173. package/dist/issuer-events/api.d.ts +1721 -0
  174. package/dist/issuer-events/api.js +947 -0
  175. package/dist/issuer-events/base.d.ts +66 -0
  176. package/dist/issuer-events/base.js +65 -0
  177. package/dist/issuer-events/common.d.ts +65 -0
  178. package/dist/issuer-events/common.js +161 -0
  179. package/dist/issuer-events/configuration.d.ts +91 -0
  180. package/dist/issuer-events/configuration.js +44 -0
  181. package/dist/issuer-events/index.d.ts +13 -0
  182. package/dist/issuer-events/index.js +31 -0
  183. package/dist/oauth/axios.d.ts +14 -0
  184. package/dist/oauth/axios.js +61 -0
  185. package/dist/oauth/clientCredentials.d.ts +24 -0
  186. package/dist/oauth/clientCredentials.js +63 -0
  187. package/dist/oauth/index.d.ts +3 -0
  188. package/dist/oauth/index.js +31 -0
  189. package/dist/oauth/tokenManager.d.ts +38 -0
  190. package/dist/oauth/tokenManager.js +81 -0
  191. package/dist/pin/api.d.ts +329 -0
  192. package/dist/pin/api.js +352 -0
  193. package/dist/pin/base.d.ts +66 -0
  194. package/dist/pin/base.js +65 -0
  195. package/dist/pin/common.d.ts +65 -0
  196. package/dist/pin/common.js +161 -0
  197. package/dist/pin/configuration.d.ts +91 -0
  198. package/dist/pin/configuration.js +44 -0
  199. package/dist/pin/index.d.ts +13 -0
  200. package/dist/pin/index.js +31 -0
  201. package/dist/threeds/api.d.ts +104 -0
  202. package/dist/threeds/api.js +143 -0
  203. package/dist/threeds/base.d.ts +66 -0
  204. package/dist/threeds/base.js +65 -0
  205. package/dist/threeds/common.d.ts +65 -0
  206. package/dist/threeds/common.js +161 -0
  207. package/dist/threeds/configuration.d.ts +91 -0
  208. package/dist/threeds/configuration.js +44 -0
  209. package/dist/threeds/index.d.ts +13 -0
  210. package/dist/threeds/index.js +31 -0
  211. package/dist/threeds-oob/api.d.ts +241 -0
  212. package/dist/threeds-oob/api.js +148 -0
  213. package/dist/threeds-oob/base.d.ts +66 -0
  214. package/dist/threeds-oob/base.js +65 -0
  215. package/dist/threeds-oob/common.d.ts +65 -0
  216. package/dist/threeds-oob/common.js +161 -0
  217. package/dist/threeds-oob/configuration.d.ts +91 -0
  218. package/dist/threeds-oob/configuration.js +44 -0
  219. package/dist/threeds-oob/index.d.ts +13 -0
  220. package/dist/threeds-oob/index.js +31 -0
  221. package/dist/transaction-event/api.d.ts +1082 -0
  222. package/dist/transaction-event/api.js +166 -0
  223. package/dist/transaction-event/base.d.ts +66 -0
  224. package/dist/transaction-event/base.js +65 -0
  225. package/dist/transaction-event/common.d.ts +65 -0
  226. package/dist/transaction-event/common.js +161 -0
  227. package/dist/transaction-event/configuration.d.ts +91 -0
  228. package/dist/transaction-event/configuration.js +44 -0
  229. package/dist/transaction-event/index.d.ts +13 -0
  230. package/dist/transaction-event/index.js +31 -0
  231. package/dist/wallet/api.d.ts +1385 -0
  232. package/dist/wallet/api.js +1377 -0
  233. package/dist/wallet/base.d.ts +66 -0
  234. package/dist/wallet/base.js +65 -0
  235. package/dist/wallet/common.d.ts +65 -0
  236. package/dist/wallet/common.js +161 -0
  237. package/dist/wallet/configuration.d.ts +91 -0
  238. package/dist/wallet/configuration.js +44 -0
  239. package/dist/wallet/index.d.ts +13 -0
  240. package/dist/wallet/index.js +31 -0
  241. package/package.json +25 -0
  242. package/src/authorisation-control/api.ts +876 -0
  243. package/src/authorisation-control/base.ts +86 -0
  244. package/src/authorisation-control/common.ts +150 -0
  245. package/src/authorisation-control/configuration.ts +115 -0
  246. package/src/authorisation-control/index.ts +18 -0
  247. package/src/card/api.ts +2792 -0
  248. package/src/card/base.ts +86 -0
  249. package/src/card/common.ts +150 -0
  250. package/src/card/configuration.ts +115 -0
  251. package/src/card/index.ts +18 -0
  252. package/src/cardholder/api.ts +2244 -0
  253. package/src/cardholder/base.ts +86 -0
  254. package/src/cardholder/common.ts +150 -0
  255. package/src/cardholder/configuration.ts +115 -0
  256. package/src/cardholder/index.ts +18 -0
  257. package/src/cards/api.ts +141 -0
  258. package/src/cards/base.ts +86 -0
  259. package/src/cards/common.ts +150 -0
  260. package/src/cards/configuration.ts +115 -0
  261. package/src/cards/index.ts +18 -0
  262. package/src/clearing-file-copy/api.ts +1309 -0
  263. package/src/clearing-file-copy/base.ts +86 -0
  264. package/src/clearing-file-copy/common.ts +150 -0
  265. package/src/clearing-file-copy/configuration.ts +115 -0
  266. package/src/clearing-file-copy/index.ts +18 -0
  267. package/src/index.ts +16 -0
  268. package/src/issuer-events/api.ts +1926 -0
  269. package/src/issuer-events/base.ts +86 -0
  270. package/src/issuer-events/common.ts +150 -0
  271. package/src/issuer-events/configuration.ts +115 -0
  272. package/src/issuer-events/index.ts +18 -0
  273. package/src/oauth/axios.ts +60 -0
  274. package/src/oauth/clientCredentials.ts +72 -0
  275. package/src/oauth/index.ts +24 -0
  276. package/src/oauth/tokenManager.ts +85 -0
  277. package/src/pin/api.ts +507 -0
  278. package/src/pin/base.ts +86 -0
  279. package/src/pin/common.ts +150 -0
  280. package/src/pin/configuration.ts +115 -0
  281. package/src/pin/index.ts +18 -0
  282. package/src/threeds/api.ts +173 -0
  283. package/src/threeds/base.ts +86 -0
  284. package/src/threeds/common.ts +150 -0
  285. package/src/threeds/configuration.ts +115 -0
  286. package/src/threeds/index.ts +18 -0
  287. package/src/threeds-oob/api.ts +311 -0
  288. package/src/threeds-oob/base.ts +86 -0
  289. package/src/threeds-oob/common.ts +150 -0
  290. package/src/threeds-oob/configuration.ts +115 -0
  291. package/src/threeds-oob/index.ts +18 -0
  292. package/src/transaction-event/api.ts +1152 -0
  293. package/src/transaction-event/base.ts +86 -0
  294. package/src/transaction-event/common.ts +150 -0
  295. package/src/transaction-event/configuration.ts +115 -0
  296. package/src/transaction-event/index.ts +18 -0
  297. package/src/wallet/api.ts +2083 -0
  298. package/src/wallet/base.ts +86 -0
  299. package/src/wallet/common.ts +150 -0
  300. package/src/wallet/configuration.ts +115 -0
  301. package/src/wallet/index.ts +18 -0
  302. package/test/authorisation-control.test.ts +71 -0
  303. package/test/card.test.ts +39 -0
  304. package/test/cardholder.test.ts +51 -0
  305. package/test/cards.test.ts +35 -0
  306. package/test/issuer-events.test.ts +55 -0
  307. package/test/oauth.test.ts +205 -0
  308. package/test/pin.test.ts +39 -0
  309. package/test/threeds-oob.test.ts +90 -0
  310. package/test/threeds.test.ts +55 -0
  311. package/test/wallet.test.ts +62 -0
  312. package/tsconfig.esm.json +7 -0
  313. package/tsconfig.json +14 -0
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.clientCredentialsFetcher = clientCredentialsFetcher;
13
+ exports.clientCredentials = clientCredentials;
14
+ /*
15
+ * Enfuce nextgen SDK — OAuth token-management helper.
16
+ *
17
+ * HAND-WRITTEN, NOT GENERATED. This module (src/oauth) is authored by hand and
18
+ * preserved across SDK regeneration (see scripts/generate.sh). Do not expect
19
+ * OpenAPI Generator to (re)produce it.
20
+ */
21
+ const axios_1 = require("axios");
22
+ const tokenManager_1 = require("./tokenManager");
23
+ /**
24
+ * Builds a {@link TokenFetcher} that performs the OAuth2 `client_credentials`
25
+ * grant: a form-encoded POST to `config.tokenUrl`, parsing `access_token` and
26
+ * `expires_in`. Server-side only — never ship a client secret to a browser.
27
+ */
28
+ function clientCredentialsFetcher(config) {
29
+ var _a, _b;
30
+ const http = (_a = config.axiosInstance) !== null && _a !== void 0 ? _a : axios_1.default.create();
31
+ const style = (_b = config.authStyle) !== null && _b !== void 0 ? _b : 'basic';
32
+ return () => __awaiter(this, void 0, void 0, function* () {
33
+ var _a, _b;
34
+ const form = new URLSearchParams();
35
+ form.set('grant_type', 'client_credentials');
36
+ if (config.scopes && config.scopes.length > 0) {
37
+ form.set('scope', config.scopes.join(' '));
38
+ }
39
+ for (const [key, value] of Object.entries((_a = config.extraParams) !== null && _a !== void 0 ? _a : {})) {
40
+ form.set(key, value);
41
+ }
42
+ const options = {
43
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
44
+ };
45
+ if (style === 'basic') {
46
+ options.auth = { username: config.clientId, password: config.clientSecret };
47
+ }
48
+ else {
49
+ form.set('client_id', config.clientId);
50
+ form.set('client_secret', config.clientSecret);
51
+ }
52
+ const response = yield http.post(config.tokenUrl, form.toString(), options);
53
+ const data = response.data;
54
+ if (!data || !data.access_token) {
55
+ throw new Error('token response has no access_token field');
56
+ }
57
+ return { accessToken: data.access_token, expiresInSeconds: (_b = data.expires_in) !== null && _b !== void 0 ? _b : 0 };
58
+ });
59
+ }
60
+ /** Convenience: a caching {@link TokenManager} backed by the client-credentials grant. */
61
+ function clientCredentials(config, skewSeconds = 60) {
62
+ return new tokenManager_1.TokenManager(clientCredentialsFetcher(config), skewSeconds);
63
+ }
@@ -0,0 +1,3 @@
1
+ export { AccessToken, TokenFetcher, TokenManager } from './tokenManager';
2
+ export { OAuthConfig, clientCredentials, clientCredentialsFetcher } from './clientCredentials';
3
+ export { createOAuthAxios } from './axios';
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOAuthAxios = exports.clientCredentialsFetcher = exports.clientCredentials = exports.TokenManager = void 0;
4
+ /*
5
+ * Enfuce nextgen SDK — OAuth token-management helper.
6
+ *
7
+ * HAND-WRITTEN, NOT GENERATED. This module (src/oauth) is authored by hand and
8
+ * preserved across SDK regeneration (see scripts/generate.sh). It is re-exported
9
+ * from the package barrel as `oauth`:
10
+ *
11
+ * import { oauth, card } from '@enfuce/nextgen-sdk';
12
+ *
13
+ * const tokens = oauth.clientCredentials({
14
+ * tokenUrl: 'https://auth.example.com/oauth/token',
15
+ * clientId: 'my-id',
16
+ * clientSecret: 'my-secret',
17
+ * scopes: ['cards:read'],
18
+ * });
19
+ * const http = oauth.createOAuthAxios(tokens);
20
+ * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
21
+ * const api = new card.CardApi(config, undefined, http);
22
+ *
23
+ * Server-side only — a client secret must never ship to a browser.
24
+ */
25
+ var tokenManager_1 = require("./tokenManager");
26
+ Object.defineProperty(exports, "TokenManager", { enumerable: true, get: function () { return tokenManager_1.TokenManager; } });
27
+ var clientCredentials_1 = require("./clientCredentials");
28
+ Object.defineProperty(exports, "clientCredentials", { enumerable: true, get: function () { return clientCredentials_1.clientCredentials; } });
29
+ Object.defineProperty(exports, "clientCredentialsFetcher", { enumerable: true, get: function () { return clientCredentials_1.clientCredentialsFetcher; } });
30
+ var axios_1 = require("./axios");
31
+ Object.defineProperty(exports, "createOAuthAxios", { enumerable: true, get: function () { return axios_1.createOAuthAxios; } });
@@ -0,0 +1,38 @@
1
+ /** The result of fetching an access token. */
2
+ export interface AccessToken {
3
+ accessToken: string;
4
+ /** Lifetime in seconds (OAuth2 `expires_in`); <= 0 means unknown → refetch every call. */
5
+ expiresInSeconds: number;
6
+ }
7
+ /** Fetches a fresh access token. Supply your own to support any grant/source. */
8
+ export type TokenFetcher = () => Promise<AccessToken>;
9
+ /**
10
+ * Caches an access token and refreshes it before expiry. Plug it into a generated
11
+ * client's `Configuration`:
12
+ *
13
+ * ```ts
14
+ * const tokens = new TokenManager(fetcher);
15
+ * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
16
+ * ```
17
+ *
18
+ * A token is considered expired once the clock passes `expiry - skew`. Concurrent
19
+ * refreshes share a single in-flight promise, so the token endpoint is hit once.
20
+ */
21
+ export declare class TokenManager {
22
+ private readonly fetcher;
23
+ private readonly skewSeconds;
24
+ private readonly now;
25
+ private token?;
26
+ private expiresAtMs?;
27
+ private inflight?;
28
+ constructor(fetcher: TokenFetcher, skewSeconds?: number, now?: () => number);
29
+ /** Returns a valid access token, refreshing first if necessary. */
30
+ getToken(): Promise<string>;
31
+ /**
32
+ * Forces a refresh. If `staleToken` is given and the cached token has already
33
+ * changed, returns the current token without refetching — so two concurrent
34
+ * 401s trigger a single refresh.
35
+ */
36
+ forceRefresh(staleToken?: string): Promise<string>;
37
+ private refresh;
38
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /*
3
+ * Enfuce nextgen SDK — OAuth token-management helper.
4
+ *
5
+ * HAND-WRITTEN, NOT GENERATED. This module (src/oauth) is authored by hand and
6
+ * preserved across SDK regeneration (see scripts/generate.sh). Do not expect
7
+ * OpenAPI Generator to (re)produce it.
8
+ */
9
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11
+ return new (P || (P = Promise))(function (resolve, reject) {
12
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
16
+ });
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.TokenManager = void 0;
20
+ /**
21
+ * Caches an access token and refreshes it before expiry. Plug it into a generated
22
+ * client's `Configuration`:
23
+ *
24
+ * ```ts
25
+ * const tokens = new TokenManager(fetcher);
26
+ * const config = new card.Configuration({ accessToken: () => tokens.getToken() });
27
+ * ```
28
+ *
29
+ * A token is considered expired once the clock passes `expiry - skew`. Concurrent
30
+ * refreshes share a single in-flight promise, so the token endpoint is hit once.
31
+ */
32
+ class TokenManager {
33
+ constructor(fetcher, skewSeconds = 60, now = Date.now) {
34
+ this.fetcher = fetcher;
35
+ this.skewSeconds = skewSeconds;
36
+ this.now = now;
37
+ }
38
+ /** Returns a valid access token, refreshing first if necessary. */
39
+ getToken() {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (this.token !== undefined &&
42
+ this.expiresAtMs !== undefined &&
43
+ this.now() < this.expiresAtMs - this.skewSeconds * 1000) {
44
+ return this.token;
45
+ }
46
+ return this.refresh();
47
+ });
48
+ }
49
+ /**
50
+ * Forces a refresh. If `staleToken` is given and the cached token has already
51
+ * changed, returns the current token without refetching — so two concurrent
52
+ * 401s trigger a single refresh.
53
+ */
54
+ forceRefresh(staleToken) {
55
+ if (staleToken !== undefined && this.token !== undefined && this.token !== staleToken) {
56
+ return Promise.resolve(this.token);
57
+ }
58
+ return this.refresh();
59
+ }
60
+ refresh() {
61
+ if (this.inflight !== undefined) {
62
+ return this.inflight;
63
+ }
64
+ this.inflight = (() => __awaiter(this, void 0, void 0, function* () {
65
+ try {
66
+ const fetched = yield this.fetcher();
67
+ this.token = fetched.accessToken;
68
+ this.expiresAtMs =
69
+ fetched.expiresInSeconds > 0
70
+ ? this.now() + fetched.expiresInSeconds * 1000
71
+ : undefined;
72
+ return this.token;
73
+ }
74
+ finally {
75
+ this.inflight = undefined;
76
+ }
77
+ }))();
78
+ return this.inflight;
79
+ }
80
+ }
81
+ exports.TokenManager = TokenManager;
@@ -0,0 +1,329 @@
1
+ /**
2
+ * PIN API
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 1
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { Configuration } from './configuration';
13
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
+ import type { RequestArgs } from './base';
15
+ import { BaseAPI } from './base';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface ChangePinRequestBody
20
+ */
21
+ export interface ChangePinRequestBody {
22
+ /**
23
+ * The encrypted PIN block is in ISO Format 1 and is represented in hexadecimal.
24
+ * @type {string}
25
+ * @memberof ChangePinRequestBody
26
+ */
27
+ 'pinBlock': string;
28
+ /**
29
+ * Unique identifier of a resource.
30
+ * @type {string}
31
+ * @memberof ChangePinRequestBody
32
+ */
33
+ 'cardId': string;
34
+ /**
35
+ * The sequence number of the card version, this value is also known as PSN (pan sequence number)
36
+ * @type {number}
37
+ * @memberof ChangePinRequestBody
38
+ */
39
+ 'sequenceNumber'?: number;
40
+ /**
41
+ * Pre-shared ZPK key index number. If it is not specified, the first key is used by default.
42
+ * @type {number}
43
+ * @memberof ChangePinRequestBody
44
+ */
45
+ 'zpkIndex'?: number;
46
+ }
47
+ /**
48
+ *
49
+ * @export
50
+ * @interface ErrorResponse
51
+ */
52
+ export interface ErrorResponse {
53
+ /**
54
+ * The problem type.
55
+ * @type {string}
56
+ * @memberof ErrorResponse
57
+ */
58
+ 'type'?: string;
59
+ /**
60
+ * The reason phrase of HttpStatus.
61
+ * @type {string}
62
+ * @memberof ErrorResponse
63
+ */
64
+ 'title'?: string;
65
+ /**
66
+ * HTTP problem status.
67
+ * @type {number}
68
+ * @memberof ErrorResponse
69
+ */
70
+ 'status'?: number;
71
+ /**
72
+ * The problem detail.
73
+ * @type {string}
74
+ * @memberof ErrorResponse
75
+ */
76
+ 'detail'?: string;
77
+ /**
78
+ * The request path.
79
+ * @type {string}
80
+ * @memberof ErrorResponse
81
+ */
82
+ 'instance'?: string;
83
+ /**
84
+ * Unique error identifier.
85
+ * @type {string}
86
+ * @memberof ErrorResponse
87
+ */
88
+ 'id'?: string;
89
+ /**
90
+ * Date-time when error occurred.
91
+ * @type {string}
92
+ * @memberof ErrorResponse
93
+ */
94
+ 'timestamp'?: string;
95
+ }
96
+ /**
97
+ *
98
+ * @export
99
+ * @interface SetPinRequestBody
100
+ */
101
+ export interface SetPinRequestBody {
102
+ /**
103
+ * The encrypted PIN block is in ISO Format 1 and is represented in hexadecimal.
104
+ * @type {string}
105
+ * @memberof SetPinRequestBody
106
+ */
107
+ 'pinBlock': string;
108
+ /**
109
+ * Unique identifier of a resource.
110
+ * @type {string}
111
+ * @memberof SetPinRequestBody
112
+ */
113
+ 'cardId': string;
114
+ /**
115
+ * Pre-shared ZPK key index number. If it is not specified, the first key is used by default.
116
+ * @type {number}
117
+ * @memberof SetPinRequestBody
118
+ */
119
+ 'zpkIndex'?: number;
120
+ }
121
+ /**
122
+ *
123
+ * @export
124
+ * @interface ViewPinRequestBody
125
+ */
126
+ export interface ViewPinRequestBody {
127
+ /**
128
+ * 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).
129
+ * @type {string}
130
+ * @memberof ViewPinRequestBody
131
+ */
132
+ 'pinControlId': string;
133
+ /**
134
+ * 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.
135
+ * @type {string}
136
+ * @memberof ViewPinRequestBody
137
+ */
138
+ 'pubKey': string;
139
+ }
140
+ /**
141
+ *
142
+ * @export
143
+ * @interface ViewPinResponseBody
144
+ */
145
+ export interface ViewPinResponseBody {
146
+ /**
147
+ * Hex encoded value of the pin block (ISO PIN Block Format 1). It is 3DES (double length key) encrypted with the key from the tzpk field (which is provided in encrypted form).
148
+ * @type {string}
149
+ * @memberof ViewPinResponseBody
150
+ */
151
+ 'pinBlock': string;
152
+ /**
153
+ * Terminal Zone PIN Key (TZPK) that decrypts the generated PIN block to retrieve the actual PIN. Hex encoded value, encrypted with the pubKey passed as input. Once decrypted, this is the 3DES key used for decrypting the pin block.
154
+ * @type {string}
155
+ * @memberof ViewPinResponseBody
156
+ */
157
+ 'tzpk': string;
158
+ }
159
+ /**
160
+ * PINOperationsUsingPKIApi - axios parameter creator
161
+ * @export
162
+ */
163
+ export declare const PINOperationsUsingPKIApiAxiosParamCreator: (configuration?: Configuration) => {
164
+ /**
165
+ * 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.
166
+ * @summary Retrieve Encrypted PIN
167
+ * @param {ViewPinRequestBody} viewPinRequestBody Request payload for successful PIN retrieval.
168
+ * @param {string} [xAuditUser] Optional audit user header
169
+ * @param {*} [options] Override http request option.
170
+ * @throws {RequiredError}
171
+ */
172
+ viewPin: (viewPinRequestBody: ViewPinRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
173
+ };
174
+ /**
175
+ * PINOperationsUsingPKIApi - functional programming interface
176
+ * @export
177
+ */
178
+ export declare const PINOperationsUsingPKIApiFp: (configuration?: Configuration) => {
179
+ /**
180
+ * 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.
181
+ * @summary Retrieve Encrypted PIN
182
+ * @param {ViewPinRequestBody} viewPinRequestBody Request payload for successful PIN retrieval.
183
+ * @param {string} [xAuditUser] Optional audit user header
184
+ * @param {*} [options] Override http request option.
185
+ * @throws {RequiredError}
186
+ */
187
+ viewPin(viewPinRequestBody: ViewPinRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ViewPinResponseBody>>;
188
+ };
189
+ /**
190
+ * PINOperationsUsingPKIApi - factory interface
191
+ * @export
192
+ */
193
+ export declare const PINOperationsUsingPKIApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
194
+ /**
195
+ * 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.
196
+ * @summary Retrieve Encrypted PIN
197
+ * @param {ViewPinRequestBody} viewPinRequestBody Request payload for successful PIN retrieval.
198
+ * @param {string} [xAuditUser] Optional audit user header
199
+ * @param {*} [options] Override http request option.
200
+ * @throws {RequiredError}
201
+ */
202
+ viewPin(viewPinRequestBody: ViewPinRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): AxiosPromise<ViewPinResponseBody>;
203
+ };
204
+ /**
205
+ * PINOperationsUsingPKIApi - object-oriented interface
206
+ * @export
207
+ * @class PINOperationsUsingPKIApi
208
+ * @extends {BaseAPI}
209
+ */
210
+ export declare class PINOperationsUsingPKIApi extends BaseAPI {
211
+ /**
212
+ * 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.
213
+ * @summary Retrieve Encrypted PIN
214
+ * @param {ViewPinRequestBody} viewPinRequestBody Request payload for successful PIN retrieval.
215
+ * @param {string} [xAuditUser] Optional audit user header
216
+ * @param {*} [options] Override http request option.
217
+ * @throws {RequiredError}
218
+ * @memberof PINOperationsUsingPKIApi
219
+ */
220
+ viewPin(viewPinRequestBody: ViewPinRequestBody, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ViewPinResponseBody, any, {}>>;
221
+ }
222
+ /**
223
+ * PINOperationsWithPreSharedKeyApi - axios parameter creator
224
+ * @export
225
+ */
226
+ export declare const PINOperationsWithPreSharedKeyApiAxiosParamCreator: (configuration?: Configuration) => {
227
+ /**
228
+ * Send a request to this endpoint to change PIN of a specific card version. <Note><ul><li>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</li><li>If sequenceNumber is not specified, the latest card version is used by default.</li></ul></Note>
229
+ * @summary Change PIN
230
+ * @param {ChangePinRequestBody} changePinRequestBody
231
+ * @param {string} [xIdempotencyKey]
232
+ * @param {string} [xAuditUser] Optional audit user header
233
+ * @param {*} [options] Override http request option.
234
+ * @throws {RequiredError}
235
+ */
236
+ changePin: (changePinRequestBody: ChangePinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
237
+ /**
238
+ * Send a request to this endpoint to set PIN for the latest card version. <Note>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</Note>
239
+ * @summary Set PIN
240
+ * @param {SetPinRequestBody} setPinRequestBody
241
+ * @param {string} [xIdempotencyKey]
242
+ * @param {string} [xAuditUser] Optional audit user header
243
+ * @param {*} [options] Override http request option.
244
+ * @throws {RequiredError}
245
+ */
246
+ setPin: (setPinRequestBody: SetPinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
247
+ };
248
+ /**
249
+ * PINOperationsWithPreSharedKeyApi - functional programming interface
250
+ * @export
251
+ */
252
+ export declare const PINOperationsWithPreSharedKeyApiFp: (configuration?: Configuration) => {
253
+ /**
254
+ * Send a request to this endpoint to change PIN of a specific card version. <Note><ul><li>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</li><li>If sequenceNumber is not specified, the latest card version is used by default.</li></ul></Note>
255
+ * @summary Change PIN
256
+ * @param {ChangePinRequestBody} changePinRequestBody
257
+ * @param {string} [xIdempotencyKey]
258
+ * @param {string} [xAuditUser] Optional audit user header
259
+ * @param {*} [options] Override http request option.
260
+ * @throws {RequiredError}
261
+ */
262
+ changePin(changePinRequestBody: ChangePinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>>;
263
+ /**
264
+ * Send a request to this endpoint to set PIN for the latest card version. <Note>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</Note>
265
+ * @summary Set PIN
266
+ * @param {SetPinRequestBody} setPinRequestBody
267
+ * @param {string} [xIdempotencyKey]
268
+ * @param {string} [xAuditUser] Optional audit user header
269
+ * @param {*} [options] Override http request option.
270
+ * @throws {RequiredError}
271
+ */
272
+ setPin(setPinRequestBody: SetPinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>>;
273
+ };
274
+ /**
275
+ * PINOperationsWithPreSharedKeyApi - factory interface
276
+ * @export
277
+ */
278
+ export declare const PINOperationsWithPreSharedKeyApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
279
+ /**
280
+ * Send a request to this endpoint to change PIN of a specific card version. <Note><ul><li>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</li><li>If sequenceNumber is not specified, the latest card version is used by default.</li></ul></Note>
281
+ * @summary Change PIN
282
+ * @param {ChangePinRequestBody} changePinRequestBody
283
+ * @param {string} [xIdempotencyKey]
284
+ * @param {string} [xAuditUser] Optional audit user header
285
+ * @param {*} [options] Override http request option.
286
+ * @throws {RequiredError}
287
+ */
288
+ changePin(changePinRequestBody: ChangePinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig): AxiosPromise<void>;
289
+ /**
290
+ * Send a request to this endpoint to set PIN for the latest card version. <Note>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</Note>
291
+ * @summary Set PIN
292
+ * @param {SetPinRequestBody} setPinRequestBody
293
+ * @param {string} [xIdempotencyKey]
294
+ * @param {string} [xAuditUser] Optional audit user header
295
+ * @param {*} [options] Override http request option.
296
+ * @throws {RequiredError}
297
+ */
298
+ setPin(setPinRequestBody: SetPinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig): AxiosPromise<void>;
299
+ };
300
+ /**
301
+ * PINOperationsWithPreSharedKeyApi - object-oriented interface
302
+ * @export
303
+ * @class PINOperationsWithPreSharedKeyApi
304
+ * @extends {BaseAPI}
305
+ */
306
+ export declare class PINOperationsWithPreSharedKeyApi extends BaseAPI {
307
+ /**
308
+ * Send a request to this endpoint to change PIN of a specific card version. <Note><ul><li>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</li><li>If sequenceNumber is not specified, the latest card version is used by default.</li></ul></Note>
309
+ * @summary Change PIN
310
+ * @param {ChangePinRequestBody} changePinRequestBody
311
+ * @param {string} [xIdempotencyKey]
312
+ * @param {string} [xAuditUser] Optional audit user header
313
+ * @param {*} [options] Override http request option.
314
+ * @throws {RequiredError}
315
+ * @memberof PINOperationsWithPreSharedKeyApi
316
+ */
317
+ changePin(changePinRequestBody: ChangePinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}>>;
318
+ /**
319
+ * Send a request to this endpoint to set PIN for the latest card version. <Note>Javascript generates an encrypted PIN block in ISO Format 1 from the cardholder-defined PIN. The PIN block is encrypted using a pre-shared double-length 3DES Zone PIN Key (ZPK). If zpkIndex is not specified, the first key is used by default.</Note>
320
+ * @summary Set PIN
321
+ * @param {SetPinRequestBody} setPinRequestBody
322
+ * @param {string} [xIdempotencyKey]
323
+ * @param {string} [xAuditUser] Optional audit user header
324
+ * @param {*} [options] Override http request option.
325
+ * @throws {RequiredError}
326
+ * @memberof PINOperationsWithPreSharedKeyApi
327
+ */
328
+ setPin(setPinRequestBody: SetPinRequestBody, xIdempotencyKey?: string, xAuditUser?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any, {}>>;
329
+ }