@agent-cards/sdk 0.23.20 → 0.23.22

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 (64) hide show
  1. package/CHANGELOG.md +55 -2
  2. package/PREFLIGHT.md +6 -0
  3. package/README.md +169 -5
  4. package/dist/amadeus-checkout.generated.d.ts +6 -1
  5. package/dist/amadeus-checkout.generated.js +26 -2
  6. package/dist/card-fields.generated.js +2341 -127
  7. package/dist/cdp.js +199 -28
  8. package/dist/client.d.ts +177 -9
  9. package/dist/client.js +387 -37
  10. package/dist/comgate.d.ts +50 -0
  11. package/dist/comgate.js +80 -0
  12. package/dist/creditguard.generated.js +4 -2
  13. package/dist/cse-body.js +11 -0
  14. package/dist/cybersource-secure-acceptance.generated.d.ts +1 -1
  15. package/dist/ebanx.d.ts +1 -1
  16. package/dist/ebanx.js +1 -1
  17. package/dist/eprotect.generated.d.ts +1 -1
  18. package/dist/eximbay.d.ts +46 -0
  19. package/dist/eximbay.js +69 -0
  20. package/dist/gmo.generated.js +7 -3
  21. package/dist/hipay.generated.d.ts +5 -5
  22. package/dist/hipay.generated.js +5 -2
  23. package/dist/hold.d.ts +1 -1
  24. package/dist/hold.js +10 -4
  25. package/dist/hosted-entry.d.ts +4 -0
  26. package/dist/hosted-entry.js +32 -0
  27. package/dist/index.d.ts +1 -0
  28. package/dist/lifecycle.d.ts +9 -4
  29. package/dist/lifecycle.js +16 -4
  30. package/dist/paddle-tokenex.generated.js +7 -3
  31. package/dist/paygent.generated.d.ts +60 -0
  32. package/dist/paygent.generated.js +425 -0
  33. package/dist/payrails.generated.js +7 -3
  34. package/dist/payrexx.d.ts +91 -0
  35. package/dist/payrexx.generated.d.ts +91 -0
  36. package/dist/payrexx.generated.js +536 -0
  37. package/dist/payrexx.js +141 -0
  38. package/dist/pre-claim.d.ts +30 -1
  39. package/dist/pre-claim.js +257 -39
  40. package/dist/preflight-catalog.json +58 -0
  41. package/dist/preflight-schemas.json +4 -0
  42. package/dist/preflight.generated.js +26 -2
  43. package/dist/prepared-processor.d.ts +7 -2
  44. package/dist/prepared-processor.js +16 -2
  45. package/dist/primer.generated.js +2469 -255
  46. package/dist/przelewy24.d.ts +47 -0
  47. package/dist/przelewy24.js +88 -0
  48. package/dist/registry.d.ts +6 -5
  49. package/dist/registry.js +27 -7
  50. package/dist/shiji-sts.generated.js +7 -3
  51. package/dist/stripe-checkout.generated.js +896 -19
  52. package/dist/toast-seal.generated.d.ts +37 -0
  53. package/dist/toast-seal.generated.js +625 -0
  54. package/dist/toast.generated.d.ts +41 -0
  55. package/dist/toast.generated.js +113 -0
  56. package/dist/tokenex-iframe.d.ts +93 -0
  57. package/dist/tokenex-iframe.generated.d.ts +81 -0
  58. package/dist/tokenex-iframe.generated.js +403 -0
  59. package/dist/tokenex-iframe.js +195 -0
  60. package/dist/transbank.d.ts +45 -0
  61. package/dist/transbank.js +73 -0
  62. package/dist/twoc2p.generated.js +7 -3
  63. package/examples/preflight/kernel-native/inventory.json +1 -1
  64. package/package.json +3 -3
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Transbank's Webpay Plus (webpay3g.transbank.cl, the card payment form most Chilean shops send a buyer to), as this
3
+ * SDK reads it.
4
+ *
5
+ * The merchant's server creates the transaction at Transbank and sends the buyer's browser to Webpay with a GET,
6
+ * https://webpay3g.transbank.cl/webpayserver/initTransaction?token_ws=<64 lowercase hex>, the way the official
7
+ * WooCommerce plugin redirects. That GET carries no card and nothing but Transbank's token, and it is the one request
8
+ * a build that declares Webpay's capability pauses for Webpay (hosted-entry.ts): the cardholder's device repeats it
9
+ * over the end-to-end TLS relay and sends Webpay's card steps inside the session it opens (payment-core
10
+ * processors/transbank.js). Everything else the agent's browser sends Webpay spends the token or carries a card the
11
+ * agent typed: the token's one submit (/webpayserver/init_transaction.cgi), the card lookup and card check under
12
+ * /webpayserver/wswebpay/services/, and the card post (/webpayserver/bp_control.cgi). Once Webpay is served this SDK
13
+ * aborts every one of them (pre-claim.ts transbankPreClaim), so the token is never spent in the agent's browser and
14
+ * no placeholder card reaches Webpay. Only the link exactly as the merchant's redirect writes it is the entry; any
15
+ * other spelling would be handed on to Webpay's own route, which these rules never see.
16
+ *
17
+ * TRANSBANK_HOSTS is payment-core's TRANSBANK_HOSTS, and isTransbankEntryUrl is payment-core's rule of the same name;
18
+ * transbank.test.mjs pins both to payment-core on every case payment-core's own tests list.
19
+ */
20
+ export const TRANSBANK_PSP = 'transbank_webpay';
21
+ /** The dark-launch capability the API serves Webpay's recognizer behind (payment-core definitions.js). */
22
+ export const TRANSBANK_CAPABILITY = 'transbank_webpay_hosted_payment_page';
23
+ /** Webpay's live host and Transbank's integration host, each a host of its own entry. */
24
+ export const TRANSBANK_HOSTS = Object.freeze(['webpay3g.transbank.cl', 'webpay3gint.transbank.cl']);
25
+ const TRANSBANK_ENTRY_PATH = '/webpayserver/initTransaction';
26
+ // A Webpay token as Transbank's REST reference defines it: 64 lowercase hex characters.
27
+ const TOKEN_QUERY = /^\?token_ws=[0-9a-f]{64}$/;
28
+ // An entry in the shape the merchant's redirect writes it: the registry reads Webpay as served when it takes this as a GET entry.
29
+ const TRANSBANK_SAMPLE_ENTRY = `https://webpay3g.transbank.cl${TRANSBANK_ENTRY_PATH}?token_ws=${'0'.repeat(64)}`;
30
+ /**
31
+ * Whether a URL is Webpay's entry exactly as the merchant's redirect writes it: https, one of Transbank's two hosts in
32
+ * lower case, no port, credentials or fragment, the path /webpayserver/initTransaction, and a query of the one
33
+ * `token_ws` parameter holding 64 lowercase hex characters. A string that parses to another spelling is not it.
34
+ */
35
+ export function isTransbankEntryUrl(raw) {
36
+ if (typeof raw !== 'string' || raw.length > 256 || raw.includes('#'))
37
+ return false;
38
+ let url;
39
+ try {
40
+ url = new URL(raw);
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ if (url.href !== raw || url.protocol !== 'https:' || url.port || url.username || url.password)
46
+ return false;
47
+ return TRANSBANK_HOSTS.includes(url.hostname) && url.pathname === TRANSBANK_ENTRY_PATH && TOKEN_QUERY.test(url.search);
48
+ }
49
+ /** Whether this URL is on one of Webpay's two hosts (https, no credentials, any port, a trailing dot or not). */
50
+ export function isTransbankHost(url) {
51
+ let parsed;
52
+ try {
53
+ parsed = new URL(url);
54
+ }
55
+ catch {
56
+ return false;
57
+ }
58
+ return parsed.protocol === 'https:' && !parsed.username && !parsed.password
59
+ && TRANSBANK_HOSTS.includes(parsed.hostname.toLowerCase().replace(/\.$/, ''));
60
+ }
61
+ /** Whether this build's registry serves Webpay's entry: a company Agentcard turned Webpay on for, on a build that declares it. */
62
+ export function servesTransbank(vault) {
63
+ return typeof vault?.isCardRequest === 'function' && vault.isCardRequest(TRANSBANK_SAMPLE_ENTRY, 'GET');
64
+ }
65
+ /**
66
+ * Whether an adapter must hand this request to the pre-claim gates: it is on one of Webpay's hosts and this build's
67
+ * registry serves Webpay. attachToCdp pauses every request there through the recognizer's host patterns;
68
+ * attachToPlaywright's route predicate asks this, so both adapters show the Webpay gate every request to a Webpay host
69
+ * once Webpay is served.
70
+ */
71
+ export function isArmedTransbankUrl(vault, url) {
72
+ return isTransbankHost(url) && servesTransbank(vault);
73
+ }
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  // Generated from @agent-cards/payment-core. Do not edit.
3
- // artifact-sha256: 59df0cccc4cd5b4a98c801bfd901db5f264282e8209a07909898c35fc76a3c0b
3
+ // artifact-sha256: 3c735198962459f0b06c7fbbdfa58de91ab1f76adeec6fa17b4e1a8d33e4b8c3
4
4
  // src/sha256.js
5
5
  var K = /* @__PURE__ */ new Uint32Array([
6
6
  1116352408,
@@ -153,6 +153,9 @@ var typedArrayName = Object.getOwnPropertyDescriptor(TYPED_ARRAY, Symbol.toStrin
153
153
  function parseRsaPublicKey(key) {
154
154
  const spki = key && typeof key === "object" ? key.spki : void 0;
155
155
  const pin = key && typeof key === "object" ? key.sha256 : void 0;
156
+ const named = key && typeof key === "object" && Object.prototype.hasOwnProperty.call(key, "exponent") ? key.exponent : void 0;
157
+ if (named !== void 0 && named !== 17)
158
+ throw refuse("key");
156
159
  if (typeof spki !== "string" || spki.length > 1024 || spki.length % 4 !== 0 || !BASE64.test(spki))
157
160
  throw refuse("key");
158
161
  if (typeof pin !== "string" || !SHA256_HEX.test(pin))
@@ -188,9 +191,10 @@ function parseRsaPublicKey(key) {
188
191
  if (!MODULUS_BYTES.includes(n.length) || !(n[0] & 128) || !(n[n.length - 1] & 1))
189
192
  throw refuse("key");
190
193
  const e = exponent.bytes;
191
- if (e.length !== 3 || e[0] !== 1 || e[1] !== 0 || e[2] !== 1)
194
+ const expected = named === 17 ? [17] : [1, 0, 1];
195
+ if (e.length !== expected.length || !expected.every((byte, i) => e[i] === byte))
192
196
  throw refuse("key");
193
- return Object.freeze({ n: toBigInt(n), e: 65537n, size: n.length });
197
+ return Object.freeze({ n: toBigInt(n), e: named === 17 ? 17n : 65537n, size: n.length });
194
198
  }
195
199
  function rsaesPkcs1v15Encrypt(key, message, random) {
196
200
  const { n, e, size } = parseRsaPublicKey(key);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "catalog_version": "2026-09-15.1",
4
- "catalog_sha256": "47dd1bc5a749224f66980b42b758f9a19d9ac849e3a8d5230075226a4870fde5",
4
+ "catalog_sha256": "7f65e0f07138296b0cbff7dd1ed4331842b6dd45e2950f08273fcc772c7f63f6",
5
5
  "baseline_version": "kernel-native-docs-2026-09-11.1",
6
6
  "baseline_sha256": "d86722f49633d8223fccae54cd3d485df4375aee06aa156a273cc689b7c8507c",
7
7
  "native_build": null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-cards/sdk",
3
- "version": "0.23.20",
3
+ "version": "0.23.22",
4
4
  "description": "Agentcard's SDK: one client, Agentcard, with two modules. checkout pauses a browser purchase and pays it with the person's own card; voice connects a person to your product once and approves a purchase by voice inside it. Card data never enters your process.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,8 +30,8 @@
30
30
  "_comment_test": "check:built runs first and names the command when a file the build generates (the copies in src/, the preflight contracts in dist/, the Kernel inventory) is missing or stale; verify:pack runs last, on the same dist.",
31
31
  "check:built": "node scripts/generate-payment-core.mjs --check && node scripts/generate-voice-stream.mjs --check && node scripts/generate-preflight-contract.mjs --check && node scripts/generate-kernel-native-inventory.mjs --check",
32
32
  "verify:pack": "node scripts/verify-pack.mjs",
33
- "test": "npm run check:built && node test.mjs && node --test lifecycle.test.mjs merchant-abort.test.mjs preparation.test.mjs braintree.test.mjs pre-claim.test.mjs ekashu.test.mjs redsys.test.mjs quickpay.test.mjs paypal-hosted-fields.test.mjs paypal-card-forms.test.mjs cybersource-secure-acceptance.test.mjs ebanx.test.mjs autopilot.test.mjs stripe-checkout.test.mjs stripe-setup.test.mjs stripe-legacy-checkout.test.mjs payment-core.test.mjs prepared-processor.test.mjs merchant-hosted.test.mjs merchant-total.test.mjs sandbox-declaration.test.mjs minimum-delay.test.mjs paysafe.test.mjs wix-payments.test.mjs hipay.test.mjs payu.test.mjs attachment.test.mjs worker-targets.test.mjs mercado-checkout.test.mjs mercado-polling.test.mjs amadeus.test.mjs pelecard.test.mjs aci.test.mjs primer.test.mjs payrails.test.mjs elavon-converge.test.mjs voice.test.mjs agentcard.test.mjs buy.test.mjs readme.test.mjs gmo.test.mjs cybersource-flex.test.mjs juspay-gate.test.mjs card-endpoint.test.mjs card-endpoint-fastspring.test.mjs card-endpoint-navigation.test.mjs merchant-session-probe.test.mjs datatrans.test.mjs authorize-net-dpm.test.mjs creditguard.test.mjs eprotect.test.mjs wspay.test.mjs shiji-sts.test.mjs worldline-mycheckout.test.mjs verifone.test.mjs gravy.test.mjs paddle-vgs.test.mjs hold.test.mjs paddle-tokenex.test.mjs lyra.test.mjs twoc2p.test.mjs redact-url.test.mjs && node --test preflight-package.test.mjs preflight-collector.test.mjs && node --test kernel-native-qualification.test.mjs && node --test ../vault/scripts/recurly-validation/watch-duty-sdk-result.test.mjs && node scripts/verify-pack.mjs",
34
- "test:browser": "node browser.test.mjs && node stripe-browser.test.mjs && node preparation-browser.test.mjs && node checkout-com-browser.test.mjs && node paysafe-preparation-browser.test.mjs && node owned-shop-browser.test.mjs && node spreedly-browser.test.mjs && node worker-browser.test.mjs && node amadeus-browser.test.mjs && node adyen-merchant-hosted-browser.test.mjs && node adyen-merchant-frames-browser.test.mjs && node fiserv-browser.test.mjs && node gmo-browser.test.mjs && node cybersource-flex-browser.test.mjs && node juspay-browser.test.mjs && node card-endpoint-browser.test.mjs && node datatrans-browser.test.mjs && node authorize-net-dpm-browser.test.mjs && node pelecard-browser.test.mjs && node aci-browser.test.mjs && node creditguard-browser.test.mjs && node primer-browser.test.mjs && node payrails-browser.test.mjs && node elavon-converge-browser.test.mjs && node eprotect-browser.test.mjs && node wspay-browser.test.mjs && node shiji-sts-browser.test.mjs && node worldline-mycheckout-browser.test.mjs && node paypal-hosted-fields-browser.test.mjs && node paypal-card-forms-browser.test.mjs && node cybersource-secure-acceptance-browser.test.mjs && node gravy-browser.test.mjs && node ebanx-browser.test.mjs && node hold-browser.test.mjs",
33
+ "test": "npm run check:built && node test.mjs && node --test lifecycle.test.mjs merchant-abort.test.mjs preparation.test.mjs braintree.test.mjs pre-claim.test.mjs ekashu.test.mjs redsys.test.mjs quickpay.test.mjs paypal-hosted-fields.test.mjs paypal-card-forms.test.mjs cybersource-secure-acceptance.test.mjs ebanx.test.mjs payrexx.test.mjs payrexx-follow-ups.test.mjs payrexx-adapters.test.mjs autopilot.test.mjs stripe-checkout.test.mjs stripe-setup.test.mjs stripe-legacy-checkout.test.mjs payment-core.test.mjs prepared-processor.test.mjs merchant-hosted.test.mjs merchant-total.test.mjs sandbox-declaration.test.mjs minimum-delay.test.mjs paysafe.test.mjs wix-payments.test.mjs hipay.test.mjs payu.test.mjs attachment.test.mjs worker-targets.test.mjs mercado-checkout.test.mjs mercado-polling.test.mjs amadeus.test.mjs pelecard.test.mjs aci.test.mjs primer.test.mjs payrails.test.mjs elavon-converge.test.mjs voice.test.mjs agentcard.test.mjs buy.test.mjs readme.test.mjs gmo.test.mjs cybersource-flex.test.mjs juspay-gate.test.mjs card-endpoint.test.mjs card-endpoint-fastspring.test.mjs card-endpoint-navigation.test.mjs merchant-session-probe.test.mjs datatrans.test.mjs authorize-net-dpm.test.mjs creditguard.test.mjs eprotect.test.mjs wspay.test.mjs shiji-sts.test.mjs worldline-mycheckout.test.mjs verifone.test.mjs gravy.test.mjs paddle-vgs.test.mjs hold.test.mjs paddle-tokenex.test.mjs lyra.test.mjs gopay.test.mjs paygent.test.mjs twoc2p.test.mjs pay-nl.test.mjs toast.test.mjs redact-url.test.mjs hosted-entry.test.mjs comgate.test.mjs przelewy24.test.mjs tokenex-iframe.test.mjs transbank.test.mjs sumup.test.mjs clover.test.mjs eximbay.test.mjs && node --test preflight-package.test.mjs preflight-collector.test.mjs browser-tests.test.mjs && node --test kernel-native-qualification.test.mjs && node --test ../vault/scripts/recurly-validation/watch-duty-sdk-result.test.mjs && node scripts/verify-pack.mjs",
34
+ "test:browser": "node browser-tests.mjs",
35
35
  "check:payment-core": "node scripts/generate-payment-core.mjs --check",
36
36
  "check:voice-stream": "node scripts/generate-voice-stream.mjs --check",
37
37
  "test:preflight": "node --test preflight-package.test.mjs preflight-collector.test.mjs kernel-native-qualification.test.mjs",