@soliton-id/web-sdk 1.2.0 → 1.3.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.
- package/CHANGELOG.md +13 -0
- package/README.md +41 -0
- package/dist/core.d.ts +47 -0
- package/dist/hostedUrl.d.ts +7 -12
- package/dist/index.cjs +107 -73
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +107 -73
- package/dist/overlay.d.ts +14 -2
- package/dist/urlCheck.d.ts +23 -0
- package/dist/white-label.cjs +351 -0
- package/dist/white-label.d.ts +63 -0
- package/dist/white-label.mjs +331 -0
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ All notable changes to `@soliton-id/web-sdk`. The `soliton-v1` postMessage
|
|
|
4
4
|
protocol is frozen: changes are additive only, so older SDK versions keep
|
|
5
5
|
working against the hosted flow.
|
|
6
6
|
|
|
7
|
+
## 1.3.0 — 2026-11-09
|
|
8
|
+
|
|
9
|
+
Additive only. The default import, its `open()` and the `soliton-v1`
|
|
10
|
+
protocol are unchanged, so existing integrations need no code change.
|
|
11
|
+
|
|
12
|
+
- Add `@soliton-id/web-sdk/white-label` (ESM/CJS + types) for a verification
|
|
13
|
+
page served on your own hostname: the same `open()`, callbacks and error
|
|
14
|
+
codes, with `verificationOrigin` required and no built-in hosts (the URL
|
|
15
|
+
must be on exactly that origin). Nothing it adds to your page names Soliton:
|
|
16
|
+
the iframe title is "Identity verification" (or the optional `title`), and
|
|
17
|
+
its DOM markers, spinner, error messages and messages to the verification
|
|
18
|
+
page use neutral names. Needs the matching hosted verification release.
|
|
19
|
+
|
|
7
20
|
## 1.2.0 — 2026-11-06
|
|
8
21
|
|
|
9
22
|
Additive only; existing calls are unchanged.
|
package/README.md
CHANGED
|
@@ -7,6 +7,47 @@ protocol, completion callbacks and server-side result/webhook contracts are
|
|
|
7
7
|
unchanged. See [the appliance guide](../docs/on-premise.md) for runtime origins,
|
|
8
8
|
local assets, packaging, iframe permissions and top-level mobile WebViews.
|
|
9
9
|
|
|
10
|
+
## White-label import
|
|
11
|
+
|
|
12
|
+
For a verification page served on your own hostname (for example
|
|
13
|
+
`https://verify.example.com`, set up for your account by Soliton), import the
|
|
14
|
+
white-label entry instead of the default one:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { open } from "@soliton-id/web-sdk/white-label";
|
|
18
|
+
|
|
19
|
+
const handle = open({
|
|
20
|
+
url, // the hosted URL from your backend, on your verification hostname
|
|
21
|
+
verificationOrigin: "https://verify.example.com", // required
|
|
22
|
+
onComplete: ({ verificationId }) => {
|
|
23
|
+
// Fetch the result server-side, as with the default import.
|
|
24
|
+
},
|
|
25
|
+
onError: ({ code, message }) => {},
|
|
26
|
+
onClose: () => {},
|
|
27
|
+
// title: "Identity verification", // optional iframe title
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
It works like the default `open()`, with the same callbacks, error codes and
|
|
32
|
+
`handle.close()`, except:
|
|
33
|
+
|
|
34
|
+
- `verificationOrigin` is required: the exact HTTPS origin of your
|
|
35
|
+
verification hostname, taken from your configuration, never from browser
|
|
36
|
+
input. `open()` throws without it, and the URL must be on exactly that
|
|
37
|
+
origin; there are no built-in hosts. HTTP loopback (for example
|
|
38
|
+
`http://localhost:3000`) is accepted for development.
|
|
39
|
+
- Nothing it adds to your page names Soliton: the iframe title is
|
|
40
|
+
"Identity verification" (or your `title`), and its markup, styles, error
|
|
41
|
+
messages and messages to the verification page use neutral names.
|
|
42
|
+
|
|
43
|
+
Your page's `frame-src` and `Permissions-Policy` then name your verification
|
|
44
|
+
hostname instead of `https://soliton.id`. The default import is unchanged.
|
|
45
|
+
|
|
46
|
+
To keep the package name out of what you ship, build with your bundler's
|
|
47
|
+
production mode and do not publish source maps that include `node_modules`:
|
|
48
|
+
their file paths contain `@soliton-id/web-sdk`. Upload such maps privately to
|
|
49
|
+
your error tracker instead if you need them.
|
|
50
|
+
|
|
10
51
|
## Console API v2
|
|
11
52
|
|
|
12
53
|
The SDK opens `https://soliton.id/v/{token}` links from
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay lifecycle shared by every SDK entry point: frame the hosted
|
|
3
|
+
* verification page in a full-viewport overlay and relay its lifecycle through
|
|
4
|
+
* callbacks. The capture engine runs on the verification origin inside the
|
|
5
|
+
* iframe, so its defenses update with each hosted release and the verdict
|
|
6
|
+
* never touches the customer page (only the verification id does).
|
|
7
|
+
*
|
|
8
|
+
* Each entry injects its own names (message protocol and types, DOM markers,
|
|
9
|
+
* error prefix) and its own URL rules. Nothing in this module names an entry,
|
|
10
|
+
* so a bundle carries only the names of the entry it imports.
|
|
11
|
+
*/
|
|
12
|
+
import type { OverlayNames } from "./overlay";
|
|
13
|
+
import type { ParsedHostedUrl } from "./urlCheck";
|
|
14
|
+
export interface EntryNames {
|
|
15
|
+
/** Protocol marker on every message, in both directions. */
|
|
16
|
+
protocol: string;
|
|
17
|
+
/** Parent -> child ping that lets the hosted page read our origin. */
|
|
18
|
+
hello: string;
|
|
19
|
+
/** Child -> parent lifecycle message types. */
|
|
20
|
+
ready: string;
|
|
21
|
+
complete: string;
|
|
22
|
+
error: string;
|
|
23
|
+
close: string;
|
|
24
|
+
/** Prefix of every error open() throws. */
|
|
25
|
+
errorPrefix: string;
|
|
26
|
+
overlay: OverlayNames;
|
|
27
|
+
/** Extra query parameters set on the iframe URL. */
|
|
28
|
+
params?: ReadonlyArray<readonly [string, string]>;
|
|
29
|
+
}
|
|
30
|
+
export interface OpenOptions {
|
|
31
|
+
url: string;
|
|
32
|
+
verificationOrigin?: string;
|
|
33
|
+
onComplete: (e: {
|
|
34
|
+
verificationId: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
onError?: (e: {
|
|
37
|
+
code: string;
|
|
38
|
+
message: string;
|
|
39
|
+
}) => void;
|
|
40
|
+
onClose?: () => void;
|
|
41
|
+
locale?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface OpenHandle {
|
|
44
|
+
close(): void;
|
|
45
|
+
}
|
|
46
|
+
export type UrlRules = (raw: string, verificationOrigin?: string) => ParsedHostedUrl;
|
|
47
|
+
export declare function openOverlay(options: OpenOptions, names: EntryNames, parseUrl: UrlRules): OpenHandle;
|
package/dist/hostedUrl.d.ts
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validation of the hosted verification URL handed to SolitonVerify.open().
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* attacker-chosen page in our overlay.
|
|
4
|
+
* The default entry frames URLs from an approved Soliton origin (http strictly
|
|
5
|
+
* for localhost dev) or, when the integrator configures one, exactly its
|
|
6
|
+
* verificationOrigin. The shared shape rules (bare /v/{32 hex} path, no
|
|
7
|
+
* credentials) live in urlCheck.ts; the Soliton allowlist lives only here, so
|
|
8
|
+
* the white-label entry, which never imports this module, cannot carry it.
|
|
10
9
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
url: URL;
|
|
14
|
-
/** Origin the SDK will trust for postMessage events. */
|
|
15
|
-
hostedOrigin: string;
|
|
16
|
-
}
|
|
10
|
+
import type { ParsedHostedUrl } from "./urlCheck";
|
|
11
|
+
export type { ParsedHostedUrl };
|
|
17
12
|
export declare function parseHostedUrl(raw: string, verificationOrigin?: string): ParsedHostedUrl;
|
package/dist/index.cjs
CHANGED
|
@@ -27,58 +27,14 @@ __export(index_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
30
|
-
// sdk/src/trustedOrigin.ts
|
|
31
|
-
function trustedOrigin(value) {
|
|
32
|
-
const url = new URL(value);
|
|
33
|
-
const local = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
34
|
-
if (url.origin !== value || url.username || url.password || value.includes("*") || url.protocol !== "https:" && !(url.protocol === "http:" && local)) {
|
|
35
|
-
throw new Error("Use an exact HTTPS origin (HTTP loopback is allowed for development)");
|
|
36
|
-
}
|
|
37
|
-
return url.origin;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// sdk/src/hostedUrl.ts
|
|
41
|
-
var HOSTED_PATH_RE = /^\/v\/[0-9a-f]{32}$/;
|
|
42
|
-
var ALLOWED_HTTPS_ORIGINS = /* @__PURE__ */ new Set([
|
|
43
|
-
"https://soliton.id",
|
|
44
|
-
"https://staging.soliton.id"
|
|
45
|
-
]);
|
|
46
|
-
function parseHostedUrl(raw, verificationOrigin) {
|
|
47
|
-
const configuredOrigin = verificationOrigin === void 0 ? void 0 : trustedOrigin(verificationOrigin);
|
|
48
|
-
let url;
|
|
49
|
-
try {
|
|
50
|
-
url = new URL(raw);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
throw new Error(`SolitonVerify: "url" is not a valid absolute URL`);
|
|
53
|
-
}
|
|
54
|
-
const isLocalHttp = url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1");
|
|
55
|
-
if (configuredOrigin !== void 0 && url.origin !== configuredOrigin) {
|
|
56
|
-
throw new Error('SolitonVerify: "url" does not match the configured verificationOrigin');
|
|
57
|
-
}
|
|
58
|
-
if (configuredOrigin === void 0 && !ALLOWED_HTTPS_ORIGINS.has(url.origin) && !isLocalHttp) {
|
|
59
|
-
throw new Error(
|
|
60
|
-
'SolitonVerify: "url" must be hosted on https://soliton.id or https://staging.soliton.id (http is allowed for localhost/127.0.0.1 development only)'
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
if (url.username || url.password) {
|
|
64
|
-
throw new Error('SolitonVerify: "url" must not embed credentials');
|
|
65
|
-
}
|
|
66
|
-
if (!HOSTED_PATH_RE.test(url.pathname)) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
'SolitonVerify: "url" does not look like a hosted verification URL (/v/{token})'
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return { url, hostedOrigin: url.origin };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
30
|
// sdk/src/overlay.ts
|
|
75
31
|
var MAX_Z_INDEX = "2147483647";
|
|
76
32
|
var openOverlayCount = 0;
|
|
77
33
|
var savedBodyOverflow = "";
|
|
78
|
-
function createOverlay(iframeSrc, onCloseClick) {
|
|
34
|
+
function createOverlay(iframeSrc, onCloseClick, names) {
|
|
79
35
|
const doc = document;
|
|
80
36
|
const container = doc.createElement("div");
|
|
81
|
-
container.setAttribute(
|
|
37
|
+
container.setAttribute(names.marker, "overlay");
|
|
82
38
|
container.style.cssText = [
|
|
83
39
|
"position:fixed",
|
|
84
40
|
"inset:0",
|
|
@@ -87,10 +43,10 @@ function createOverlay(iframeSrc, onCloseClick) {
|
|
|
87
43
|
"display:block"
|
|
88
44
|
].join(";");
|
|
89
45
|
const style = doc.createElement("style");
|
|
90
|
-
style.textContent =
|
|
46
|
+
style.textContent = `@keyframes ${names.animation}{to{transform:rotate(360deg)}}`;
|
|
91
47
|
container.appendChild(style);
|
|
92
48
|
const loading = doc.createElement("div");
|
|
93
|
-
loading.setAttribute(
|
|
49
|
+
loading.setAttribute(names.marker, "loading");
|
|
94
50
|
loading.style.cssText = [
|
|
95
51
|
"position:absolute",
|
|
96
52
|
"inset:0",
|
|
@@ -109,7 +65,7 @@ function createOverlay(iframeSrc, onCloseClick) {
|
|
|
109
65
|
"border-radius:999px",
|
|
110
66
|
"border:2px solid rgba(255,255,255,0.25)",
|
|
111
67
|
"border-top-color:rgba(255,255,255,0.9)",
|
|
112
|
-
|
|
68
|
+
`animation:${names.animation} 0.8s linear infinite`
|
|
113
69
|
].join(";");
|
|
114
70
|
const loadingText = doc.createElement("div");
|
|
115
71
|
loadingText.textContent = "Loading secure verification...";
|
|
@@ -118,7 +74,7 @@ function createOverlay(iframeSrc, onCloseClick) {
|
|
|
118
74
|
container.appendChild(loading);
|
|
119
75
|
const iframe = doc.createElement("iframe");
|
|
120
76
|
iframe.setAttribute("allow", "camera; microphone; fullscreen; autoplay");
|
|
121
|
-
iframe.setAttribute("title",
|
|
77
|
+
iframe.setAttribute("title", names.title);
|
|
122
78
|
iframe.style.cssText = [
|
|
123
79
|
"position:absolute",
|
|
124
80
|
"inset:0",
|
|
@@ -173,43 +129,42 @@ function createOverlay(iframeSrc, onCloseClick) {
|
|
|
173
129
|
};
|
|
174
130
|
}
|
|
175
131
|
|
|
176
|
-
// sdk/src/
|
|
177
|
-
var EMBED_PROTOCOL = "soliton-v1";
|
|
178
|
-
|
|
179
|
-
// sdk/src/index.ts
|
|
132
|
+
// sdk/src/core.ts
|
|
180
133
|
var AUTO_CLOSE_DELAY_MS = 250;
|
|
181
134
|
var HELLO_INTERVAL_MS = 250;
|
|
182
135
|
var HELLO_MAX_PINGS = 40;
|
|
183
136
|
var READY_TIMEOUT_MS = 3e4;
|
|
184
|
-
function
|
|
137
|
+
function openOverlay(options, names, parseUrl) {
|
|
138
|
+
var _a;
|
|
185
139
|
if (!options || typeof options.url !== "string") {
|
|
186
|
-
throw new Error(
|
|
140
|
+
throw new Error(`${names.errorPrefix} open() requires an options object with a "url"`);
|
|
187
141
|
}
|
|
188
142
|
if (typeof options.onComplete !== "function") {
|
|
189
|
-
throw new Error(
|
|
143
|
+
throw new Error(`${names.errorPrefix} open() requires an onComplete callback`);
|
|
190
144
|
}
|
|
191
|
-
const { url, hostedOrigin } =
|
|
145
|
+
const { url, hostedOrigin } = parseUrl(options.url, options.verificationOrigin);
|
|
192
146
|
const src = new URL(url.toString());
|
|
193
147
|
src.searchParams.set("mode", "embed");
|
|
194
148
|
src.searchParams.set("sdk", "1");
|
|
149
|
+
for (const [key, value] of (_a = names.params) != null ? _a : []) src.searchParams.set(key, value);
|
|
195
150
|
if (options.locale) src.searchParams.set("locale", options.locale);
|
|
196
151
|
let closed = false;
|
|
197
152
|
let terminalDelivered = false;
|
|
198
153
|
let loadTimedOut = false;
|
|
199
154
|
let autoCloseTimer = null;
|
|
200
155
|
let readyTimer = null;
|
|
201
|
-
const overlay = createOverlay(src.toString(), () => close());
|
|
156
|
+
const overlay = createOverlay(src.toString(), () => close(), names.overlay);
|
|
202
157
|
let helloPings = 0;
|
|
203
158
|
const postHello = () => {
|
|
204
|
-
var
|
|
159
|
+
var _a2;
|
|
205
160
|
helloPings += 1;
|
|
206
161
|
if (helloPings > HELLO_MAX_PINGS) {
|
|
207
162
|
stopHello();
|
|
208
163
|
return;
|
|
209
164
|
}
|
|
210
165
|
try {
|
|
211
|
-
(
|
|
212
|
-
{ protocol:
|
|
166
|
+
(_a2 = overlay.iframe.contentWindow) == null ? void 0 : _a2.postMessage(
|
|
167
|
+
{ protocol: names.protocol, type: names.hello },
|
|
213
168
|
hostedOrigin
|
|
214
169
|
);
|
|
215
170
|
} catch (e) {
|
|
@@ -227,23 +182,23 @@ function open(options) {
|
|
|
227
182
|
readyTimer = null;
|
|
228
183
|
}
|
|
229
184
|
const onMessage = (event) => {
|
|
230
|
-
var
|
|
185
|
+
var _a2;
|
|
231
186
|
if (closed || loadTimedOut || terminalDelivered) return;
|
|
232
187
|
if (event.origin !== hostedOrigin) return;
|
|
233
188
|
if (!overlay.iframe.contentWindow || event.source !== overlay.iframe.contentWindow) {
|
|
234
189
|
return;
|
|
235
190
|
}
|
|
236
191
|
const data = event.data;
|
|
237
|
-
if (!data || typeof data !== "object" || data.protocol !==
|
|
192
|
+
if (!data || typeof data !== "object" || data.protocol !== names.protocol) {
|
|
238
193
|
return;
|
|
239
194
|
}
|
|
240
195
|
stopHello();
|
|
241
196
|
switch (data.type) {
|
|
242
|
-
case
|
|
197
|
+
case names.ready:
|
|
243
198
|
stopReadyWait();
|
|
244
199
|
overlay.markReady();
|
|
245
200
|
break;
|
|
246
|
-
case
|
|
201
|
+
case names.complete: {
|
|
247
202
|
if (terminalDelivered) break;
|
|
248
203
|
stopReadyWait();
|
|
249
204
|
terminalDelivered = true;
|
|
@@ -253,14 +208,14 @@ function open(options) {
|
|
|
253
208
|
});
|
|
254
209
|
break;
|
|
255
210
|
}
|
|
256
|
-
case
|
|
211
|
+
case names.error:
|
|
257
212
|
stopReadyWait();
|
|
258
|
-
(
|
|
213
|
+
(_a2 = options.onError) == null ? void 0 : _a2.call(options, {
|
|
259
214
|
code: typeof data.code === "string" ? data.code : "internal",
|
|
260
215
|
message: typeof data.message === "string" ? data.message : ""
|
|
261
216
|
});
|
|
262
217
|
break;
|
|
263
|
-
case
|
|
218
|
+
case names.close:
|
|
264
219
|
close();
|
|
265
220
|
break;
|
|
266
221
|
default:
|
|
@@ -269,11 +224,11 @@ function open(options) {
|
|
|
269
224
|
};
|
|
270
225
|
window.addEventListener("message", onMessage);
|
|
271
226
|
readyTimer = setTimeout(() => {
|
|
272
|
-
var
|
|
227
|
+
var _a2;
|
|
273
228
|
if (readyTimer === null || closed || terminalDelivered) return;
|
|
274
229
|
loadTimedOut = true;
|
|
275
230
|
try {
|
|
276
|
-
(
|
|
231
|
+
(_a2 = options.onError) == null ? void 0 : _a2.call(options, {
|
|
277
232
|
code: "load_timeout",
|
|
278
233
|
message: "Verification did not load. Please try again."
|
|
279
234
|
});
|
|
@@ -282,7 +237,7 @@ function open(options) {
|
|
|
282
237
|
}
|
|
283
238
|
}, READY_TIMEOUT_MS);
|
|
284
239
|
function close() {
|
|
285
|
-
var
|
|
240
|
+
var _a2;
|
|
286
241
|
if (closed) return;
|
|
287
242
|
closed = true;
|
|
288
243
|
if (autoCloseTimer !== null) clearTimeout(autoCloseTimer);
|
|
@@ -290,9 +245,88 @@ function open(options) {
|
|
|
290
245
|
stopHello();
|
|
291
246
|
window.removeEventListener("message", onMessage);
|
|
292
247
|
overlay.destroy();
|
|
293
|
-
if (!terminalDelivered) (
|
|
248
|
+
if (!terminalDelivered) (_a2 = options.onClose) == null ? void 0 : _a2.call(options);
|
|
294
249
|
}
|
|
295
250
|
return { close };
|
|
296
251
|
}
|
|
252
|
+
|
|
253
|
+
// sdk/src/trustedOrigin.ts
|
|
254
|
+
function trustedOrigin(value) {
|
|
255
|
+
const url = new URL(value);
|
|
256
|
+
const local = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
257
|
+
if (url.origin !== value || url.username || url.password || value.includes("*") || url.protocol !== "https:" && !(url.protocol === "http:" && local)) {
|
|
258
|
+
throw new Error("Use an exact HTTPS origin (HTTP loopback is allowed for development)");
|
|
259
|
+
}
|
|
260
|
+
return url.origin;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// sdk/src/urlCheck.ts
|
|
264
|
+
var HOSTED_PATH_RE = /^\/v\/[0-9a-f]{32}$/;
|
|
265
|
+
function checkHostedUrl(raw, prefix, configuredOrigin, checkUnconfigured) {
|
|
266
|
+
let url;
|
|
267
|
+
try {
|
|
268
|
+
url = new URL(raw);
|
|
269
|
+
} catch (e) {
|
|
270
|
+
throw new Error(`${prefix} "url" is not a valid absolute URL`);
|
|
271
|
+
}
|
|
272
|
+
if (configuredOrigin !== void 0) {
|
|
273
|
+
if (url.origin !== configuredOrigin) {
|
|
274
|
+
throw new Error(`${prefix} "url" does not match the configured verificationOrigin`);
|
|
275
|
+
}
|
|
276
|
+
} else if (checkUnconfigured) {
|
|
277
|
+
checkUnconfigured(url);
|
|
278
|
+
} else {
|
|
279
|
+
throw new Error(`${prefix} open() requires "verificationOrigin"`);
|
|
280
|
+
}
|
|
281
|
+
if (url.username || url.password) {
|
|
282
|
+
throw new Error(`${prefix} "url" must not embed credentials`);
|
|
283
|
+
}
|
|
284
|
+
if (!HOSTED_PATH_RE.test(url.pathname)) {
|
|
285
|
+
throw new Error(
|
|
286
|
+
`${prefix} "url" does not look like a hosted verification URL (/v/{token})`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
return { url, hostedOrigin: url.origin };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// sdk/src/hostedUrl.ts
|
|
293
|
+
var ERROR_PREFIX = "SolitonVerify:";
|
|
294
|
+
var ALLOWED_HTTPS_ORIGINS = /* @__PURE__ */ new Set([
|
|
295
|
+
"https://soliton.id",
|
|
296
|
+
"https://staging.soliton.id"
|
|
297
|
+
]);
|
|
298
|
+
function parseHostedUrl(raw, verificationOrigin) {
|
|
299
|
+
const configuredOrigin = verificationOrigin === void 0 ? void 0 : trustedOrigin(verificationOrigin);
|
|
300
|
+
return checkHostedUrl(raw, ERROR_PREFIX, configuredOrigin, (url) => {
|
|
301
|
+
const isLocalHttp = url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1");
|
|
302
|
+
if (!ALLOWED_HTTPS_ORIGINS.has(url.origin) && !isLocalHttp) {
|
|
303
|
+
throw new Error(
|
|
304
|
+
'SolitonVerify: "url" must be hosted on https://soliton.id or https://staging.soliton.id (http is allowed for localhost/127.0.0.1 development only)'
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// sdk/src/types.ts
|
|
311
|
+
var EMBED_PROTOCOL = "soliton-v1";
|
|
312
|
+
|
|
313
|
+
// sdk/src/index.ts
|
|
314
|
+
var SOLITON_NAMES = {
|
|
315
|
+
protocol: EMBED_PROTOCOL,
|
|
316
|
+
hello: "soliton:hello",
|
|
317
|
+
ready: "soliton:ready",
|
|
318
|
+
complete: "soliton:complete",
|
|
319
|
+
error: "soliton:error",
|
|
320
|
+
close: "soliton:close",
|
|
321
|
+
errorPrefix: "SolitonVerify:",
|
|
322
|
+
overlay: {
|
|
323
|
+
marker: "data-soliton-sdk",
|
|
324
|
+
animation: "soliton-sdk-spin",
|
|
325
|
+
title: "Soliton identity verification"
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
function open(options) {
|
|
329
|
+
return openOverlay(options, SOLITON_NAMES, parseHostedUrl);
|
|
330
|
+
}
|
|
297
331
|
var SolitonVerify = { open };
|
|
298
332
|
var index_default = SolitonVerify;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* the iframe, so anti-injection defenses update with each frontend release and the
|
|
7
7
|
* verdict never touches the customer page (only the verification id does).
|
|
8
8
|
*
|
|
9
|
+
* The lifecycle itself lives in core.ts; this entry injects the soliton-v1
|
|
10
|
+
* names and the Soliton origin allowlist. The white-label entry
|
|
11
|
+
* (white-label.ts) injects neutral ones instead and never imports this file.
|
|
12
|
+
*
|
|
9
13
|
* Built artifacts (npm run build:sdk):
|
|
10
14
|
* public/sdk/v1/soliton-web-sdk.js IIFE, global `SolitonVerify`
|
|
11
15
|
* public/sdk/v1/soliton-web-sdk.esm.js ESM, `import { open } ...`
|