@cross-deck/web
Advanced tools
| /** | ||
| * Crossdeck Trust — the human-proof panel, native to the SDK. | ||
| * | ||
| * This is the browser half of Crossdeck Trust wired THROUGH the SDK the customer | ||
| * already runs, not bolted on beside it. It renders the SAME cross-origin iframe | ||
| * served from trust.cross-deck.com — the un-restylable, browser-enforced brand | ||
| * panel — and hands the minted attestation back PROGRAMMATICALLY (a Promise + an | ||
| * `onToken` callback) instead of the hidden-field/DOM handshake the raw | ||
| * `embed.js` loader uses. The iframe is the bouncer; the SDK is the premium front | ||
| * door to it. You pass the token to your server, which verifies it at the gate | ||
| * (`crossdeck.trust.gate(...)` in @cross-deck/node, or a raw POST /v1/trust/gate). | ||
| * | ||
| * Non-negotiables baked in (Stripe / Cloudflare / bank grade): | ||
| * - ISOLATED — every DOM / postMessage touch is wrapped; a stumble here can never | ||
| * throw into the host app, the rest of the SDK, or the customer's signup form. | ||
| * - FAIL-OPEN, never fail-allow — if the panel can't mint (adblocker, our outage, | ||
| * offline, timeout), `ready` resolves with NO token. The signup proceeds; the | ||
| * SERVER gate scores the ABSENCE. We never wave a tokenless request through, and | ||
| * we never block the form because our panel had a bad day. Failing CLOSED would | ||
| * hand an attacker a site-wide-outage weapon — so we never do. | ||
| * - ORIGIN-LOCKED — we only trust messages from OUR panel origin AND from this | ||
| * exact iframe's window. Nothing on the host page can forge a token. | ||
| * - The token is minted INSIDE our origin; the host page (even an XSS on it) never | ||
| * participates in the mint, it only receives the finished token. | ||
| */ | ||
| /** The origin that serves the branded, un-restylable Trust panel. */ | ||
| declare const TRUST_PANEL_ORIGIN = "https://trust.cross-deck.com"; | ||
| /** A minted human-proof attestation. Pass `token` to your gate call. */ | ||
| interface TrustToken { | ||
| /** The single-use, project-bound attestation to send to your server as `token`. */ | ||
| token: string; | ||
| /** Epoch ms at which the token expires (mint fresh per signup attempt), or null. */ | ||
| expiresAt: number | null; | ||
| } | ||
| /** Resolution of a panel that failed open — a token never minted. Not an error. */ | ||
| interface TrustUnavailable { | ||
| token: null; | ||
| expiresAt: null; | ||
| /** Why no token was minted (for your logs) — e.g. "timeout", "blocked", "offline". */ | ||
| reason: string; | ||
| } | ||
| type TrustResult = TrustToken | TrustUnavailable; | ||
| /** Lifecycle of a panel driven by a framework binding: pending → ready | unavailable. */ | ||
| type TrustTokenStatus = "pending" | "ready" | "unavailable"; | ||
| interface MountTrustPanelOptions { | ||
| /** The project's publishable key (cd_pub_…). The SDK client supplies this for you. */ | ||
| publicKey: string; | ||
| /** Where to render the panel — an element or a selector resolved at mount time. */ | ||
| target: HTMLElement | string; | ||
| /** Called once when a token is minted. Optional — you can await `ready` instead. */ | ||
| onToken?: (t: TrustToken) => void; | ||
| /** | ||
| * Called if the panel could not mint (blocked, offline, timeout, our outage). | ||
| * INFORMATIONAL for your logs — NOT an error you must handle: `ready` still | ||
| * resolves and your signup proceeds. Fail-open is the contract. | ||
| */ | ||
| onUnavailable?: (reason: string) => void; | ||
| /** Override the panel origin (tests / self-host). Defaults to production. */ | ||
| origin?: string; | ||
| /** Max wait for a mint before failing open, in ms. Default 15000. */ | ||
| timeoutMs?: number; | ||
| } | ||
| interface TrustPanelHandle { | ||
| /** The iframe we mounted — for layout/measurement only; never reach inside it. */ | ||
| readonly frame: HTMLIFrameElement | null; | ||
| /** | ||
| * Resolves EXACTLY once: the token on success, or a {@link TrustUnavailable} if | ||
| * the panel failed open. NEVER rejects — a rejection would tempt callers to block | ||
| * the signup, which is precisely what fail-open forbids. | ||
| */ | ||
| readonly ready: Promise<TrustResult>; | ||
| /** Tear down: remove the iframe + listeners. Idempotent. */ | ||
| destroy(): void; | ||
| } | ||
| /** | ||
| * Options for `Crossdeck.trust.panel(...)` — the same as {@link MountTrustPanelOptions} | ||
| * but the SDK client injects `publicKey` from your `init()`, so you omit it. | ||
| */ | ||
| type TrustPanelInput = Omit<MountTrustPanelOptions, "publicKey"> & { | ||
| /** | ||
| * The project's publishable key (cd_pub_…). Pass it **explicitly** — the robust, | ||
| * Stripe (`loadStripe(pk)`) / Cloudflare Turnstile (`sitekey`) pattern — and the | ||
| * panel needs no `Crossdeck.init()` at all. Omit it and the SDK falls back to the | ||
| * key from `init()`. Explicit always wins. | ||
| */ | ||
| publicKey?: string; | ||
| }; | ||
| /** The `Crossdeck.trust` namespace surfaced on the SDK client. */ | ||
| interface CrossdeckTrustNamespace { | ||
| /** Render the branded Trust panel and mint an attestation. See {@link mountTrustPanel}. */ | ||
| panel(input: TrustPanelInput): TrustPanelHandle; | ||
| } | ||
| /** | ||
| * Mount the Crossdeck Trust panel and mint an attestation. Framework-agnostic and | ||
| * guaranteed not to throw — any construction failure resolves `ready` fail-open. | ||
| */ | ||
| declare function mountTrustPanel(opts: MountTrustPanelOptions): TrustPanelHandle; | ||
| export { type CrossdeckTrustNamespace as C, type MountTrustPanelOptions as M, TRUST_PANEL_ORIGIN as T, type TrustPanelHandle as a, type TrustPanelInput as b, type TrustResult as c, type TrustToken as d, type TrustTokenStatus as e, type TrustUnavailable as f, mountTrustPanel as m }; |
| /** | ||
| * Crossdeck Trust — the human-proof panel, native to the SDK. | ||
| * | ||
| * This is the browser half of Crossdeck Trust wired THROUGH the SDK the customer | ||
| * already runs, not bolted on beside it. It renders the SAME cross-origin iframe | ||
| * served from trust.cross-deck.com — the un-restylable, browser-enforced brand | ||
| * panel — and hands the minted attestation back PROGRAMMATICALLY (a Promise + an | ||
| * `onToken` callback) instead of the hidden-field/DOM handshake the raw | ||
| * `embed.js` loader uses. The iframe is the bouncer; the SDK is the premium front | ||
| * door to it. You pass the token to your server, which verifies it at the gate | ||
| * (`crossdeck.trust.gate(...)` in @cross-deck/node, or a raw POST /v1/trust/gate). | ||
| * | ||
| * Non-negotiables baked in (Stripe / Cloudflare / bank grade): | ||
| * - ISOLATED — every DOM / postMessage touch is wrapped; a stumble here can never | ||
| * throw into the host app, the rest of the SDK, or the customer's signup form. | ||
| * - FAIL-OPEN, never fail-allow — if the panel can't mint (adblocker, our outage, | ||
| * offline, timeout), `ready` resolves with NO token. The signup proceeds; the | ||
| * SERVER gate scores the ABSENCE. We never wave a tokenless request through, and | ||
| * we never block the form because our panel had a bad day. Failing CLOSED would | ||
| * hand an attacker a site-wide-outage weapon — so we never do. | ||
| * - ORIGIN-LOCKED — we only trust messages from OUR panel origin AND from this | ||
| * exact iframe's window. Nothing on the host page can forge a token. | ||
| * - The token is minted INSIDE our origin; the host page (even an XSS on it) never | ||
| * participates in the mint, it only receives the finished token. | ||
| */ | ||
| /** The origin that serves the branded, un-restylable Trust panel. */ | ||
| declare const TRUST_PANEL_ORIGIN = "https://trust.cross-deck.com"; | ||
| /** A minted human-proof attestation. Pass `token` to your gate call. */ | ||
| interface TrustToken { | ||
| /** The single-use, project-bound attestation to send to your server as `token`. */ | ||
| token: string; | ||
| /** Epoch ms at which the token expires (mint fresh per signup attempt), or null. */ | ||
| expiresAt: number | null; | ||
| } | ||
| /** Resolution of a panel that failed open — a token never minted. Not an error. */ | ||
| interface TrustUnavailable { | ||
| token: null; | ||
| expiresAt: null; | ||
| /** Why no token was minted (for your logs) — e.g. "timeout", "blocked", "offline". */ | ||
| reason: string; | ||
| } | ||
| type TrustResult = TrustToken | TrustUnavailable; | ||
| /** Lifecycle of a panel driven by a framework binding: pending → ready | unavailable. */ | ||
| type TrustTokenStatus = "pending" | "ready" | "unavailable"; | ||
| interface MountTrustPanelOptions { | ||
| /** The project's publishable key (cd_pub_…). The SDK client supplies this for you. */ | ||
| publicKey: string; | ||
| /** Where to render the panel — an element or a selector resolved at mount time. */ | ||
| target: HTMLElement | string; | ||
| /** Called once when a token is minted. Optional — you can await `ready` instead. */ | ||
| onToken?: (t: TrustToken) => void; | ||
| /** | ||
| * Called if the panel could not mint (blocked, offline, timeout, our outage). | ||
| * INFORMATIONAL for your logs — NOT an error you must handle: `ready` still | ||
| * resolves and your signup proceeds. Fail-open is the contract. | ||
| */ | ||
| onUnavailable?: (reason: string) => void; | ||
| /** Override the panel origin (tests / self-host). Defaults to production. */ | ||
| origin?: string; | ||
| /** Max wait for a mint before failing open, in ms. Default 15000. */ | ||
| timeoutMs?: number; | ||
| } | ||
| interface TrustPanelHandle { | ||
| /** The iframe we mounted — for layout/measurement only; never reach inside it. */ | ||
| readonly frame: HTMLIFrameElement | null; | ||
| /** | ||
| * Resolves EXACTLY once: the token on success, or a {@link TrustUnavailable} if | ||
| * the panel failed open. NEVER rejects — a rejection would tempt callers to block | ||
| * the signup, which is precisely what fail-open forbids. | ||
| */ | ||
| readonly ready: Promise<TrustResult>; | ||
| /** Tear down: remove the iframe + listeners. Idempotent. */ | ||
| destroy(): void; | ||
| } | ||
| /** | ||
| * Options for `Crossdeck.trust.panel(...)` — the same as {@link MountTrustPanelOptions} | ||
| * but the SDK client injects `publicKey` from your `init()`, so you omit it. | ||
| */ | ||
| type TrustPanelInput = Omit<MountTrustPanelOptions, "publicKey"> & { | ||
| /** | ||
| * The project's publishable key (cd_pub_…). Pass it **explicitly** — the robust, | ||
| * Stripe (`loadStripe(pk)`) / Cloudflare Turnstile (`sitekey`) pattern — and the | ||
| * panel needs no `Crossdeck.init()` at all. Omit it and the SDK falls back to the | ||
| * key from `init()`. Explicit always wins. | ||
| */ | ||
| publicKey?: string; | ||
| }; | ||
| /** The `Crossdeck.trust` namespace surfaced on the SDK client. */ | ||
| interface CrossdeckTrustNamespace { | ||
| /** Render the branded Trust panel and mint an attestation. See {@link mountTrustPanel}. */ | ||
| panel(input: TrustPanelInput): TrustPanelHandle; | ||
| } | ||
| /** | ||
| * Mount the Crossdeck Trust panel and mint an attestation. Framework-agnostic and | ||
| * guaranteed not to throw — any construction failure resolves `ready` fail-open. | ||
| */ | ||
| declare function mountTrustPanel(opts: MountTrustPanelOptions): TrustPanelHandle; | ||
| export { type CrossdeckTrustNamespace as C, type MountTrustPanelOptions as M, TRUST_PANEL_ORIGIN as T, type TrustPanelHandle as a, type TrustPanelInput as b, type TrustResult as c, type TrustToken as d, type TrustTokenStatus as e, type TrustUnavailable as f, mountTrustPanel as m }; |
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "generatedAt": "2026-07-26T13:09:24.739Z", | ||
| "generatedAt": "2026-07-27T07:09:50.617Z", | ||
| "sdk": "@cross-deck/web", | ||
@@ -5,0 +5,0 @@ "codes": [ |
+3
-3
@@ -1,3 +0,3 @@ | ||
| import { C as CrossdeckTrustNamespace } from './trust-C0RcpR5I.mjs'; | ||
| export { M as MountTrustPanelOptions, T as TRUST_PANEL_ORIGIN, a as TrustPanelHandle, b as TrustPanelInput, c as TrustResult, d as TrustToken, e as TrustTokenStatus, f as TrustUnavailable, m as mountTrustPanel } from './trust-C0RcpR5I.mjs'; | ||
| import { C as CrossdeckTrustNamespace } from './trust-akYVfmoN.mjs'; | ||
| export { M as MountTrustPanelOptions, T as TRUST_PANEL_ORIGIN, a as TrustPanelHandle, b as TrustPanelInput, c as TrustResult, d as TrustToken, e as TrustTokenStatus, f as TrustUnavailable, m as mountTrustPanel } from './trust-akYVfmoN.mjs'; | ||
| import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-iqtsOTGy.mjs'; | ||
@@ -993,3 +993,3 @@ export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-iqtsOTGy.mjs'; | ||
| */ | ||
| declare const SDK_VERSION = "1.13.0"; | ||
| declare const SDK_VERSION = "1.13.1"; | ||
| declare const SDK_NAME = "@cross-deck/web"; | ||
@@ -996,0 +996,0 @@ |
+3
-3
@@ -1,3 +0,3 @@ | ||
| import { C as CrossdeckTrustNamespace } from './trust-C0RcpR5I.js'; | ||
| export { M as MountTrustPanelOptions, T as TRUST_PANEL_ORIGIN, a as TrustPanelHandle, b as TrustPanelInput, c as TrustResult, d as TrustToken, e as TrustTokenStatus, f as TrustUnavailable, m as mountTrustPanel } from './trust-C0RcpR5I.js'; | ||
| import { C as CrossdeckTrustNamespace } from './trust-akYVfmoN.js'; | ||
| export { M as MountTrustPanelOptions, T as TRUST_PANEL_ORIGIN, a as TrustPanelHandle, b as TrustPanelInput, c as TrustResult, d as TrustToken, e as TrustTokenStatus, f as TrustUnavailable, m as mountTrustPanel } from './trust-akYVfmoN.js'; | ||
| import { P as PublicEntitlement, C as CrossdeckOptions, I as IdentifyOptions, A as AliasResult, G as GroupTraits, E as EventProperties, a as PurchaseResult, H as HeartbeatResponse, D as Diagnostics, K as KeyValueStorage } from './types-iqtsOTGy.js'; | ||
@@ -993,3 +993,3 @@ export { b as AuditRail, c as AutoTrackOptions, d as EntitlementsListResponse, e as Environment, f as Platform } from './types-iqtsOTGy.js'; | ||
| */ | ||
| declare const SDK_VERSION = "1.13.0"; | ||
| declare const SDK_VERSION = "1.13.1"; | ||
| declare const SDK_NAME = "@cross-deck/web"; | ||
@@ -996,0 +996,0 @@ |
+11
-2
| import { ReactNode, CSSProperties, RefObject } from 'react'; | ||
| import { C as CrossdeckOptions } from './types-iqtsOTGy.mjs'; | ||
| import { d as TrustToken, e as TrustTokenStatus } from './trust-C0RcpR5I.mjs'; | ||
| import { d as TrustToken, e as TrustTokenStatus } from './trust-akYVfmoN.mjs'; | ||
@@ -92,2 +92,8 @@ /** | ||
| interface CrossdeckTrustProps { | ||
| /** | ||
| * The project's publishable key (cd_pub_…). Pass it here — the robust, explicit way | ||
| * (like Stripe / Turnstile) — and no `Crossdeck.init()` / `<CrossdeckProvider>` is | ||
| * needed. Omit it and the SDK falls back to the key from `init()`. | ||
| */ | ||
| publicKey?: string; | ||
| /** Called once when the panel mints a token. Pass `t.token` to your gate call. */ | ||
@@ -121,3 +127,6 @@ onToken?: (t: TrustToken) => void; | ||
| */ | ||
| declare function useTrustToken(): { | ||
| declare function useTrustToken(opts?: { | ||
| /** Explicit publishable key (cd_pub_…) — no `init()` needed. Falls back to init's key. */ | ||
| publicKey?: string; | ||
| }): { | ||
| /** Attach to the element the panel should mount into: `<div ref={ref} />`. */ | ||
@@ -124,0 +133,0 @@ ref: RefObject<HTMLDivElement | null>; |
+11
-2
| import { ReactNode, CSSProperties, RefObject } from 'react'; | ||
| import { C as CrossdeckOptions } from './types-iqtsOTGy.js'; | ||
| import { d as TrustToken, e as TrustTokenStatus } from './trust-C0RcpR5I.js'; | ||
| import { d as TrustToken, e as TrustTokenStatus } from './trust-akYVfmoN.js'; | ||
@@ -92,2 +92,8 @@ /** | ||
| interface CrossdeckTrustProps { | ||
| /** | ||
| * The project's publishable key (cd_pub_…). Pass it here — the robust, explicit way | ||
| * (like Stripe / Turnstile) — and no `Crossdeck.init()` / `<CrossdeckProvider>` is | ||
| * needed. Omit it and the SDK falls back to the key from `init()`. | ||
| */ | ||
| publicKey?: string; | ||
| /** Called once when the panel mints a token. Pass `t.token` to your gate call. */ | ||
@@ -121,3 +127,6 @@ onToken?: (t: TrustToken) => void; | ||
| */ | ||
| declare function useTrustToken(): { | ||
| declare function useTrustToken(opts?: { | ||
| /** Explicit publishable key (cd_pub_…) — no `init()` needed. Falls back to init's key. */ | ||
| publicKey?: string; | ||
| }): { | ||
| /** Attach to the element the panel should mount into: `<div ref={ref} />`. */ | ||
@@ -124,0 +133,0 @@ ref: RefObject<HTMLDivElement | null>; |
+5
-2
| import { Ref } from 'vue'; | ||
| import { e as TrustTokenStatus } from './trust-C0RcpR5I.mjs'; | ||
| import { e as TrustTokenStatus } from './trust-akYVfmoN.mjs'; | ||
@@ -52,3 +52,6 @@ /** | ||
| */ | ||
| declare function useTrustToken(): { | ||
| declare function useTrustToken(opts?: { | ||
| /** Explicit publishable key (cd_pub_…) — no `init()` needed. Falls back to init's key. */ | ||
| publicKey?: string; | ||
| }): { | ||
| /** Template ref — bind to the mount element: `<div ref="el" />`. */ | ||
@@ -55,0 +58,0 @@ el: Ref<HTMLElement | null>; |
+5
-2
| import { Ref } from 'vue'; | ||
| import { e as TrustTokenStatus } from './trust-C0RcpR5I.js'; | ||
| import { e as TrustTokenStatus } from './trust-akYVfmoN.js'; | ||
@@ -52,3 +52,6 @@ /** | ||
| */ | ||
| declare function useTrustToken(): { | ||
| declare function useTrustToken(opts?: { | ||
| /** Explicit publishable key (cd_pub_…) — no `init()` needed. Falls back to init's key. */ | ||
| publicKey?: string; | ||
| }): { | ||
| /** Template ref — bind to the mount element: `<div ref="el" />`. */ | ||
@@ -55,0 +58,0 @@ el: Ref<HTMLElement | null>; |
+1
-1
| { | ||
| "name": "@cross-deck/web", | ||
| "version": "1.13.0", | ||
| "version": "1.13.1", | ||
| "description": "Crossdeck SDK for browsers and Node.js — verified subscriptions, entitlements, and product telemetry in one client.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
+7
-6
@@ -96,4 +96,4 @@ # @cross-deck/web | ||
| <CrossdeckTrust onToken={(t) => setTrustToken(t.token)} /> | ||
| // or headless: const { ref, token, status } = useTrustToken(); // <div ref={ref} /> | ||
| <CrossdeckTrust publicKey="cd_pub_live_…" onToken={(t) => setTrustToken(t.token)} /> | ||
| // or headless: const { ref, token, status } = useTrustToken({ publicKey: "cd_pub_live_…" }); // <div ref={ref} /> | ||
| ``` | ||
@@ -105,3 +105,3 @@ | ||
| import { useTrustToken } from "@cross-deck/web/vue"; | ||
| const { el, token } = useTrustToken(); | ||
| const { el, token } = useTrustToken({ publicKey: "cd_pub_live_…" }); | ||
| </script> | ||
@@ -113,8 +113,9 @@ <template><div ref="el" /></template> | ||
| // No framework: | ||
| const { ready } = Crossdeck.trust.panel({ target: "#cd-trust" }); | ||
| const { ready } = Crossdeck.trust.panel({ target: "#cd-trust", publicKey: "cd_pub_live_…" }); | ||
| const { token } = await ready; // { token, expiresAt } | { token: null } | ||
| ``` | ||
| The publishable key comes from your `init()`. Send `token` to your server and verify it at | ||
| the gate (`crossdeck.trust.gate({ email, ip, token })` in `@cross-deck/node`). **Fail-open:** | ||
| Pass your publishable key to the panel directly (the Stripe / Turnstile pattern; it also | ||
| falls back to `init()`'s key). Send `token` to your server and verify it at the gate | ||
| (`crossdeck.trust.gate({ email, ip, token })` in `@cross-deck/node`). **Fail-open:** | ||
| if the panel can't mint (adblocker, offline, outage) you get `{ token: null }`, the signup | ||
@@ -121,0 +122,0 @@ proceeds, and the server scores the absent token — it never throws and never blocks your |
| /** | ||
| * Crossdeck Trust — the human-proof panel, native to the SDK. | ||
| * | ||
| * This is the browser half of Crossdeck Trust wired THROUGH the SDK the customer | ||
| * already runs, not bolted on beside it. It renders the SAME cross-origin iframe | ||
| * served from trust.cross-deck.com — the un-restylable, browser-enforced brand | ||
| * panel — and hands the minted attestation back PROGRAMMATICALLY (a Promise + an | ||
| * `onToken` callback) instead of the hidden-field/DOM handshake the raw | ||
| * `embed.js` loader uses. The iframe is the bouncer; the SDK is the premium front | ||
| * door to it. You pass the token to your server, which verifies it at the gate | ||
| * (`crossdeck.trust.gate(...)` in @cross-deck/node, or a raw POST /v1/trust/gate). | ||
| * | ||
| * Non-negotiables baked in (Stripe / Cloudflare / bank grade): | ||
| * - ISOLATED — every DOM / postMessage touch is wrapped; a stumble here can never | ||
| * throw into the host app, the rest of the SDK, or the customer's signup form. | ||
| * - FAIL-OPEN, never fail-allow — if the panel can't mint (adblocker, our outage, | ||
| * offline, timeout), `ready` resolves with NO token. The signup proceeds; the | ||
| * SERVER gate scores the ABSENCE. We never wave a tokenless request through, and | ||
| * we never block the form because our panel had a bad day. Failing CLOSED would | ||
| * hand an attacker a site-wide-outage weapon — so we never do. | ||
| * - ORIGIN-LOCKED — we only trust messages from OUR panel origin AND from this | ||
| * exact iframe's window. Nothing on the host page can forge a token. | ||
| * - The token is minted INSIDE our origin; the host page (even an XSS on it) never | ||
| * participates in the mint, it only receives the finished token. | ||
| */ | ||
| /** The origin that serves the branded, un-restylable Trust panel. */ | ||
| declare const TRUST_PANEL_ORIGIN = "https://trust.cross-deck.com"; | ||
| /** A minted human-proof attestation. Pass `token` to your gate call. */ | ||
| interface TrustToken { | ||
| /** The single-use, project-bound attestation to send to your server as `token`. */ | ||
| token: string; | ||
| /** Epoch ms at which the token expires (mint fresh per signup attempt), or null. */ | ||
| expiresAt: number | null; | ||
| } | ||
| /** Resolution of a panel that failed open — a token never minted. Not an error. */ | ||
| interface TrustUnavailable { | ||
| token: null; | ||
| expiresAt: null; | ||
| /** Why no token was minted (for your logs) — e.g. "timeout", "blocked", "offline". */ | ||
| reason: string; | ||
| } | ||
| type TrustResult = TrustToken | TrustUnavailable; | ||
| /** Lifecycle of a panel driven by a framework binding: pending → ready | unavailable. */ | ||
| type TrustTokenStatus = "pending" | "ready" | "unavailable"; | ||
| interface MountTrustPanelOptions { | ||
| /** The project's publishable key (cd_pub_…). The SDK client supplies this for you. */ | ||
| publicKey: string; | ||
| /** Where to render the panel — an element or a selector resolved at mount time. */ | ||
| target: HTMLElement | string; | ||
| /** Called once when a token is minted. Optional — you can await `ready` instead. */ | ||
| onToken?: (t: TrustToken) => void; | ||
| /** | ||
| * Called if the panel could not mint (blocked, offline, timeout, our outage). | ||
| * INFORMATIONAL for your logs — NOT an error you must handle: `ready` still | ||
| * resolves and your signup proceeds. Fail-open is the contract. | ||
| */ | ||
| onUnavailable?: (reason: string) => void; | ||
| /** Override the panel origin (tests / self-host). Defaults to production. */ | ||
| origin?: string; | ||
| /** Max wait for a mint before failing open, in ms. Default 15000. */ | ||
| timeoutMs?: number; | ||
| } | ||
| interface TrustPanelHandle { | ||
| /** The iframe we mounted — for layout/measurement only; never reach inside it. */ | ||
| readonly frame: HTMLIFrameElement | null; | ||
| /** | ||
| * Resolves EXACTLY once: the token on success, or a {@link TrustUnavailable} if | ||
| * the panel failed open. NEVER rejects — a rejection would tempt callers to block | ||
| * the signup, which is precisely what fail-open forbids. | ||
| */ | ||
| readonly ready: Promise<TrustResult>; | ||
| /** Tear down: remove the iframe + listeners. Idempotent. */ | ||
| destroy(): void; | ||
| } | ||
| /** | ||
| * Options for `Crossdeck.trust.panel(...)` — the same as {@link MountTrustPanelOptions} | ||
| * but the SDK client injects `publicKey` from your `init()`, so you omit it. | ||
| */ | ||
| type TrustPanelInput = Omit<MountTrustPanelOptions, "publicKey">; | ||
| /** The `Crossdeck.trust` namespace surfaced on the SDK client. */ | ||
| interface CrossdeckTrustNamespace { | ||
| /** Render the branded Trust panel and mint an attestation. See {@link mountTrustPanel}. */ | ||
| panel(input: TrustPanelInput): TrustPanelHandle; | ||
| } | ||
| /** | ||
| * Mount the Crossdeck Trust panel and mint an attestation. Framework-agnostic and | ||
| * guaranteed not to throw — any construction failure resolves `ready` fail-open. | ||
| */ | ||
| declare function mountTrustPanel(opts: MountTrustPanelOptions): TrustPanelHandle; | ||
| export { type CrossdeckTrustNamespace as C, type MountTrustPanelOptions as M, TRUST_PANEL_ORIGIN as T, type TrustPanelHandle as a, type TrustPanelInput as b, type TrustResult as c, type TrustToken as d, type TrustTokenStatus as e, type TrustUnavailable as f, mountTrustPanel as m }; |
| /** | ||
| * Crossdeck Trust — the human-proof panel, native to the SDK. | ||
| * | ||
| * This is the browser half of Crossdeck Trust wired THROUGH the SDK the customer | ||
| * already runs, not bolted on beside it. It renders the SAME cross-origin iframe | ||
| * served from trust.cross-deck.com — the un-restylable, browser-enforced brand | ||
| * panel — and hands the minted attestation back PROGRAMMATICALLY (a Promise + an | ||
| * `onToken` callback) instead of the hidden-field/DOM handshake the raw | ||
| * `embed.js` loader uses. The iframe is the bouncer; the SDK is the premium front | ||
| * door to it. You pass the token to your server, which verifies it at the gate | ||
| * (`crossdeck.trust.gate(...)` in @cross-deck/node, or a raw POST /v1/trust/gate). | ||
| * | ||
| * Non-negotiables baked in (Stripe / Cloudflare / bank grade): | ||
| * - ISOLATED — every DOM / postMessage touch is wrapped; a stumble here can never | ||
| * throw into the host app, the rest of the SDK, or the customer's signup form. | ||
| * - FAIL-OPEN, never fail-allow — if the panel can't mint (adblocker, our outage, | ||
| * offline, timeout), `ready` resolves with NO token. The signup proceeds; the | ||
| * SERVER gate scores the ABSENCE. We never wave a tokenless request through, and | ||
| * we never block the form because our panel had a bad day. Failing CLOSED would | ||
| * hand an attacker a site-wide-outage weapon — so we never do. | ||
| * - ORIGIN-LOCKED — we only trust messages from OUR panel origin AND from this | ||
| * exact iframe's window. Nothing on the host page can forge a token. | ||
| * - The token is minted INSIDE our origin; the host page (even an XSS on it) never | ||
| * participates in the mint, it only receives the finished token. | ||
| */ | ||
| /** The origin that serves the branded, un-restylable Trust panel. */ | ||
| declare const TRUST_PANEL_ORIGIN = "https://trust.cross-deck.com"; | ||
| /** A minted human-proof attestation. Pass `token` to your gate call. */ | ||
| interface TrustToken { | ||
| /** The single-use, project-bound attestation to send to your server as `token`. */ | ||
| token: string; | ||
| /** Epoch ms at which the token expires (mint fresh per signup attempt), or null. */ | ||
| expiresAt: number | null; | ||
| } | ||
| /** Resolution of a panel that failed open — a token never minted. Not an error. */ | ||
| interface TrustUnavailable { | ||
| token: null; | ||
| expiresAt: null; | ||
| /** Why no token was minted (for your logs) — e.g. "timeout", "blocked", "offline". */ | ||
| reason: string; | ||
| } | ||
| type TrustResult = TrustToken | TrustUnavailable; | ||
| /** Lifecycle of a panel driven by a framework binding: pending → ready | unavailable. */ | ||
| type TrustTokenStatus = "pending" | "ready" | "unavailable"; | ||
| interface MountTrustPanelOptions { | ||
| /** The project's publishable key (cd_pub_…). The SDK client supplies this for you. */ | ||
| publicKey: string; | ||
| /** Where to render the panel — an element or a selector resolved at mount time. */ | ||
| target: HTMLElement | string; | ||
| /** Called once when a token is minted. Optional — you can await `ready` instead. */ | ||
| onToken?: (t: TrustToken) => void; | ||
| /** | ||
| * Called if the panel could not mint (blocked, offline, timeout, our outage). | ||
| * INFORMATIONAL for your logs — NOT an error you must handle: `ready` still | ||
| * resolves and your signup proceeds. Fail-open is the contract. | ||
| */ | ||
| onUnavailable?: (reason: string) => void; | ||
| /** Override the panel origin (tests / self-host). Defaults to production. */ | ||
| origin?: string; | ||
| /** Max wait for a mint before failing open, in ms. Default 15000. */ | ||
| timeoutMs?: number; | ||
| } | ||
| interface TrustPanelHandle { | ||
| /** The iframe we mounted — for layout/measurement only; never reach inside it. */ | ||
| readonly frame: HTMLIFrameElement | null; | ||
| /** | ||
| * Resolves EXACTLY once: the token on success, or a {@link TrustUnavailable} if | ||
| * the panel failed open. NEVER rejects — a rejection would tempt callers to block | ||
| * the signup, which is precisely what fail-open forbids. | ||
| */ | ||
| readonly ready: Promise<TrustResult>; | ||
| /** Tear down: remove the iframe + listeners. Idempotent. */ | ||
| destroy(): void; | ||
| } | ||
| /** | ||
| * Options for `Crossdeck.trust.panel(...)` — the same as {@link MountTrustPanelOptions} | ||
| * but the SDK client injects `publicKey` from your `init()`, so you omit it. | ||
| */ | ||
| type TrustPanelInput = Omit<MountTrustPanelOptions, "publicKey">; | ||
| /** The `Crossdeck.trust` namespace surfaced on the SDK client. */ | ||
| interface CrossdeckTrustNamespace { | ||
| /** Render the branded Trust panel and mint an attestation. See {@link mountTrustPanel}. */ | ||
| panel(input: TrustPanelInput): TrustPanelHandle; | ||
| } | ||
| /** | ||
| * Mount the Crossdeck Trust panel and mint an attestation. Framework-agnostic and | ||
| * guaranteed not to throw — any construction failure resolves `ready` fail-open. | ||
| */ | ||
| declare function mountTrustPanel(opts: MountTrustPanelOptions): TrustPanelHandle; | ||
| export { type CrossdeckTrustNamespace as C, type MountTrustPanelOptions as M, TRUST_PANEL_ORIGIN as T, type TrustPanelHandle as a, type TrustPanelInput as b, type TrustResult as c, type TrustToken as d, type TrustTokenStatus as e, type TrustUnavailable as f, mountTrustPanel as m }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
5692454
0.19%40485
0.11%492
0.2%