@wirexapp/card-sdk-core 1.1.0-beta.4 → 1.1.0

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.
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Return-link policy for STANDALONE launches (the result screen's "Return to
3
+ * the app" — `returnUrl` in the init, `r` in the launch fragment).
4
+ *
5
+ * Any scheme an app can register is accepted: `https:` (an Android App Link /
6
+ * iOS Universal Link — the OS verifies it for the partner's package, the
7
+ * preferred form) or the app's own scheme (`com.partner.app:/wallet/return` —
8
+ * works on both platforms without a domain; any installed app may claim it,
9
+ * which the partner accepts). Refused are only the schemes that differ IN
10
+ * KIND from "open the partner's app": the ones a browser executes as content
11
+ * in the checkout's own origin (`javascript:`, `data:`, `blob:`, …),
12
+ * browser-internal ones, and cleartext `http:`. Everything else is reachable
13
+ * through an https redirect anyway, so a longer denylist would be theatre.
14
+ *
15
+ * The link carries `estimation_id` and `outcome` only — never the token,
16
+ * never the wallet payload — and is a UX signal: the app reconciles by
17
+ * estimation status. Mirrored byte-for-byte in
18
+ * `sdk-service/frames-src/src/returnLink.ts` (the frames bundle must not
19
+ * pull the host SDK in) — change both.
20
+ */
21
+ export const PCI_WALLET_RETURN_URL_BLOCKED_SCHEMES = [
22
+ // executed as content in this origin
23
+ 'javascript:',
24
+ 'vbscript:',
25
+ 'data:',
26
+ 'blob:',
27
+ 'filesystem:',
28
+ // browser-internal
29
+ 'file:',
30
+ 'about:',
31
+ 'chrome:',
32
+ 'chrome-extension:',
33
+ 'edge:',
34
+ 'moz-extension:',
35
+ 'safari-web-extension:',
36
+ 'view-source:',
37
+ // cleartext — https is the only web scheme
38
+ 'http:',
39
+ ];
40
+ const BLOCKED = new Set(PCI_WALLET_RETURN_URL_BLOCKED_SCHEMES);
41
+ /** Longest return link accepted — the launch URL is a QR payload / a Custom
42
+ * Tab URL, and a partner's return link is a short route. */
43
+ const MAX_RETURN_URL_CHARS = 2048;
44
+ /**
45
+ * The normalised href when `candidate` is an acceptable return link, else
46
+ * `null`. Parsed with the WHATWG URL parser BEFORE the scheme check, so case
47
+ * tricks and embedded tabs / newlines in the scheme (`JavaScript:`,
48
+ * `java\tscript:`) are normalised away rather than slipping past a string
49
+ * compare.
50
+ */
51
+ export const resolveWalletReturnUrl = (candidate) => {
52
+ if (typeof candidate !== 'string' || !candidate || candidate.length > MAX_RETURN_URL_CHARS)
53
+ return null;
54
+ let url;
55
+ try {
56
+ url = new URL(candidate);
57
+ }
58
+ catch {
59
+ return null;
60
+ }
61
+ return BLOCKED.has(url.protocol) ? null : url.href;
62
+ };
63
+ //# sourceMappingURL=walletReturnUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walletReturnUrl.js","sourceRoot":"","sources":["../src/walletReturnUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAsB;IACtE,qCAAqC;IACrC,aAAa;IACb,WAAW;IACX,OAAO;IACP,OAAO;IACP,aAAa;IACb,mBAAmB;IACnB,OAAO;IACP,QAAQ;IACR,SAAS;IACT,mBAAmB;IACnB,OAAO;IACP,gBAAgB;IAChB,uBAAuB;IACvB,cAAc;IACd,2CAA2C;IAC3C,OAAO;CACR,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,qCAAqC,CAAC,CAAC;AAE/D;6DAC6D;AAC7D,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAkB,EAAiB,EAAE;IAC1E,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,oBAAoB;QAAE,OAAO,IAAI,CAAC;IACxG,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AACrD,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirexapp/card-sdk-core",
3
- "version": "1.1.0-beta.4",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Shared foundation of the Wirex PCI card SDK: postMessage protocol, frame channel, frame-URL building, collect machinery. CHD-free.",
6
6
  "license": "UNLICENSED",