@ama-sdk/core 11.0.0-next.0 → 11.0.0-next.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 (268) hide show
  1. package/README.md +4 -1
  2. package/cjs/clients/api-angular-client.js +45 -23
  3. package/cjs/clients/api-beacon-client.js +64 -20
  4. package/cjs/clients/api-fetch-client.js +66 -21
  5. package/cjs/fwk/Reviver.js +7 -7
  6. package/cjs/fwk/api.helper.spec.js +20 -20
  7. package/cjs/fwk/api.helpers.js +14 -14
  8. package/cjs/fwk/core/api-client.js +1 -1
  9. package/cjs/fwk/core/base-api-constructor.js +1 -1
  10. package/cjs/fwk/date.js +9 -9
  11. package/cjs/fwk/date.spec.js +25 -25
  12. package/cjs/fwk/errors.js +3 -3
  13. package/cjs/fwk/mocks/alf-mock-adapter.js +4 -4
  14. package/cjs/fwk/mocks/base-mock-adapter.js +2 -2
  15. package/cjs/fwk/mocks/helpers.js +3 -3
  16. package/cjs/fwk/reviver.spec.js +46 -10
  17. package/cjs/plugins/additional-params/additional-params-sync.request.js +2 -2
  18. package/cjs/plugins/additional-params/additional-params.request.js +3 -3
  19. package/cjs/plugins/additional-params/additional-params.spec.js +30 -30
  20. package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  21. package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +13 -13
  22. package/cjs/plugins/api-key/api-key.request.js +2 -2
  23. package/cjs/plugins/api-key/api-key.spec.js +11 -11
  24. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +6 -5
  25. package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +33 -33
  26. package/cjs/plugins/client-facts/client-facts.request.js +3 -3
  27. package/cjs/plugins/client-facts/client-facts.spec.js +27 -27
  28. package/cjs/plugins/concurrent/concurrent.fetch.js +1 -0
  29. package/cjs/plugins/concurrent/concurrent.spec.js +4 -4
  30. package/cjs/plugins/custom-info/custom-info.spec.js +15 -15
  31. package/cjs/plugins/exception/exception.reply.js +2 -2
  32. package/cjs/plugins/exception/exception.spec.js +15 -15
  33. package/cjs/plugins/fetch-cache/fetch-cache.request.js +4 -4
  34. package/cjs/plugins/fetch-cache/fetch-cache.spec.js +20 -20
  35. package/cjs/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
  36. package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +8 -8
  37. package/cjs/plugins/json-token/json-token.reply.js +5 -5
  38. package/cjs/plugins/json-token/json-token.request.js +4 -4
  39. package/cjs/plugins/json-token/json-token.spec.js +24 -24
  40. package/cjs/plugins/keepalive/keepalive.request.js +2 -2
  41. package/cjs/plugins/keepalive/keepalive.spec.js +4 -4
  42. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +32 -40
  43. package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +30 -26
  44. package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +3 -3
  45. package/cjs/plugins/mock-intercept/mock-intercept.interface.js +2 -2
  46. package/cjs/plugins/mock-intercept/mock-intercept.request.js +3 -3
  47. package/cjs/plugins/mock-intercept/mock-intercept.spec.js +28 -28
  48. package/cjs/plugins/perf-metric/perf-metric.fetch.js +1 -1
  49. package/cjs/plugins/perf-metric/perf-metric.probe.spec.js +9 -9
  50. package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +11 -11
  51. package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +94 -94
  52. package/cjs/plugins/raw-response-info/raw-response-info.spec.js +12 -12
  53. package/cjs/plugins/retry/retry.spec.js +20 -20
  54. package/cjs/plugins/reviver/reviver.reply.js +35 -2
  55. package/cjs/plugins/reviver/reviver.spec.js +6 -6
  56. package/cjs/plugins/session-id/session-id.request.js +7 -6
  57. package/cjs/plugins/session-id/session-id.spec.js +13 -13
  58. package/cjs/plugins/si-token/si-token.spec.js +9 -9
  59. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +4 -4
  60. package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +44 -44
  61. package/cjs/plugins/timeout/timeout.fetch.js +12 -10
  62. package/cjs/plugins/timeout/timeout.spec.js +13 -13
  63. package/cjs/plugins/url-rewrite/url-rewrite.spec.js +9 -9
  64. package/cjs/plugins/wait-for/wait-for.spec.js +9 -9
  65. package/cjs/utils/crypto.js +14 -14
  66. package/cjs/utils/generic-api.js +253 -0
  67. package/cjs/utils/index.js +1 -0
  68. package/cjs/utils/json-token.js +30 -30
  69. package/cjs/utils/json-token.spec.js +31 -31
  70. package/cli/files-pack.cjs +12 -12
  71. package/cli/files-pack.cjs.map +1 -1
  72. package/esm2015/clients/api-angular-client.js +49 -27
  73. package/esm2015/clients/api-beacon-client.js +65 -21
  74. package/esm2015/clients/api-fetch-client.js +70 -25
  75. package/esm2015/clients/index.js +2 -2
  76. package/esm2015/fwk/Reviver.js +10 -7
  77. package/esm2015/fwk/api.helper.spec.js +21 -21
  78. package/esm2015/fwk/api.helpers.js +14 -14
  79. package/esm2015/fwk/core/api-client.js +1 -1
  80. package/esm2015/fwk/core/base-api-constructor.js +1 -1
  81. package/esm2015/fwk/core/index.js +2 -2
  82. package/esm2015/fwk/date.js +9 -9
  83. package/esm2015/fwk/date.spec.js +26 -26
  84. package/esm2015/fwk/errors.js +3 -3
  85. package/esm2015/fwk/index.js +10 -10
  86. package/esm2015/fwk/mocks/alf-mock-adapter.js +6 -6
  87. package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
  88. package/esm2015/fwk/mocks/helpers.js +3 -3
  89. package/esm2015/fwk/mocks/index.js +10 -10
  90. package/esm2015/fwk/mocks/random-mock-adapter.js +1 -1
  91. package/esm2015/fwk/mocks/sequential-mock-adapter.js +1 -1
  92. package/esm2015/fwk/reviver.spec.js +47 -11
  93. package/esm2015/plugins/additional-params/additional-params-sync.request.js +3 -3
  94. package/esm2015/plugins/additional-params/additional-params.request.js +3 -3
  95. package/esm2015/plugins/additional-params/additional-params.spec.js +32 -32
  96. package/esm2015/plugins/additional-params/index.js +2 -2
  97. package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
  98. package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +14 -14
  99. package/esm2015/plugins/api-configuration-override/index.js +1 -1
  100. package/esm2015/plugins/api-key/api-key.request.js +2 -2
  101. package/esm2015/plugins/api-key/api-key.spec.js +12 -12
  102. package/esm2015/plugins/api-key/index.js +1 -1
  103. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +6 -6
  104. package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +34 -34
  105. package/esm2015/plugins/bot-protection-fingerprint/index.js +1 -1
  106. package/esm2015/plugins/client-facts/client-facts.request.js +4 -4
  107. package/esm2015/plugins/client-facts/client-facts.spec.js +28 -28
  108. package/esm2015/plugins/client-facts/index.js +1 -1
  109. package/esm2015/plugins/concurrent/concurrent.fetch.js +1 -0
  110. package/esm2015/plugins/concurrent/concurrent.spec.js +5 -5
  111. package/esm2015/plugins/concurrent/index.js +1 -1
  112. package/esm2015/plugins/core/index.js +4 -4
  113. package/esm2015/plugins/custom-info/custom-info.spec.js +17 -17
  114. package/esm2015/plugins/custom-info/index.js +1 -1
  115. package/esm2015/plugins/exception/exception.reply.js +4 -4
  116. package/esm2015/plugins/exception/exception.spec.js +18 -18
  117. package/esm2015/plugins/exception/index.js +1 -1
  118. package/esm2015/plugins/fetch-cache/fetch-cache.request.js +4 -4
  119. package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +21 -21
  120. package/esm2015/plugins/fetch-cache/index.js +1 -1
  121. package/esm2015/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
  122. package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +9 -9
  123. package/esm2015/plugins/fetch-credentials/index.js +1 -1
  124. package/esm2015/plugins/index.js +25 -25
  125. package/esm2015/plugins/json-token/index.js +2 -2
  126. package/esm2015/plugins/json-token/json-token.reply.js +5 -5
  127. package/esm2015/plugins/json-token/json-token.request.js +4 -4
  128. package/esm2015/plugins/json-token/json-token.spec.js +27 -27
  129. package/esm2015/plugins/keepalive/index.js +1 -1
  130. package/esm2015/plugins/keepalive/keepalive.request.js +2 -2
  131. package/esm2015/plugins/keepalive/keepalive.spec.js +5 -5
  132. package/esm2015/plugins/mgw-mdw-auth/index.js +1 -1
  133. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +34 -42
  134. package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +32 -28
  135. package/esm2015/plugins/mock-intercept/index.js +2 -2
  136. package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -5
  137. package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +2 -2
  138. package/esm2015/plugins/mock-intercept/mock-intercept.request.js +4 -4
  139. package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +32 -32
  140. package/esm2015/plugins/perf-metric/index.js +1 -1
  141. package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -2
  142. package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +10 -10
  143. package/esm2015/plugins/pii-tokenizer/index.js +1 -1
  144. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -12
  145. package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +96 -96
  146. package/esm2015/plugins/raw-response-info/index.js +1 -1
  147. package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +14 -14
  148. package/esm2015/plugins/retry/index.js +1 -1
  149. package/esm2015/plugins/retry/retry.fetch.js +1 -1
  150. package/esm2015/plugins/retry/retry.spec.js +21 -21
  151. package/esm2015/plugins/reviver/index.js +1 -1
  152. package/esm2015/plugins/reviver/reviver.reply.js +35 -2
  153. package/esm2015/plugins/reviver/reviver.spec.js +8 -8
  154. package/esm2015/plugins/session-id/index.js +1 -1
  155. package/esm2015/plugins/session-id/session-id.request.js +8 -7
  156. package/esm2015/plugins/session-id/session-id.spec.js +14 -14
  157. package/esm2015/plugins/si-token/index.js +1 -1
  158. package/esm2015/plugins/si-token/si-token.request.js +1 -1
  159. package/esm2015/plugins/si-token/si-token.spec.js +10 -10
  160. package/esm2015/plugins/simple-api-key-authentication/index.js +1 -1
  161. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +5 -5
  162. package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +46 -46
  163. package/esm2015/plugins/timeout/index.js +1 -1
  164. package/esm2015/plugins/timeout/timeout.fetch.js +13 -11
  165. package/esm2015/plugins/timeout/timeout.spec.js +15 -15
  166. package/esm2015/plugins/url-rewrite/index.js +1 -1
  167. package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +10 -10
  168. package/esm2015/plugins/wait-for/index.js +1 -1
  169. package/esm2015/plugins/wait-for/wait-for.spec.js +10 -10
  170. package/esm2015/public_api.js +4 -4
  171. package/esm2015/utils/crypto.js +15 -15
  172. package/esm2015/utils/generic-api.js +245 -0
  173. package/esm2015/utils/index.js +6 -5
  174. package/esm2015/utils/json-token.js +32 -32
  175. package/esm2015/utils/json-token.spec.js +32 -32
  176. package/package.json +67 -40
  177. package/schematics/ng-add/index.d.ts +4 -2
  178. package/schematics/ng-add/index.d.ts.map +1 -1
  179. package/schematics/ng-add/index.js +58 -40
  180. package/schematics/ng-add/index.js.map +1 -1
  181. package/src/clients/api-angular-client.d.ts +6 -3
  182. package/src/clients/api-angular-client.d.ts.map +1 -1
  183. package/src/clients/api-angular-client.js +31 -16
  184. package/src/clients/api-angular-client.js.map +1 -1
  185. package/src/clients/api-beacon-client.d.ts +7 -5
  186. package/src/clients/api-beacon-client.d.ts.map +1 -1
  187. package/src/clients/api-beacon-client.js +24 -14
  188. package/src/clients/api-beacon-client.js.map +1 -1
  189. package/src/clients/api-fetch-client.d.ts +5 -3
  190. package/src/clients/api-fetch-client.d.ts.map +1 -1
  191. package/src/clients/api-fetch-client.js +26 -14
  192. package/src/clients/api-fetch-client.js.map +1 -1
  193. package/src/fwk/Reviver.d.ts +16 -4
  194. package/src/fwk/Reviver.d.ts.map +1 -1
  195. package/src/fwk/Reviver.js +9 -6
  196. package/src/fwk/Reviver.js.map +1 -1
  197. package/src/fwk/api.helpers.d.ts +1 -1
  198. package/src/fwk/api.helpers.d.ts.map +1 -1
  199. package/src/fwk/api.helpers.js +1 -1
  200. package/src/fwk/api.helpers.js.map +1 -1
  201. package/src/fwk/core/api-client.d.ts +36 -1
  202. package/src/fwk/core/api-client.d.ts.map +1 -1
  203. package/src/fwk/core/api-client.js.map +1 -1
  204. package/src/fwk/date.js.map +1 -1
  205. package/src/fwk/mocks/alf-mock-adapter.js.map +1 -1
  206. package/src/fwk/mocks/base-mock-adapter.js.map +1 -1
  207. package/src/fwk/mocks/helpers.js.map +1 -1
  208. package/src/fwk/mocks/random-mock-adapter.js.map +1 -1
  209. package/src/fwk/mocks/sequential-mock-adapter.js.map +1 -1
  210. package/src/plugins/additional-params/additional-params-sync.request.js.map +1 -1
  211. package/src/plugins/additional-params/additional-params.request.js.map +1 -1
  212. package/src/plugins/api-configuration-override/api-configuration-override.request.js.map +1 -1
  213. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts +1 -1
  214. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.d.ts.map +1 -1
  215. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +1 -1
  216. package/src/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js.map +1 -1
  217. package/src/plugins/client-facts/client-facts.request.js.map +1 -1
  218. package/src/plugins/concurrent/concurrent.fetch.d.ts.map +1 -1
  219. package/src/plugins/concurrent/concurrent.fetch.js +1 -0
  220. package/src/plugins/concurrent/concurrent.fetch.js.map +1 -1
  221. package/src/plugins/core/plugin.d.ts +6 -1
  222. package/src/plugins/core/plugin.d.ts.map +1 -1
  223. package/src/plugins/core/reply-plugin.d.ts +0 -2
  224. package/src/plugins/core/reply-plugin.d.ts.map +1 -1
  225. package/src/plugins/core/request-plugin.d.ts +2 -0
  226. package/src/plugins/core/request-plugin.d.ts.map +1 -1
  227. package/src/plugins/exception/exception.reply.js.map +1 -1
  228. package/src/plugins/fetch-cache/fetch-cache.request.js.map +1 -1
  229. package/src/plugins/json-token/json-token.reply.js.map +1 -1
  230. package/src/plugins/json-token/json-token.request.js.map +1 -1
  231. package/src/plugins/keepalive/keepalive.request.js.map +1 -1
  232. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts +2 -2
  233. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.d.ts.map +1 -1
  234. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +26 -28
  235. package/src/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js.map +1 -1
  236. package/src/plugins/mock-intercept/mock-intercept.fetch.js.map +1 -1
  237. package/src/plugins/mock-intercept/mock-intercept.request.js.map +1 -1
  238. package/src/plugins/perf-metric/perf-metric.fetch.js.map +1 -1
  239. package/src/plugins/pii-tokenizer/pii-tokenizer.request.d.ts.map +1 -1
  240. package/src/plugins/pii-tokenizer/pii-tokenizer.request.js.map +1 -1
  241. package/src/plugins/raw-response-info/raw-response-info.reply.js.map +1 -1
  242. package/src/plugins/retry/retry.fetch.js.map +1 -1
  243. package/src/plugins/reviver/reviver.reply.d.ts +7 -0
  244. package/src/plugins/reviver/reviver.reply.d.ts.map +1 -1
  245. package/src/plugins/reviver/reviver.reply.js +12 -1
  246. package/src/plugins/reviver/reviver.reply.js.map +1 -1
  247. package/src/plugins/session-id/session-id.request.d.ts +1 -0
  248. package/src/plugins/session-id/session-id.request.d.ts.map +1 -1
  249. package/src/plugins/session-id/session-id.request.js +1 -0
  250. package/src/plugins/session-id/session-id.request.js.map +1 -1
  251. package/src/plugins/si-token/si-token.request.js.map +1 -1
  252. package/src/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js.map +1 -1
  253. package/src/plugins/timeout/timeout.fetch.d.ts.map +1 -1
  254. package/src/plugins/timeout/timeout.fetch.js +2 -0
  255. package/src/plugins/timeout/timeout.fetch.js.map +1 -1
  256. package/src/plugins/wait-for/wait-for.fetch.js.map +1 -1
  257. package/src/utils/crypto.js.map +1 -1
  258. package/src/utils/encoder.js.map +1 -1
  259. package/src/utils/generic-api.d.ts +39 -0
  260. package/src/utils/generic-api.d.ts.map +1 -0
  261. package/src/utils/generic-api.js +43 -0
  262. package/src/utils/generic-api.js.map +1 -0
  263. package/src/utils/index.d.ts +1 -0
  264. package/src/utils/index.d.ts.map +1 -1
  265. package/src/utils/index.js +1 -0
  266. package/src/utils/index.js.map +1 -1
  267. package/src/utils/json-token.d.ts.map +1 -1
  268. package/src/utils/json-token.js.map +1 -1
@@ -122,7 +122,7 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { promisifyMsCrypto } from "./ie11";
125
+ import { promisifyMsCrypto } from './ie11';
126
126
  /**
127
127
  * Converts an ArrayBuffer to a string.
128
128
  * @param buf ArrayBuffer to convert
@@ -143,25 +143,25 @@ import { promisifyMsCrypto } from "./ie11";
143
143
  /**
144
144
  * Generates a 256 bytes AES-GCM key to be used as the ContentEncrytionKey
145
145
  */ export function generateContentEncryptionKey() {
146
- if (typeof window.msCrypto !== "undefined") {
146
+ if (typeof window.msCrypto !== 'undefined') {
147
147
  return promisifyMsCrypto(window.msCrypto.subtle.generateKey({
148
- name: "AES-GCM",
148
+ name: 'AES-GCM',
149
149
  length: 256
150
150
  }, true, [
151
- "encrypt"
151
+ 'encrypt'
152
152
  ]));
153
153
  }
154
154
  return window.crypto.subtle.generateKey({
155
- name: "AES-GCM",
155
+ name: 'AES-GCM',
156
156
  length: 256
157
157
  }, true, [
158
- "encrypt"
158
+ 'encrypt'
159
159
  ]);
160
160
  }
161
161
  /**
162
162
  * Generates an Initialization Vector of 96 bytes
163
163
  */ export function generateIV() {
164
- if (typeof window.msCrypto !== "undefined") {
164
+ if (typeof window.msCrypto !== 'undefined') {
165
165
  return window.msCrypto.getRandomValues(new Uint8Array(12));
166
166
  }
167
167
  return window.crypto.getRandomValues(new Uint8Array(12));
@@ -179,13 +179,13 @@ function _wrapContentEncryptionKey() {
179
179
  return _ts_generator(this, function(_state) {
180
180
  switch(_state.label){
181
181
  case 0:
182
- if (!(typeof window.msCrypto !== "undefined")) return [
182
+ if (!(typeof window.msCrypto !== 'undefined')) return [
183
183
  3,
184
184
  2
185
185
  ];
186
186
  return [
187
187
  4,
188
- promisifyMsCrypto(window.msCrypto.subtle.exportKey("raw", contentEncryptionKey))
188
+ promisifyMsCrypto(window.msCrypto.subtle.exportKey('raw', contentEncryptionKey))
189
189
  ];
190
190
  case 1:
191
191
  bufferCek = _state.sent();
@@ -193,15 +193,15 @@ function _wrapContentEncryptionKey() {
193
193
  return [
194
194
  2,
195
195
  promisifyMsCrypto(window.msCrypto.subtle.encrypt({
196
- name: "RSA-OAEP",
197
- hash: "SHA-256"
196
+ name: 'RSA-OAEP',
197
+ hash: 'SHA-256'
198
198
  }, publicKey, new Uint8Array(bufferCek)))
199
199
  ];
200
200
  case 2:
201
201
  return [
202
202
  2,
203
- window.crypto.subtle.wrapKey("raw", contentEncryptionKey, publicKey, {
204
- name: "RSA-OAEP"
203
+ window.crypto.subtle.wrapKey('raw', contentEncryptionKey, publicKey, {
204
+ name: 'RSA-OAEP'
205
205
  })
206
206
  ];
207
207
  }
@@ -226,14 +226,14 @@ function _encryptPayload() {
226
226
  switch(_state.label){
227
227
  case 0:
228
228
  aesParams = {
229
- name: "AES-GCM",
229
+ name: 'AES-GCM',
230
230
  iv: iv,
231
231
  tagLength: authenticationTagLength
232
232
  };
233
233
  if (additionalAuthenticatedData) {
234
234
  aesParams.additionalData = additionalAuthenticatedData;
235
235
  }
236
- if (!(typeof window.msCrypto !== "undefined")) return [
236
+ if (!(typeof window.msCrypto !== 'undefined')) return [
237
237
  3,
238
238
  2
239
239
  ];
@@ -0,0 +1,245 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
+ try {
3
+ var info = gen[key](arg);
4
+ var value = info.value;
5
+ } catch (error) {
6
+ reject(error);
7
+ return;
8
+ }
9
+ if (info.done) {
10
+ resolve(value);
11
+ } else {
12
+ Promise.resolve(value).then(_next, _throw);
13
+ }
14
+ }
15
+ function _async_to_generator(fn) {
16
+ return function() {
17
+ var self = this, args = arguments;
18
+ return new Promise(function(resolve, reject) {
19
+ var gen = fn.apply(self, args);
20
+ function _next(value) {
21
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
+ }
23
+ function _throw(err) {
24
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
+ }
26
+ _next(undefined);
27
+ });
28
+ };
29
+ }
30
+ function _class_call_check(instance, Constructor) {
31
+ if (!(instance instanceof Constructor)) {
32
+ throw new TypeError("Cannot call a class as a function");
33
+ }
34
+ }
35
+ function _defineProperties(target, props) {
36
+ for(var i = 0; i < props.length; i++){
37
+ var descriptor = props[i];
38
+ descriptor.enumerable = descriptor.enumerable || false;
39
+ descriptor.configurable = true;
40
+ if ("value" in descriptor) descriptor.writable = true;
41
+ Object.defineProperty(target, descriptor.key, descriptor);
42
+ }
43
+ }
44
+ function _create_class(Constructor, protoProps, staticProps) {
45
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46
+ if (staticProps) _defineProperties(Constructor, staticProps);
47
+ return Constructor;
48
+ }
49
+ function _define_property(obj, key, value) {
50
+ if (key in obj) {
51
+ Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ } else {
58
+ obj[key] = value;
59
+ }
60
+ return obj;
61
+ }
62
+ function _object_spread(target) {
63
+ for(var i = 1; i < arguments.length; i++){
64
+ var source = arguments[i] != null ? arguments[i] : {};
65
+ var ownKeys = Object.keys(source);
66
+ if (typeof Object.getOwnPropertySymbols === "function") {
67
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
68
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
69
+ }));
70
+ }
71
+ ownKeys.forEach(function(key) {
72
+ _define_property(target, key, source[key]);
73
+ });
74
+ }
75
+ return target;
76
+ }
77
+ function _ts_generator(thisArg, body) {
78
+ var f, y, t, g, _ = {
79
+ label: 0,
80
+ sent: function() {
81
+ if (t[0] & 1) throw t[1];
82
+ return t[1];
83
+ },
84
+ trys: [],
85
+ ops: []
86
+ };
87
+ return g = {
88
+ next: verb(0),
89
+ "throw": verb(1),
90
+ "return": verb(2)
91
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
92
+ return this;
93
+ }), g;
94
+ function verb(n) {
95
+ return function(v) {
96
+ return step([
97
+ n,
98
+ v
99
+ ]);
100
+ };
101
+ }
102
+ function step(op) {
103
+ if (f) throw new TypeError("Generator is already executing.");
104
+ while(_)try {
105
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
106
+ if (y = 0, t) op = [
107
+ op[0] & 2,
108
+ t.value
109
+ ];
110
+ switch(op[0]){
111
+ case 0:
112
+ case 1:
113
+ t = op;
114
+ break;
115
+ case 4:
116
+ _.label++;
117
+ return {
118
+ value: op[1],
119
+ done: false
120
+ };
121
+ case 5:
122
+ _.label++;
123
+ y = op[1];
124
+ op = [
125
+ 0
126
+ ];
127
+ continue;
128
+ case 7:
129
+ op = _.ops.pop();
130
+ _.trys.pop();
131
+ continue;
132
+ default:
133
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
134
+ _ = 0;
135
+ continue;
136
+ }
137
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
138
+ _.label = op[1];
139
+ break;
140
+ }
141
+ if (op[0] === 6 && _.label < t[1]) {
142
+ _.label = t[1];
143
+ t = op;
144
+ break;
145
+ }
146
+ if (t && _.label < t[2]) {
147
+ _.label = t[2];
148
+ _.ops.push(op);
149
+ break;
150
+ }
151
+ if (t[2]) _.ops.pop();
152
+ _.trys.pop();
153
+ continue;
154
+ }
155
+ op = body.call(thisArg, _);
156
+ } catch (e) {
157
+ op = [
158
+ 6,
159
+ e
160
+ ];
161
+ y = 0;
162
+ } finally{
163
+ f = t = 0;
164
+ }
165
+ if (op[0] & 5) throw op[1];
166
+ return {
167
+ value: op[0] ? op[1] : void 0,
168
+ done: true
169
+ };
170
+ }
171
+ }
172
+ import { ApiTypes } from '../fwk';
173
+ /**
174
+ * Generic request to the API
175
+ */ export var GenericApi = /*#__PURE__*/ function() {
176
+ "use strict";
177
+ function GenericApi(apiClient) {
178
+ _class_call_check(this, GenericApi);
179
+ /** @inheritDoc */ _define_property(this, "apiName", GenericApi.apiName);
180
+ /** @inheritDoc */ _define_property(this, "client", void 0);
181
+ this.client = apiClient;
182
+ }
183
+ _create_class(GenericApi, [
184
+ {
185
+ key: "request",
186
+ value: /**
187
+ * Process to request to the API in the context of the SDK
188
+ * @param requestOptions Option to provide to process to the call
189
+ */ function request(requestOptions) {
190
+ var _this = this;
191
+ return _async_to_generator(function() {
192
+ var _requestOptions_metadata, _requestOptions_metadata1, metadataHeaderAccept, headers, requestParameters, options, _tmp, url, ret;
193
+ return _ts_generator(this, function(_state) {
194
+ switch(_state.label){
195
+ case 0:
196
+ metadataHeaderAccept = ((_requestOptions_metadata = requestOptions.metadata) === null || _requestOptions_metadata === void 0 ? void 0 : _requestOptions_metadata.headerAccept) || 'application/json';
197
+ headers = _object_spread({
198
+ // eslint-disable-next-line @typescript-eslint/naming-convention
199
+ 'Content-Type': ((_requestOptions_metadata1 = requestOptions.metadata) === null || _requestOptions_metadata1 === void 0 ? void 0 : _requestOptions_metadata1.headerContentType) || 'application/json'
200
+ }, metadataHeaderAccept ? {
201
+ 'Accept': metadataHeaderAccept
202
+ } : {});
203
+ requestParameters = _object_spread({
204
+ api: _this,
205
+ headers: headers
206
+ }, requestOptions);
207
+ if (!_this.client.getRequestOptions) return [
208
+ 3,
209
+ 2
210
+ ];
211
+ return [
212
+ 4,
213
+ _this.client.getRequestOptions(requestParameters)
214
+ ];
215
+ case 1:
216
+ _tmp = _state.sent();
217
+ return [
218
+ 3,
219
+ 4
220
+ ];
221
+ case 2:
222
+ return [
223
+ 4,
224
+ _this.client.prepareOptions(requestParameters.basePath, requestParameters.method, requestParameters.queryParams || {}, requestParameters.headers)
225
+ ];
226
+ case 3:
227
+ _tmp = _state.sent();
228
+ _state.label = 4;
229
+ case 4:
230
+ options = _tmp;
231
+ url = _this.client.prepareUrl(options.basePath, options.queryParams);
232
+ ret = _this.client.processCall(url, options, ApiTypes.DEFAULT, requestOptions.api.apiName, requestOptions.revivers, requestOptions.operationId);
233
+ return [
234
+ 2,
235
+ ret
236
+ ];
237
+ }
238
+ });
239
+ })();
240
+ }
241
+ }
242
+ ]);
243
+ return GenericApi;
244
+ }();
245
+ /** API name */ _define_property(GenericApi, "apiName", 'GenericApi');
@@ -1,5 +1,6 @@
1
- export * from "./crypto";
2
- export * from "./encoder";
3
- export * from "./ie11";
4
- export * from "./json-token";
5
- export * from "./mime-types";
1
+ export * from './crypto';
2
+ export * from './encoder';
3
+ export * from './ie11';
4
+ export * from './json-token';
5
+ export * from './mime-types';
6
+ export * from './generic-api';
@@ -122,8 +122,8 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { ab2str, encryptPayload, generateContentEncryptionKey, generateIV, wrapContentEncryptionKey } from "./crypto";
126
- import { Encoder } from "./encoder";
125
+ import { ab2str, encryptPayload, generateContentEncryptionKey, generateIV, wrapContentEncryptionKey } from './crypto';
126
+ import { Encoder } from './encoder';
127
127
  /**
128
128
  * Encode a Unicode string in base64
129
129
  * @param str String to convert
@@ -133,11 +133,11 @@ import { Encoder } from "./encoder";
133
133
  // encodeURI escape all non-ASCII characters but we don't want to escape latin non-ascii characters
134
134
  // (charCode between 128 and 255).
135
135
  return window.btoa(encodeURI(str).replace(/%C2%([89AB][0-9A-F])/g, function(_match, p1) {
136
- return String.fromCharCode(parseInt("0x" + p1, 16));
136
+ return String.fromCharCode(parseInt('0x' + p1, 16));
137
137
  }).replace(/%C3%([89AB][0-9A-F])/g, function(_match, p1) {
138
- return String.fromCharCode(parseInt("0xc0", 16) + parseInt("0x" + p1, 16) - parseInt("0x80", 16));
138
+ return String.fromCharCode(parseInt('0xc0', 16) + parseInt('0x' + p1, 16) - parseInt('0x80', 16));
139
139
  }).replace(/%([0-9A-F]{2})/g, function(_match, p1) {
140
- return String.fromCharCode(parseInt("0x" + p1, 16));
140
+ return String.fromCharCode(parseInt('0x' + p1, 16));
141
141
  }));
142
142
  }
143
143
  /**
@@ -147,7 +147,7 @@ import { Encoder } from "./encoder";
147
147
  // Once the provided string is decoded from based64, we convert each character in its hexadecimal
148
148
  // value prefixed with the % character to make it URI compatible.
149
149
  var hexString = window.atob(str).replace(/./g, function(match) {
150
- return "%" + match.charCodeAt(0).toString(16);
150
+ return '%' + match.charCodeAt(0).toString(16);
151
151
  });
152
152
  return decodeURI(hexString);
153
153
  }
@@ -157,7 +157,7 @@ import { Encoder } from "./encoder";
157
157
  * characters are removed
158
158
  * @param str the encoded string
159
159
  */ export function base64EncodeUrl(str) {
160
- return str.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
160
+ return str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
161
161
  }
162
162
  /**
163
163
  * Recreate a Base64 encoded string that was made URL friendly
@@ -165,84 +165,84 @@ import { Encoder } from "./encoder";
165
165
  * @param str the encoded string
166
166
  */ export function base64DecodeUrl(str) {
167
167
  // Pad out with standard base64 required padding characters
168
- str = (str + "===").slice(0, str.length + str.length % 4);
169
- return str.replace(/-/g, "+").replace(/_/g, "/");
168
+ str = (str + '===').slice(0, str.length + str.length % 4);
169
+ return str.replace(/-/g, '+').replace(/_/g, '/');
170
170
  }
171
171
  /**
172
172
  * Creates a base64 encoding function depending on whether the plugin is run from a browser or from NodeJS.
173
173
  */ export function createBase64Encoder() {
174
174
  // Web browsers
175
- if (typeof window !== "undefined" && typeof window.btoa === "function") {
175
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
176
176
  return function(data) {
177
177
  return base64EncodeUnicode(data);
178
178
  };
179
179
  }
180
180
  // NodeJS
181
- if (typeof Buffer === "function") {
181
+ if (typeof Buffer === 'function') {
182
182
  return function(data) {
183
- return Buffer.from(data).toString("base64");
183
+ return Buffer.from(data).toString('base64');
184
184
  };
185
185
  }
186
- throw new Error("Cannot convert string to base64, both btoa and Buffer are undefined.");
186
+ throw new Error('Cannot convert string to base64, both btoa and Buffer are undefined.');
187
187
  }
188
188
  /**
189
189
  * Creates a base64 decoding function depending on whether the plugin is run from a browser or from NodeJS.
190
190
  */ export function createBase64Decoder() {
191
191
  // Web browsers
192
- if (typeof window !== "undefined" && typeof window.btoa === "function") {
192
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
193
193
  return function(data) {
194
194
  return base64DecodeUnicode(data);
195
195
  };
196
196
  }
197
197
  // NodeJS
198
- if (typeof Buffer === "function") {
198
+ if (typeof Buffer === 'function') {
199
199
  return function(data) {
200
- return Buffer.from(data, "base64").toString();
200
+ return Buffer.from(data, 'base64').toString();
201
201
  };
202
202
  }
203
- throw new Error("Cannot convert base64 to string, both atob and Buffer are undefined.");
203
+ throw new Error('Cannot convert base64 to string, both atob and Buffer are undefined.');
204
204
  }
205
205
  /**
206
206
  * Creates a base64Url encoding function depending on whether the plugin is run from a browser or from NodeJS.
207
207
  */ export function createBase64UrlEncoder() {
208
208
  // Web browsers
209
- if (typeof window !== "undefined" && typeof window.btoa === "function") {
209
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
210
210
  return function(data) {
211
211
  return base64EncodeUrl(base64EncodeUnicode(data));
212
212
  };
213
213
  }
214
214
  // NodeJS
215
- if (typeof Buffer === "function") {
215
+ if (typeof Buffer === 'function') {
216
216
  return function(data) {
217
- return base64EncodeUrl(Buffer.from(data).toString("base64"));
217
+ return base64EncodeUrl(Buffer.from(data).toString('base64'));
218
218
  };
219
219
  }
220
- throw new Error("Cannot convert string to base64, both btoa and Buffer are undefined.");
220
+ throw new Error('Cannot convert string to base64, both btoa and Buffer are undefined.');
221
221
  }
222
222
  /**
223
223
  * Creates a base64Url decoding function depending on whether the plugin is run from a browser or from NodeJS.
224
224
  */ export function createBase64UrlDecoder() {
225
225
  // Web browsers
226
- if (typeof window !== "undefined" && typeof window.btoa === "function") {
226
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
227
227
  return function(data) {
228
228
  return base64DecodeUnicode(base64DecodeUrl(data));
229
229
  };
230
230
  }
231
231
  // NodeJS
232
- if (typeof Buffer === "function") {
232
+ if (typeof Buffer === 'function') {
233
233
  return function(data) {
234
- return Buffer.from(base64DecodeUrl(data), "base64").toString();
234
+ return Buffer.from(base64DecodeUrl(data), 'base64').toString();
235
235
  };
236
236
  }
237
- throw new Error("Cannot convert base64 to string, both atob and Buffer are undefined.");
237
+ throw new Error('Cannot convert base64 to string, both atob and Buffer are undefined.');
238
238
  }
239
239
  /**
240
240
  * Creates a JWT encoding function which transforms the provided payload as a unsecured JWT format https://tools.ietf.org/html/rfc7519#section-6
241
241
  */ export function createJwtEncoder() {
242
242
  var encoder = createBase64UrlEncoder();
243
243
  var jwtHeader = {
244
- alg: "none",
245
- typ: "JWT"
244
+ alg: 'none',
245
+ typ: 'JWT'
246
246
  };
247
247
  return function(jwtPayload) {
248
248
  return "".concat(encoder(JSON.stringify(jwtHeader)), ".").concat(encoder(JSON.stringify(jwtPayload)), ".");
@@ -257,7 +257,7 @@ import { Encoder } from "./encoder";
257
257
  */ export function createJweEncoder() {
258
258
  var aesTagLengthInBits = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 128, useHeaderAsAAD = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
259
259
  var base64Encoder = createBase64UrlEncoder();
260
- var stringEncoder = typeof window.TextEncoder !== "undefined" ? new TextEncoder() : new Encoder();
260
+ var stringEncoder = typeof window.TextEncoder !== 'undefined' ? new TextEncoder() : new Encoder();
261
261
  return function() {
262
262
  var _ref = _async_to_generator(function(param, jwePayload, publicProperties) {
263
263
  var publicKey, keyId, jweHeader, cek, wrappedCek, iv, serializedHeader, _ref, ciphertext, authenticationTag;
@@ -266,9 +266,9 @@ import { Encoder } from "./encoder";
266
266
  case 0:
267
267
  publicKey = param.publicKey, keyId = param.keyId;
268
268
  jweHeader = {
269
- alg: "RSA-OAEP-256",
270
- enc: "A256GCM",
271
- typ: "JWE",
269
+ alg: 'RSA-OAEP-256',
270
+ enc: 'A256GCM',
271
+ typ: 'JWE',
272
272
  kid: keyId
273
273
  };
274
274
  publicProperties.forEach(function(property) {
@@ -306,7 +306,7 @@ import { Encoder } from "./encoder";
306
306
  _ref = _state.sent(), ciphertext = _ref.ciphertext, authenticationTag = _ref.authenticationTag;
307
307
  return [
308
308
  2,
309
- serializedHeader + "." + base64Encoder(ab2str(wrappedCek)) + "." + base64Encoder(ab2str(iv.buffer)) + "." + base64Encoder(ab2str(ciphertext)) + "." + base64Encoder(ab2str(authenticationTag))
309
+ serializedHeader + '.' + base64Encoder(ab2str(wrappedCek)) + '.' + base64Encoder(ab2str(iv.buffer)) + '.' + base64Encoder(ab2str(ciphertext)) + '.' + base64Encoder(ab2str(authenticationTag))
310
310
  ];
311
311
  }
312
312
  });
@@ -168,28 +168,28 @@ function _ts_generator(thisArg, body) {
168
168
  };
169
169
  }
170
170
  }
171
- var crypto = require("node:crypto");
172
- import { base64DecodeUrl, createBase64Decoder, createBase64Encoder, createBase64UrlDecoder, createBase64UrlEncoder, createJweEncoder } from "./json-token";
173
- describe("JSON token utils", function() {
174
- it("should encode and decode in base64 properly a string that contains characters occupying more than 1 byte", function() {
171
+ var crypto = require('node:crypto');
172
+ import { base64DecodeUrl, createBase64Decoder, createBase64Encoder, createBase64UrlDecoder, createBase64UrlEncoder, createJweEncoder } from './json-token';
173
+ describe('JSON token utils', function() {
174
+ it('should encode and decode in base64 properly a string that contains characters occupying more than 1 byte', function() {
175
175
  var base64Encoder = createBase64Encoder();
176
176
  var base64Decoder = createBase64Decoder();
177
- var myString = "☸☹☺☻☼☾☿";
177
+ var myString = '☸☹☺☻☼☾☿';
178
178
  var converted = base64Encoder(myString);
179
179
  var original = base64Decoder(converted);
180
180
  expect(original).toEqual(myString);
181
181
  });
182
- it("should encode and decode in base64Url properly a string that contains characters occupying more than 1 byte", function() {
182
+ it('should encode and decode in base64Url properly a string that contains characters occupying more than 1 byte', function() {
183
183
  var base64UrlEncoder = createBase64UrlEncoder();
184
184
  var base64UrlDecoder = createBase64UrlDecoder();
185
- var myString = "☸☹☺☻☼☾☿";
185
+ var myString = '☸☹☺☻☼☾☿';
186
186
  var converted = base64UrlEncoder(myString);
187
187
  var original = base64UrlDecoder(converted);
188
188
  expect(original).toEqual(myString);
189
189
  });
190
190
  });
191
- describe("JSON Web Encryption Token", function() {
192
- it("should generate a proper JWE Token", /*#__PURE__*/ _async_to_generator(function() {
191
+ describe('JSON Web Encryption Token', function() {
192
+ it('should generate a proper JWE Token', /*#__PURE__*/ _async_to_generator(function() {
193
193
  var expectedJwePayload, expectedJweHeader, expectedIv, cek, expectedJweEncryptedKey, outputAesGcm, jweToken, _jweToken_split, jweHeader, jweEncryptedKey, iv, cipherContent, authenticationTag, decipher, decrypted;
194
194
  return _ts_generator(this, function(_state) {
195
195
  switch(_state.label){
@@ -197,20 +197,20 @@ describe("JSON Web Encryption Token", function() {
197
197
  /* eslint-disable @typescript-eslint/naming-convention */ expectedJwePayload = {
198
198
  iat: 0,
199
199
  exp: 3600,
200
- iss: "DEMO_JWE",
201
- sub: "pii",
202
- "ama-tokens": {
203
- "{orderId}": "RG287F",
204
- "{lastName}": "Doe"
200
+ iss: 'DEMO_JWE',
201
+ sub: 'pii',
202
+ 'ama-tokens': {
203
+ '{orderId}': 'RG287F',
204
+ '{lastName}': 'Doe'
205
205
  }
206
206
  };
207
207
  /* eslint-enable @typescript-eslint/naming-convention */ expectedJweHeader = {
208
- alg: "RSA-OAEP-256",
209
- enc: "A256GCM",
210
- typ: "JWE",
211
- kid: "TEST",
212
- iss: "DEMO_JWE",
213
- sub: "pii"
208
+ alg: 'RSA-OAEP-256',
209
+ enc: 'A256GCM',
210
+ typ: 'JWE',
211
+ kid: 'TEST',
212
+ iss: 'DEMO_JWE',
213
+ sub: 'pii'
214
214
  };
215
215
  expectedIv = new Uint8Array([
216
216
  21,
@@ -640,7 +640,7 @@ describe("JSON Web Encryption Token", function() {
640
640
  ]);
641
641
  global.window = {
642
642
  btoa: function(data) {
643
- return Buffer.from(data, "ascii").toString("base64");
643
+ return Buffer.from(data, 'ascii').toString('base64');
644
644
  },
645
645
  crypto: {
646
646
  getRandomValues: jest.fn().mockReturnValue(expectedIv),
@@ -654,25 +654,25 @@ describe("JSON Web Encryption Token", function() {
654
654
  return [
655
655
  4,
656
656
  createJweEncoder(96)({
657
- publicKey: "myPublicKey",
658
- keyId: "TEST"
657
+ publicKey: 'myPublicKey',
658
+ keyId: 'TEST'
659
659
  }, expectedJwePayload, [
660
- "iss",
661
- "sub"
660
+ 'iss',
661
+ 'sub'
662
662
  ])
663
663
  ];
664
664
  case 1:
665
665
  jweToken = _state.sent();
666
666
  global.window = undefined;
667
- _jweToken_split = _sliced_to_array(jweToken.split("."), 5), jweHeader = _jweToken_split[0], jweEncryptedKey = _jweToken_split[1], iv = _jweToken_split[2], cipherContent = _jweToken_split[3], authenticationTag = _jweToken_split[4];
668
- expect(decodeURI(Buffer.from(base64DecodeUrl(jweHeader), "base64").toString())).toEqual(JSON.stringify(expectedJweHeader));
669
- expect(Buffer.from(base64DecodeUrl(jweEncryptedKey), "base64")).toEqual(Buffer.from(expectedJweEncryptedKey));
670
- expect(Buffer.from(base64DecodeUrl(iv), "base64")).toEqual(Buffer.from(expectedIv));
671
- decipher = crypto.createDecipheriv("aes-256-gcm", cek, Buffer.from(base64DecodeUrl(iv), "base64"), {
667
+ _jweToken_split = _sliced_to_array(jweToken.split('.'), 5), jweHeader = _jweToken_split[0], jweEncryptedKey = _jweToken_split[1], iv = _jweToken_split[2], cipherContent = _jweToken_split[3], authenticationTag = _jweToken_split[4];
668
+ expect(decodeURI(Buffer.from(base64DecodeUrl(jweHeader), 'base64').toString())).toEqual(JSON.stringify(expectedJweHeader));
669
+ expect(Buffer.from(base64DecodeUrl(jweEncryptedKey), 'base64')).toEqual(Buffer.from(expectedJweEncryptedKey));
670
+ expect(Buffer.from(base64DecodeUrl(iv), 'base64')).toEqual(Buffer.from(expectedIv));
671
+ decipher = crypto.createDecipheriv('aes-256-gcm', cek, Buffer.from(base64DecodeUrl(iv), 'base64'), {
672
672
  authTagLength: 12
673
673
  });
674
- decipher.setAuthTag(Buffer.from(base64DecodeUrl(authenticationTag), "base64"));
675
- decrypted = decipher.update(Buffer.from(base64DecodeUrl(cipherContent), "base64"));
674
+ decipher.setAuthTag(Buffer.from(base64DecodeUrl(authenticationTag), 'base64'));
675
+ decrypted = decipher.update(Buffer.from(base64DecodeUrl(cipherContent), 'base64'));
676
676
  decrypted += decipher.final();
677
677
  expect(decrypted.toString()).toEqual(JSON.stringify(expectedJwePayload));
678
678
  return [