@block-auth.io/core 0.11.1 → 0.13.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/dist/index.cjs +421 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +105 -5
- package/dist/index.d.ts +105 -5
- package/dist/index.js +417 -48
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,13 +16,11 @@ var __export = (target, all) => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// src/utils/apiBridge.ts
|
|
19
|
-
var DEFAULT_API_URL = "https://api.block-auth.io";
|
|
20
19
|
function buildApiUrl(path, apiUrl) {
|
|
21
|
-
|
|
22
|
-
return `${base}${path}`;
|
|
20
|
+
return `${apiUrl.replace(/\/+$/, "")}${path}`;
|
|
23
21
|
}
|
|
24
22
|
async function bridgeSessionCookie(token, apiUrl) {
|
|
25
|
-
if (!token || typeof fetch === "undefined") return false;
|
|
23
|
+
if (!apiUrl || !token || typeof fetch === "undefined") return false;
|
|
26
24
|
try {
|
|
27
25
|
const response = await fetch(buildApiUrl("/auth/session", apiUrl), {
|
|
28
26
|
method: "POST",
|
|
@@ -37,7 +35,7 @@ async function bridgeSessionCookie(token, apiUrl) {
|
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
async function clearSessionCookie(apiUrl) {
|
|
40
|
-
if (typeof fetch === "undefined") return false;
|
|
38
|
+
if (!apiUrl || typeof fetch === "undefined") return false;
|
|
41
39
|
try {
|
|
42
40
|
const response = await fetch(buildApiUrl("/auth/logout", apiUrl), {
|
|
43
41
|
method: "POST",
|
|
@@ -50,7 +48,9 @@ async function clearSessionCookie(apiUrl) {
|
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
async function requestWsTicket(apiUrl) {
|
|
53
|
-
if (typeof fetch === "undefined")
|
|
51
|
+
if (!apiUrl || typeof fetch === "undefined") {
|
|
52
|
+
return { ticket: null, refused: false };
|
|
53
|
+
}
|
|
54
54
|
try {
|
|
55
55
|
const response = await fetch(buildApiUrl("/auth/ws-ticket", apiUrl), {
|
|
56
56
|
method: "GET",
|
|
@@ -81,14 +81,11 @@ function buildWsServerApiUrl(path, wsUrl) {
|
|
|
81
81
|
async function fetchBrowserToken(apiKey, wsUrl) {
|
|
82
82
|
if (!apiKey || typeof fetch === "undefined") return null;
|
|
83
83
|
try {
|
|
84
|
-
const response = await fetch(
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
body: JSON.stringify({ apiKey })
|
|
90
|
-
}
|
|
91
|
-
);
|
|
84
|
+
const response = await fetch(buildWsServerApiUrl("/browser-token", wsUrl), {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers: { "Content-Type": "application/json" },
|
|
87
|
+
body: JSON.stringify({ apiKey })
|
|
88
|
+
});
|
|
92
89
|
const payload = await response.json();
|
|
93
90
|
if (!response.ok || !payload?.success) return null;
|
|
94
91
|
return payload.message?.accessToken || null;
|
|
@@ -119,6 +116,7 @@ var WsClient = class {
|
|
|
119
116
|
this._roles = [];
|
|
120
117
|
this._logs = [];
|
|
121
118
|
this._kycIssuerByAddress = {};
|
|
119
|
+
this._connecting = null;
|
|
122
120
|
this._wsUrl = url || "wss://wss.block-auth.io/";
|
|
123
121
|
this._apiUrl = apiUrl;
|
|
124
122
|
this._wsConfig = {
|
|
@@ -150,6 +148,14 @@ var WsClient = class {
|
|
|
150
148
|
* @returns Promise<void>
|
|
151
149
|
*/
|
|
152
150
|
async connect(url = "", waitMs = 5e3, retries = 3) {
|
|
151
|
+
if (this.isConnected()) return;
|
|
152
|
+
if (this._connecting) return this._connecting;
|
|
153
|
+
this._connecting = this._doConnect(url, waitMs, retries).finally(() => {
|
|
154
|
+
this._connecting = null;
|
|
155
|
+
});
|
|
156
|
+
return this._connecting;
|
|
157
|
+
}
|
|
158
|
+
async _doConnect(url, waitMs, retries) {
|
|
153
159
|
const _url = url || this._wsUrl;
|
|
154
160
|
this._wsConfig.auth = (done) => {
|
|
155
161
|
fetchWsTicket(this._apiUrl).then((ticket) => done(ticket ? { ticket } : {})).catch(() => done({}));
|
|
@@ -995,6 +1001,7 @@ var initial2 = {
|
|
|
995
1001
|
isSigned: false,
|
|
996
1002
|
isSigningLoader: false,
|
|
997
1003
|
isAcceptingTxn: false,
|
|
1004
|
+
isRejectingTxn: false,
|
|
998
1005
|
acceptTxnError: null,
|
|
999
1006
|
waitingForSuccessLogInSince: 0,
|
|
1000
1007
|
isOtpRequired: false,
|
|
@@ -1014,6 +1021,7 @@ var setIsSigning = (v) => $ui.setKey("isSigning", v);
|
|
|
1014
1021
|
var setIsSigned = (v) => $ui.setKey("isSigned", v);
|
|
1015
1022
|
var setIsSigningLoader = (v) => $ui.setKey("isSigningLoader", v);
|
|
1016
1023
|
var setIsAcceptingTxn = (v) => $ui.setKey("isAcceptingTxn", v);
|
|
1024
|
+
var setIsRejectingTxn = (v) => $ui.setKey("isRejectingTxn", v);
|
|
1017
1025
|
var setAcceptTxnError = (v) => $ui.setKey("acceptTxnError", v);
|
|
1018
1026
|
var setWaitingForSuccessLogInSince = (v) => $ui.setKey("waitingForSuccessLogInSince", v);
|
|
1019
1027
|
var setIsOtpRequired = (v) => $ui.setKey("isOtpRequired", v);
|
|
@@ -1558,13 +1566,27 @@ var toTxnDataParam = (raw) => {
|
|
|
1558
1566
|
if (!raw || typeof raw.slug !== "string") return null;
|
|
1559
1567
|
if (!TXN_DATA_MODES.includes(raw.mode)) return null;
|
|
1560
1568
|
if (!TXN_DATA_STATUSES.includes(raw.status)) return null;
|
|
1561
|
-
|
|
1569
|
+
const param = {
|
|
1562
1570
|
slug: raw.slug,
|
|
1563
1571
|
mode: raw.mode,
|
|
1564
1572
|
status: raw.status,
|
|
1565
1573
|
value: typeof raw.value === "string" ? raw.value : null
|
|
1566
1574
|
};
|
|
1575
|
+
if (Array.isArray(raw.emails)) {
|
|
1576
|
+
param.emails = raw.emails.filter(isTxnDataEmail).map((email) => ({
|
|
1577
|
+
id: email.id,
|
|
1578
|
+
label: typeof email.label === "string" ? email.label : "",
|
|
1579
|
+
email: email.email,
|
|
1580
|
+
isDefault: email.isDefault === true,
|
|
1581
|
+
...typeof email.verified === "boolean" && { verified: email.verified }
|
|
1582
|
+
}));
|
|
1583
|
+
param.selectedEmailId = typeof raw.selectedEmailId === "number" ? raw.selectedEmailId : null;
|
|
1584
|
+
param.emailsMax = typeof raw.emailsMax === "number" ? raw.emailsMax : 0;
|
|
1585
|
+
param.emailsManageUrl = typeof raw.emailsManageUrl === "string" && /^https?:\/\//i.test(raw.emailsManageUrl) ? raw.emailsManageUrl : null;
|
|
1586
|
+
}
|
|
1587
|
+
return param;
|
|
1567
1588
|
};
|
|
1589
|
+
var isTxnDataEmail = (raw) => !!raw && typeof raw.id === "number" && typeof raw.email === "string";
|
|
1568
1590
|
function requestSignin(args) {
|
|
1569
1591
|
const { wsc, token, url, service, apiKey, sessionId } = args;
|
|
1570
1592
|
wsc.emit("user:txns:create", { token, url, service, apiKey, sessionId });
|
|
@@ -1584,6 +1606,7 @@ function acceptTxn(args) {
|
|
|
1584
1606
|
userParams,
|
|
1585
1607
|
grantedParams,
|
|
1586
1608
|
revokedParams,
|
|
1609
|
+
sharedEmailId,
|
|
1587
1610
|
sessionId
|
|
1588
1611
|
} = args;
|
|
1589
1612
|
wsc.emit("provider:signin", {
|
|
@@ -1594,6 +1617,7 @@ function acceptTxn(args) {
|
|
|
1594
1617
|
userParams: userParams ?? {},
|
|
1595
1618
|
grantedParams: grantedParams ?? [],
|
|
1596
1619
|
revokedParams: revokedParams ?? [],
|
|
1620
|
+
sharedEmailId,
|
|
1597
1621
|
sessionId
|
|
1598
1622
|
});
|
|
1599
1623
|
}
|
|
@@ -2080,21 +2104,147 @@ function connectBlockAuth(apiUrl) {
|
|
|
2080
2104
|
requestExtensionStateSync();
|
|
2081
2105
|
}
|
|
2082
2106
|
|
|
2083
|
-
// src/auth/
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2107
|
+
// src/auth/popupSize.ts
|
|
2108
|
+
var LOGIN_POPUP_WIDTH = 380;
|
|
2109
|
+
var LOGIN_POPUP_HEIGHT = 640;
|
|
2110
|
+
|
|
2111
|
+
// src/auth/loginWithPopup.ts
|
|
2112
|
+
var AUTH_CODE_MESSAGE = "blockauth:auth-code";
|
|
2113
|
+
var POPUP_CLOSED_POLL_MS = 500;
|
|
2114
|
+
var LOGIN_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
2115
|
+
function base64url(bytes) {
|
|
2116
|
+
let binary = "";
|
|
2117
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
2118
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
2119
|
+
}
|
|
2120
|
+
function randomString(byteLength) {
|
|
2121
|
+
return base64url(crypto.getRandomValues(new Uint8Array(byteLength)));
|
|
2122
|
+
}
|
|
2123
|
+
async function sha256Base64url(value) {
|
|
2124
|
+
const digest = await crypto.subtle.digest(
|
|
2125
|
+
"SHA-256",
|
|
2126
|
+
new TextEncoder().encode(value)
|
|
2127
|
+
);
|
|
2128
|
+
return base64url(new Uint8Array(digest));
|
|
2129
|
+
}
|
|
2130
|
+
async function postWsServer(path, body, wsUrl) {
|
|
2131
|
+
const response = await fetch(buildWsServerApiUrl(path, wsUrl), {
|
|
2132
|
+
method: "POST",
|
|
2133
|
+
headers: { "Content-Type": "application/json" },
|
|
2134
|
+
body: JSON.stringify(body)
|
|
2135
|
+
});
|
|
2136
|
+
const payload = await response.json();
|
|
2137
|
+
if (!response.ok || !payload?.success) {
|
|
2138
|
+
const reason = typeof payload?.message === "string" ? payload.message : "Login failed";
|
|
2139
|
+
throw new Error(reason);
|
|
2140
|
+
}
|
|
2141
|
+
return payload.message;
|
|
2142
|
+
}
|
|
2143
|
+
function waitForCode(popup, authOrigin, state) {
|
|
2144
|
+
return new Promise((resolve, reject) => {
|
|
2087
2145
|
let done = false;
|
|
2088
|
-
const finish = () => {
|
|
2089
|
-
if (
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2146
|
+
const finish = (error, code) => {
|
|
2147
|
+
if (done) return;
|
|
2148
|
+
done = true;
|
|
2149
|
+
window.removeEventListener("message", onMessage);
|
|
2150
|
+
clearInterval(closedPoll);
|
|
2151
|
+
clearTimeout(timeout);
|
|
2152
|
+
if (error) reject(error);
|
|
2153
|
+
else resolve(code);
|
|
2154
|
+
};
|
|
2155
|
+
const onMessage = (event) => {
|
|
2156
|
+
if (event.origin !== authOrigin || event.source !== popup) return;
|
|
2157
|
+
const data = event.data;
|
|
2158
|
+
if (data?.type !== AUTH_CODE_MESSAGE || data.state !== state) return;
|
|
2159
|
+
if (data.code) finish(null, data.code);
|
|
2093
2160
|
};
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2161
|
+
window.addEventListener("message", onMessage);
|
|
2162
|
+
const closedPoll = setInterval(() => {
|
|
2163
|
+
if (!popup.closed) return;
|
|
2164
|
+
setTimeout(
|
|
2165
|
+
() => finish(new Error("Login window closed")),
|
|
2166
|
+
POPUP_CLOSED_POLL_MS
|
|
2167
|
+
);
|
|
2168
|
+
}, POPUP_CLOSED_POLL_MS);
|
|
2169
|
+
const timeout = setTimeout(
|
|
2170
|
+
() => finish(new Error("Login timed out")),
|
|
2171
|
+
LOGIN_TIMEOUT_MS
|
|
2172
|
+
);
|
|
2097
2173
|
});
|
|
2174
|
+
}
|
|
2175
|
+
function popupFeatures() {
|
|
2176
|
+
const left = Math.max(
|
|
2177
|
+
0,
|
|
2178
|
+
Math.round(window.screenX + (window.outerWidth - LOGIN_POPUP_WIDTH) / 2)
|
|
2179
|
+
);
|
|
2180
|
+
const top = Math.max(
|
|
2181
|
+
0,
|
|
2182
|
+
Math.round(window.screenY + (window.outerHeight - LOGIN_POPUP_HEIGHT) / 2)
|
|
2183
|
+
);
|
|
2184
|
+
return `popup,width=${LOGIN_POPUP_WIDTH},height=${LOGIN_POPUP_HEIGHT},left=${left},top=${top}`;
|
|
2185
|
+
}
|
|
2186
|
+
async function runAuthorize(options) {
|
|
2187
|
+
const popup = window.open("about:blank", "blockauth-login", popupFeatures());
|
|
2188
|
+
if (!popup) throw new Error("Login popup blocked");
|
|
2189
|
+
const redirectUri = `${window.location.origin}/`;
|
|
2190
|
+
try {
|
|
2191
|
+
const codeVerifier = randomString(32);
|
|
2192
|
+
const state = randomString(16);
|
|
2193
|
+
const codeChallenge = await sha256Base64url(codeVerifier);
|
|
2194
|
+
const { url } = await postWsServer(
|
|
2195
|
+
"/auth/authorize",
|
|
2196
|
+
{ apiKey: options.apiKey, redirectUri, state, codeChallenge },
|
|
2197
|
+
options.wsUrl
|
|
2198
|
+
);
|
|
2199
|
+
popup.location.href = url;
|
|
2200
|
+
const code = await waitForCode(popup, new URL(url).origin, state);
|
|
2201
|
+
return { code, codeVerifier, redirectUri };
|
|
2202
|
+
} catch (error) {
|
|
2203
|
+
popup.close();
|
|
2204
|
+
throw error;
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
var inFlight = null;
|
|
2208
|
+
var loginInFlight = null;
|
|
2209
|
+
function authorizeWithPopup(options) {
|
|
2210
|
+
inFlight ?? (inFlight = runAuthorize(options).finally(() => {
|
|
2211
|
+
inFlight = null;
|
|
2212
|
+
}));
|
|
2213
|
+
return inFlight;
|
|
2214
|
+
}
|
|
2215
|
+
function loginWithPopup(options) {
|
|
2216
|
+
loginInFlight ?? (loginInFlight = authorizeWithPopup(options).then(
|
|
2217
|
+
({ code, codeVerifier, redirectUri }) => postWsServer(
|
|
2218
|
+
"/auth/token",
|
|
2219
|
+
{ apiKey: options.apiKey, code, redirectUri, codeVerifier },
|
|
2220
|
+
options.wsUrl
|
|
2221
|
+
)
|
|
2222
|
+
).finally(() => {
|
|
2223
|
+
loginInFlight = null;
|
|
2224
|
+
}));
|
|
2225
|
+
return loginInFlight;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
// src/auth/logout.ts
|
|
2229
|
+
async function performLogout(args) {
|
|
2230
|
+
const { wsc, token, apiKey, sessionId, apiUrl } = args;
|
|
2231
|
+
if (apiUrl) {
|
|
2232
|
+
await new Promise((resolve) => {
|
|
2233
|
+
let done = false;
|
|
2234
|
+
const finish = () => {
|
|
2235
|
+
if (!done) {
|
|
2236
|
+
done = true;
|
|
2237
|
+
resolve();
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
wsc.ws?.once?.("signout", finish);
|
|
2241
|
+
wsc.emit("signout", { token, apiKey, sessionId });
|
|
2242
|
+
setTimeout(finish, 1500);
|
|
2243
|
+
});
|
|
2244
|
+
} else {
|
|
2245
|
+
resetUser();
|
|
2246
|
+
browserBase.reset("session");
|
|
2247
|
+
}
|
|
2098
2248
|
if (typeof localStorage !== "undefined") {
|
|
2099
2249
|
localStorage.setItem("blockauth-logged-out", "true");
|
|
2100
2250
|
}
|
|
@@ -2329,6 +2479,19 @@ async function signInWithMicrosoft(overrides = {}) {
|
|
|
2329
2479
|
setServiceIcon(imgUrlByService("microsoft"));
|
|
2330
2480
|
return { accessToken: response.accessToken, response };
|
|
2331
2481
|
}
|
|
2482
|
+
function rememberHostedLogin(result) {
|
|
2483
|
+
const did = result.did ?? result.address;
|
|
2484
|
+
browserBase.setSession({ did, serviceName: "blockauth" });
|
|
2485
|
+
setUser({
|
|
2486
|
+
address: result.address,
|
|
2487
|
+
did,
|
|
2488
|
+
roles: result.roles ?? []
|
|
2489
|
+
});
|
|
2490
|
+
setServiceName("blockauth");
|
|
2491
|
+
setIsServiceConnected(true);
|
|
2492
|
+
setIsSigned(true);
|
|
2493
|
+
setIsSignedFirstCheck(true);
|
|
2494
|
+
}
|
|
2332
2495
|
function createBlockAuthClient(config3) {
|
|
2333
2496
|
if (config3.locale) setLocale(config3.locale);
|
|
2334
2497
|
const provider = new BlockAuthProvider(
|
|
@@ -2373,13 +2536,15 @@ function createBlockAuthClient(config3) {
|
|
|
2373
2536
|
const ext = browserBase.getExternalService();
|
|
2374
2537
|
return ext.service !== "blockauth" ? ext.token ?? "" : s.token ?? "";
|
|
2375
2538
|
}
|
|
2539
|
+
let runtimeBridge = null;
|
|
2376
2540
|
return {
|
|
2377
2541
|
state: {
|
|
2378
2542
|
$ws,
|
|
2379
2543
|
$ui,
|
|
2380
2544
|
$wallet,
|
|
2381
2545
|
$openModals,
|
|
2382
|
-
$user
|
|
2546
|
+
$user,
|
|
2547
|
+
$extension
|
|
2383
2548
|
},
|
|
2384
2549
|
/** App apiKey from client config (also seeded into $ws). */
|
|
2385
2550
|
apiKey: config3.apiKey,
|
|
@@ -2406,6 +2571,23 @@ function createBlockAuthClient(config3) {
|
|
|
2406
2571
|
// BlockAuth extension connect (sets blockauth as the active service);
|
|
2407
2572
|
// the txn-signing flow is driven by the caller via requestSignin.
|
|
2408
2573
|
connectBlockAuth: () => connectBlockAuth(config3.apiUrl),
|
|
2574
|
+
// Login for an app without a backend: hosted login in a popup, PKCE
|
|
2575
|
+
// instead of the apiSecret (see auth/loginWithPopup.ts). Call it from a
|
|
2576
|
+
// click handler.
|
|
2577
|
+
loginWithPopup: async () => {
|
|
2578
|
+
const result = await loginWithPopup({
|
|
2579
|
+
apiKey: config3.apiKey,
|
|
2580
|
+
wsUrl: config3.wsUrl
|
|
2581
|
+
});
|
|
2582
|
+
rememberHostedLogin(result);
|
|
2583
|
+
return result;
|
|
2584
|
+
},
|
|
2585
|
+
// Same popup, but the code goes to the app's backend, which redeems it
|
|
2586
|
+
// with its apiSecret (see PopupAuthCode). Call it from a click handler.
|
|
2587
|
+
authorizeWithPopup: () => authorizeWithPopup({ apiKey: config3.apiKey, wsUrl: config3.wsUrl }),
|
|
2588
|
+
// After the backend redeemed the code: shows the user in the page's UI
|
|
2589
|
+
// (profile dropdown, roles). The backend's answer is the source of truth.
|
|
2590
|
+
rememberHostedLogin: (user) => rememberHostedLogin(user),
|
|
2409
2591
|
// oauth
|
|
2410
2592
|
oauth: {
|
|
2411
2593
|
...oauth_exports,
|
|
@@ -2446,10 +2628,13 @@ function createBlockAuthClient(config3) {
|
|
|
2446
2628
|
}),
|
|
2447
2629
|
// transaction accept/reject
|
|
2448
2630
|
txns: {
|
|
2449
|
-
reject: () =>
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2631
|
+
reject: () => {
|
|
2632
|
+
setIsRejectingTxn(true);
|
|
2633
|
+
rejectTxn({
|
|
2634
|
+
wsc: provider.wsc,
|
|
2635
|
+
token: userToken()
|
|
2636
|
+
});
|
|
2637
|
+
},
|
|
2453
2638
|
accept: (opts) => acceptTxn({
|
|
2454
2639
|
wsc: provider.wsc,
|
|
2455
2640
|
token: userToken(),
|
|
@@ -2458,6 +2643,7 @@ function createBlockAuthClient(config3) {
|
|
|
2458
2643
|
userParams: opts.userParams,
|
|
2459
2644
|
grantedParams: opts.grantedParams,
|
|
2460
2645
|
revokedParams: opts.revokedParams,
|
|
2646
|
+
sharedEmailId: opts.sharedEmailId,
|
|
2461
2647
|
sessionId: browserBase.getDeviceSessionId()
|
|
2462
2648
|
}),
|
|
2463
2649
|
dataRequest: (txnId) => requestTxnData({
|
|
@@ -2489,6 +2675,10 @@ function createBlockAuthClient(config3) {
|
|
|
2489
2675
|
openModal,
|
|
2490
2676
|
closeModal,
|
|
2491
2677
|
closeAllModals,
|
|
2678
|
+
registerRuntime: (bridge) => {
|
|
2679
|
+
runtimeBridge = bridge;
|
|
2680
|
+
},
|
|
2681
|
+
switchAccount: () => runtimeBridge?.switchAccount() ?? Promise.resolve(),
|
|
2492
2682
|
// opciones del connect inicial del WS (las consume createAuthRuntime)
|
|
2493
2683
|
wsConnectTimeout: config3.wsConnectTimeout ?? 300,
|
|
2494
2684
|
wsConnectRetries: config3.wsConnectRetries ?? 3,
|
|
@@ -2739,6 +2929,21 @@ var EMPTY_SOLICITED_DATA_FORM = {
|
|
|
2739
2929
|
shared: {},
|
|
2740
2930
|
saved: {}
|
|
2741
2931
|
};
|
|
2932
|
+
var EMAIL_SLUG = "users-email";
|
|
2933
|
+
var isSolicitedEmailSelectable = (email) => email.verified !== false;
|
|
2934
|
+
function emailChoiceOf(item, form) {
|
|
2935
|
+
if (item.slug !== EMAIL_SLUG || !item.emails) return void 0;
|
|
2936
|
+
if (form.emailChoice !== void 0) return form.emailChoice;
|
|
2937
|
+
const selectable = item.emails.filter(isSolicitedEmailSelectable);
|
|
2938
|
+
const selected = selectable.find(
|
|
2939
|
+
(email) => email.id === item.selectedEmailId
|
|
2940
|
+
);
|
|
2941
|
+
return selected?.id ?? selectable.find((email) => email.isDefault)?.id ?? selectable[0]?.id ?? null;
|
|
2942
|
+
}
|
|
2943
|
+
var formatSolicitedEmailOption = (email, unverifiedText = "") => {
|
|
2944
|
+
const text = email.label ? `${email.label} \xB7 ${email.email}` : email.email;
|
|
2945
|
+
return email.verified === false && unverifiedText ? `${text} (${unverifiedText})` : text;
|
|
2946
|
+
};
|
|
2742
2947
|
var omitKey = (record, key) => Object.fromEntries(
|
|
2743
2948
|
Object.entries(record).filter(([entryKey]) => entryKey !== key)
|
|
2744
2949
|
);
|
|
@@ -2774,14 +2979,18 @@ function getSolicitedParams({
|
|
|
2774
2979
|
}
|
|
2775
2980
|
function getSolicitedFields(items, form = EMPTY_SOLICITED_DATA_FORM, withConsent = true) {
|
|
2776
2981
|
return items.map((item) => {
|
|
2777
|
-
const
|
|
2778
|
-
const
|
|
2982
|
+
const emailChoice = emailChoiceOf(item, form);
|
|
2983
|
+
const chosenEmail = typeof emailChoice === "number" ? item.emails?.find((email) => email.id === emailChoice)?.email : void 0;
|
|
2984
|
+
const emailFields = emailChoice !== void 0 ? { emailChoice } : {};
|
|
2985
|
+
const profileValue = chosenEmail ?? (emailChoice === null ? "" : item.value ?? "");
|
|
2986
|
+
const inputValue = chosenEmail ?? form.values[item.slug] ?? profileValue;
|
|
2779
2987
|
const trimmed = inputValue.trim();
|
|
2780
2988
|
const isEmpty = !trimmed;
|
|
2781
2989
|
const isValid = isValidParamValue(item.slug, inputValue);
|
|
2782
2990
|
if (!withConsent) {
|
|
2783
2991
|
return {
|
|
2784
2992
|
...item,
|
|
2993
|
+
...emailFields,
|
|
2785
2994
|
profileValue,
|
|
2786
2995
|
inputValue,
|
|
2787
2996
|
isEmpty,
|
|
@@ -2799,6 +3008,7 @@ function getSolicitedFields(items, form = EMPTY_SOLICITED_DATA_FORM, withConsent
|
|
|
2799
3008
|
const isComplete = isShared ? isValid && (!isChanged || isSaved) : item.mode !== "required";
|
|
2800
3009
|
return {
|
|
2801
3010
|
...item,
|
|
3011
|
+
...emailFields,
|
|
2802
3012
|
profileValue,
|
|
2803
3013
|
inputValue,
|
|
2804
3014
|
isEmpty,
|
|
@@ -2821,6 +3031,7 @@ function getSolicitedAcceptParams(fields) {
|
|
|
2821
3031
|
const userParams = {};
|
|
2822
3032
|
const grantedParams = [];
|
|
2823
3033
|
const revokedParams = [];
|
|
3034
|
+
const email = {};
|
|
2824
3035
|
fields.forEach((field) => {
|
|
2825
3036
|
if (!field.isShared) {
|
|
2826
3037
|
if ((field.status === "granted" || field.status === "shared") && field.mode === "optional")
|
|
@@ -2829,17 +3040,20 @@ function getSolicitedAcceptParams(fields) {
|
|
|
2829
3040
|
}
|
|
2830
3041
|
if (!field.isValid) return;
|
|
2831
3042
|
if (field.isChanged) {
|
|
2832
|
-
if (field.isSaved)
|
|
3043
|
+
if (field.isSaved) {
|
|
2833
3044
|
userParams[field.slug] = normalizeParamValue(
|
|
2834
3045
|
field.slug,
|
|
2835
3046
|
field.inputValue
|
|
2836
3047
|
);
|
|
3048
|
+
}
|
|
2837
3049
|
return;
|
|
2838
3050
|
}
|
|
3051
|
+
if (typeof field.emailChoice === "number")
|
|
3052
|
+
email.sharedEmailId = field.emailChoice;
|
|
2839
3053
|
if (field.status === "consent" || field.status === "granted")
|
|
2840
3054
|
grantedParams.push(field.slug);
|
|
2841
3055
|
});
|
|
2842
|
-
return { userParams, grantedParams, revokedParams };
|
|
3056
|
+
return { userParams, grantedParams, revokedParams, ...email };
|
|
2843
3057
|
}
|
|
2844
3058
|
var setSolicitedValue = (form, item, value) => ({
|
|
2845
3059
|
...form,
|
|
@@ -2858,10 +3072,99 @@ var saveSolicitedValue = (form, slug) => {
|
|
|
2858
3072
|
};
|
|
2859
3073
|
};
|
|
2860
3074
|
var undoSolicitedValue = (form, item) => ({
|
|
3075
|
+
...form,
|
|
2861
3076
|
values: omitKey(form.values, item.slug),
|
|
2862
3077
|
saved: omitKey(form.saved, item.slug),
|
|
2863
3078
|
shared: (item.value ?? "").trim() ? form.shared : omitKey(form.shared, item.slug)
|
|
2864
3079
|
});
|
|
3080
|
+
var setSolicitedEmailChoice = (form, emailChoice) => ({
|
|
3081
|
+
...form,
|
|
3082
|
+
emailChoice,
|
|
3083
|
+
values: omitKey(form.values, EMAIL_SLUG),
|
|
3084
|
+
saved: omitKey(form.saved, EMAIL_SLUG),
|
|
3085
|
+
shared: omitKey(form.shared, EMAIL_SLUG)
|
|
3086
|
+
});
|
|
3087
|
+
|
|
3088
|
+
// src/auth/redirectPopup.ts
|
|
3089
|
+
var AUTH_CODE_MESSAGE2 = "blockauth:auth-code";
|
|
3090
|
+
function centeredPopupFeatures(width, height) {
|
|
3091
|
+
const base = `popup,width=${width},height=${height}`;
|
|
3092
|
+
if (typeof window === "undefined") return base;
|
|
3093
|
+
const screenLeft = window.screenLeft ?? window.screenX ?? 0;
|
|
3094
|
+
const screenTop = window.screenTop ?? window.screenY ?? 0;
|
|
3095
|
+
const viewportWidth = window.innerWidth || document.documentElement?.clientWidth || window.screen?.width || width;
|
|
3096
|
+
const viewportHeight = window.innerHeight || document.documentElement?.clientHeight || window.screen?.height || height;
|
|
3097
|
+
const left = Math.max(
|
|
3098
|
+
0,
|
|
3099
|
+
Math.round(screenLeft + (viewportWidth - width) / 2)
|
|
3100
|
+
);
|
|
3101
|
+
const top = Math.max(
|
|
3102
|
+
0,
|
|
3103
|
+
Math.round(screenTop + (viewportHeight - height) / 2)
|
|
3104
|
+
);
|
|
3105
|
+
return `${base},left=${left},top=${top}`;
|
|
3106
|
+
}
|
|
3107
|
+
function openLoginPopup({
|
|
3108
|
+
url,
|
|
3109
|
+
expectedOrigin,
|
|
3110
|
+
timeoutMs = 3e5,
|
|
3111
|
+
windowName = "blockauth-login",
|
|
3112
|
+
windowFeatures,
|
|
3113
|
+
width = LOGIN_POPUP_WIDTH,
|
|
3114
|
+
height = LOGIN_POPUP_HEIGHT
|
|
3115
|
+
}) {
|
|
3116
|
+
return new Promise((resolve, reject) => {
|
|
3117
|
+
if (typeof window === "undefined" || typeof window.open !== "function") {
|
|
3118
|
+
reject(new Error("Popup login is only available in a browser"));
|
|
3119
|
+
return;
|
|
3120
|
+
}
|
|
3121
|
+
const features = windowFeatures ?? centeredPopupFeatures(width, height);
|
|
3122
|
+
const popup = window.open(url, windowName, features);
|
|
3123
|
+
if (!popup) {
|
|
3124
|
+
reject(new Error("Popup blocked"));
|
|
3125
|
+
return;
|
|
3126
|
+
}
|
|
3127
|
+
let settled = false;
|
|
3128
|
+
let closedTimer = null;
|
|
3129
|
+
let timeoutTimer = null;
|
|
3130
|
+
const cleanup = () => {
|
|
3131
|
+
window.removeEventListener("message", onMessage);
|
|
3132
|
+
if (closedTimer !== null) clearInterval(closedTimer);
|
|
3133
|
+
if (timeoutTimer !== null) clearTimeout(timeoutTimer);
|
|
3134
|
+
};
|
|
3135
|
+
const finish = (action) => {
|
|
3136
|
+
if (settled) return;
|
|
3137
|
+
settled = true;
|
|
3138
|
+
cleanup();
|
|
3139
|
+
action();
|
|
3140
|
+
};
|
|
3141
|
+
const onMessage = (event) => {
|
|
3142
|
+
if (event.origin !== expectedOrigin) return;
|
|
3143
|
+
if (event.source !== popup) return;
|
|
3144
|
+
const data = event.data;
|
|
3145
|
+
if (!data || data.type !== AUTH_CODE_MESSAGE2) return;
|
|
3146
|
+
if (typeof data.code !== "string" || typeof data.state !== "string") {
|
|
3147
|
+
finish(() => reject(new Error("Malformed auth code message")));
|
|
3148
|
+
return;
|
|
3149
|
+
}
|
|
3150
|
+
finish(
|
|
3151
|
+
() => resolve({ code: data.code, state: data.state })
|
|
3152
|
+
);
|
|
3153
|
+
};
|
|
3154
|
+
window.addEventListener("message", onMessage);
|
|
3155
|
+
closedTimer = setInterval(() => {
|
|
3156
|
+
if (popup.closed) {
|
|
3157
|
+
finish(() => reject(new Error("Login popup closed")));
|
|
3158
|
+
}
|
|
3159
|
+
}, 500);
|
|
3160
|
+
timeoutTimer = setTimeout(() => {
|
|
3161
|
+
finish(() => {
|
|
3162
|
+
if (!popup.closed) popup.close();
|
|
3163
|
+
reject(new Error("Login popup timed out"));
|
|
3164
|
+
});
|
|
3165
|
+
}, timeoutMs);
|
|
3166
|
+
});
|
|
3167
|
+
}
|
|
2865
3168
|
|
|
2866
3169
|
// src/session/sessionExpired.ts
|
|
2867
3170
|
var USER_SESSION_REQUIRED = "USER_SESSION_REQUIRED";
|
|
@@ -2909,8 +3212,8 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
2909
3212
|
let unsignTimeout = null;
|
|
2910
3213
|
let signinTimeout = null;
|
|
2911
3214
|
const wsc = () => provider.wsc;
|
|
2912
|
-
const emitSdkSign = (token, address) => {
|
|
2913
|
-
wsc().emit("sdk:sign", { token, address });
|
|
3215
|
+
const emitSdkSign = (token, address, afterSign = false) => {
|
|
3216
|
+
wsc().emit("sdk:sign", { token, address, afterSign });
|
|
2914
3217
|
};
|
|
2915
3218
|
const ownTxnItems = (items) => {
|
|
2916
3219
|
const apiKey = client.apiKey;
|
|
@@ -2945,6 +3248,8 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
2945
3248
|
});
|
|
2946
3249
|
const onLogout = callbacks.onLogout ?? (async () => {
|
|
2947
3250
|
});
|
|
3251
|
+
const onCancel = callbacks.onCancel ?? (async () => {
|
|
3252
|
+
});
|
|
2948
3253
|
const _onSuccess = async (address) => {
|
|
2949
3254
|
deletion.resetHandlingState();
|
|
2950
3255
|
await onSuccess(address);
|
|
@@ -3282,7 +3587,10 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3282
3587
|
hookState.pendingSignin = null;
|
|
3283
3588
|
hookState.pendingTxnId = null;
|
|
3284
3589
|
hookState.settledAttemptId = hookState.signinAttemptId;
|
|
3285
|
-
if (!hookState.isSigned)
|
|
3590
|
+
if (!hookState.isSigned) {
|
|
3591
|
+
closeAllModals();
|
|
3592
|
+
void onCancel();
|
|
3593
|
+
}
|
|
3286
3594
|
return;
|
|
3287
3595
|
}
|
|
3288
3596
|
if (hookState.settledAttemptId === hookState.signinAttemptId) {
|
|
@@ -3293,18 +3601,24 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3293
3601
|
hookState.pendingSignin = null;
|
|
3294
3602
|
const willVerifySign = outcome === "resolved" && !hookState.isSigned && !!pendingSignin;
|
|
3295
3603
|
if (willVerifySign) {
|
|
3296
|
-
emitSdkSign(pendingSignin.accessToken, pendingSignin.did);
|
|
3604
|
+
emitSdkSign(pendingSignin.accessToken, pendingSignin.did, true);
|
|
3297
3605
|
} else if (!hookState.isSigned) {
|
|
3298
3606
|
closeAllModals();
|
|
3299
3607
|
}
|
|
3300
3608
|
};
|
|
3609
|
+
const consumePendingReject = () => {
|
|
3610
|
+
if (!$ui.get().isRejectingTxn) return false;
|
|
3611
|
+
setIsRejectingTxn(false);
|
|
3612
|
+
settleSigningAttempt("cancelled");
|
|
3613
|
+
return true;
|
|
3614
|
+
};
|
|
3301
3615
|
const onUserTxns = async (data) => {
|
|
3302
3616
|
const { success, message } = data;
|
|
3303
3617
|
if (!success) return;
|
|
3304
3618
|
const items = ownTxnItems(message.items ?? []);
|
|
3305
3619
|
captureOwnTxnId(items);
|
|
3306
3620
|
const hasInitialTxns = items.some((item) => item.state === "initial");
|
|
3307
|
-
if (!hasInitialTxns) {
|
|
3621
|
+
if (!hasInitialTxns && !consumePendingReject()) {
|
|
3308
3622
|
settleSigningAttempt("resolved");
|
|
3309
3623
|
}
|
|
3310
3624
|
setRequests(items);
|
|
@@ -3315,7 +3629,7 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3315
3629
|
const items = ownTxnItems(message.items ?? []);
|
|
3316
3630
|
captureOwnTxnId(items);
|
|
3317
3631
|
const hasInitialTxns = items.some((item) => item.state === "initial");
|
|
3318
|
-
if (!hasInitialTxns) {
|
|
3632
|
+
if (!hasInitialTxns && !consumePendingReject()) {
|
|
3319
3633
|
const txnId = hookState.pendingTxnId;
|
|
3320
3634
|
const wasCancelled = txnId != null && !items.some((item) => item.id === txnId);
|
|
3321
3635
|
settleSigningAttempt(
|
|
@@ -3327,6 +3641,7 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3327
3641
|
const onUserTxnsCreate = async (data) => {
|
|
3328
3642
|
const { success, message } = data;
|
|
3329
3643
|
if (success) {
|
|
3644
|
+
setIsRejectingTxn(false);
|
|
3330
3645
|
setIsSigning(true);
|
|
3331
3646
|
hookState.isSigning = true;
|
|
3332
3647
|
const attemptId = ++hookState.signinAttemptId;
|
|
@@ -3375,6 +3690,7 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3375
3690
|
setToken(_token);
|
|
3376
3691
|
setIsSigned(success);
|
|
3377
3692
|
hookState.isSigned = success;
|
|
3693
|
+
if (success) setIsAcceptingTxn(false);
|
|
3378
3694
|
if (success) clearSessionExpiredMark();
|
|
3379
3695
|
if (success && hookState.isUnsignTimeoutSet && message?.signedExpiredAt) {
|
|
3380
3696
|
rearmUnsignTimeout(message.signedExpiredAt, _did);
|
|
@@ -3543,10 +3859,10 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3543
3859
|
_token = externalService.token;
|
|
3544
3860
|
_did = externalService.did;
|
|
3545
3861
|
}
|
|
3546
|
-
setDid(_did);
|
|
3547
|
-
setToken(_token);
|
|
3548
|
-
setApiKey(client.apiKey ?? $ws.get().apiKey);
|
|
3549
3862
|
const isLoggedOut = typeof localStorage !== "undefined" && localStorage.getItem("blockauth-logged-out") === "true";
|
|
3863
|
+
setDid(isLoggedOut ? null : _did);
|
|
3864
|
+
setToken(isLoggedOut ? "" : _token);
|
|
3865
|
+
setApiKey(client.apiKey ?? $ws.get().apiKey);
|
|
3550
3866
|
setIsServiceConnected(isLoggedOut ? false : externalService.connected);
|
|
3551
3867
|
setServiceName(externalService.service);
|
|
3552
3868
|
setServiceIcon(imgUrlByService(externalService.service));
|
|
@@ -3660,7 +3976,46 @@ function createAuthRuntime(client, callbacks = {}) {
|
|
|
3660
3976
|
const logout = async () => {
|
|
3661
3977
|
await _onLogout();
|
|
3662
3978
|
};
|
|
3663
|
-
|
|
3979
|
+
const switchAccount = async () => {
|
|
3980
|
+
if (hookState.isLoggingOut) return;
|
|
3981
|
+
if (unsignTimeout) {
|
|
3982
|
+
clearTimeout(unsignTimeout);
|
|
3983
|
+
unsignTimeout = null;
|
|
3984
|
+
}
|
|
3985
|
+
if (signinTimeout) {
|
|
3986
|
+
clearTimeout(signinTimeout);
|
|
3987
|
+
signinTimeout = null;
|
|
3988
|
+
}
|
|
3989
|
+
if (getUserTxnsInterval) {
|
|
3990
|
+
clearInterval(getUserTxnsInterval);
|
|
3991
|
+
getUserTxnsInterval = null;
|
|
3992
|
+
}
|
|
3993
|
+
hookState.isUnsignTimeoutSet = false;
|
|
3994
|
+
hookState.isSigning = false;
|
|
3995
|
+
hookState.pendingSignin = null;
|
|
3996
|
+
hookState.pendingTxnId = null;
|
|
3997
|
+
hookState.settledAttemptId = hookState.signinAttemptId;
|
|
3998
|
+
setIsSigning(false);
|
|
3999
|
+
setIsSigningLoader(false);
|
|
4000
|
+
setIsAcceptingTxn(false);
|
|
4001
|
+
setIsOtpRequired(false);
|
|
4002
|
+
setWaitingForSuccessLogInSince(0);
|
|
4003
|
+
closeAllModals();
|
|
4004
|
+
openModal("signup");
|
|
4005
|
+
const s = browserBase.getSession();
|
|
4006
|
+
const ext = browserBase.getExternalService();
|
|
4007
|
+
const token = ext.service !== "blockauth" ? ext.token : s.token;
|
|
4008
|
+
const apiKey = $ws.get().apiKey ?? client.apiKey;
|
|
4009
|
+
const sessionId = browserBase.getDeviceSessionId();
|
|
4010
|
+
await performLogout({
|
|
4011
|
+
wsc: wsc(),
|
|
4012
|
+
token: token ?? "",
|
|
4013
|
+
apiKey,
|
|
4014
|
+
sessionId,
|
|
4015
|
+
apiUrl: client.apiUrl
|
|
4016
|
+
});
|
|
4017
|
+
};
|
|
4018
|
+
return { start, stop, logout, switchAccount };
|
|
3664
4019
|
}
|
|
3665
4020
|
function deepLinkFor(service, domain) {
|
|
3666
4021
|
switch (service) {
|
|
@@ -3735,6 +4090,7 @@ var TEXTS = {
|
|
|
3735
4090
|
solicitedData: { es: "Datos solicitados", en: "Solicited data" },
|
|
3736
4091
|
reject: { es: "RECHAZAR", en: "REJECT" },
|
|
3737
4092
|
accept: { es: "ACEPTAR", en: "ACCEPT" },
|
|
4093
|
+
useAnotherAccount: { es: "Usar otra cuenta", en: "Use another account" },
|
|
3738
4094
|
iAuthorizeThe: { es: "Autorizo la", en: "I authorize the" },
|
|
3739
4095
|
privacyPolicy: { es: "Pol\xEDtica de Privacidad", en: "Privacy Policy" },
|
|
3740
4096
|
andThe: { es: "y los", en: "and the" },
|
|
@@ -3763,6 +4119,15 @@ var TEXTS = {
|
|
|
3763
4119
|
},
|
|
3764
4120
|
shareData: { es: "Ceder", en: "Share" },
|
|
3765
4121
|
saveData: { es: "Guardar", en: "Save" },
|
|
4122
|
+
emailUnverified: { es: "no verificado", en: "not verified" },
|
|
4123
|
+
emailNoneVerified: {
|
|
4124
|
+
es: "Ning\xFAn correo verificado",
|
|
4125
|
+
en: "No verified email"
|
|
4126
|
+
},
|
|
4127
|
+
emailsManage: {
|
|
4128
|
+
es: "A\xF1adir o gestionar correos en Identity",
|
|
4129
|
+
en: "Add or manage emails in Identity"
|
|
4130
|
+
},
|
|
3766
4131
|
undoChange: { es: "Deshacer", en: "Undo" },
|
|
3767
4132
|
savedToProfileHint: {
|
|
3768
4133
|
es: "Se guardar\xE1 en tu perfil al aceptar",
|
|
@@ -3778,6 +4143,7 @@ var TEXTS = {
|
|
|
3778
4143
|
},
|
|
3779
4144
|
clearField: { es: "Limpiar campo", en: "Clear field" },
|
|
3780
4145
|
acceptData: { es: "Aceptar", en: "Accept" },
|
|
4146
|
+
cancelData: { es: "Cancelar", en: "Cancel" },
|
|
3781
4147
|
noTransactionsFound: {
|
|
3782
4148
|
es: "No se encontraron transacciones",
|
|
3783
4149
|
en: "No transactions found"
|
|
@@ -3838,7 +4204,10 @@ var TEXTS = {
|
|
|
3838
4204
|
en: "Enter a valid phone number"
|
|
3839
4205
|
},
|
|
3840
4206
|
phoneCountry: { es: "Pa\xEDs", en: "Country" },
|
|
3841
|
-
searchPhoneCountry: {
|
|
4207
|
+
searchPhoneCountry: {
|
|
4208
|
+
es: "Buscar pa\xEDs o prefijo",
|
|
4209
|
+
en: "Search country or code"
|
|
4210
|
+
},
|
|
3842
4211
|
noPhoneCountryResults: {
|
|
3843
4212
|
es: "No hay pa\xEDses que coincidan",
|
|
3844
4213
|
en: "No matching countries"
|
|
@@ -3863,6 +4232,6 @@ function t(key, locale = "en") {
|
|
|
3863
4232
|
return entry?.[locale] ?? entry?.en ?? key;
|
|
3864
4233
|
}
|
|
3865
4234
|
|
|
3866
|
-
export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, BlockAuthProvider, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, EMPTY_SOLICITED_DATA_FORM, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, TEXTS, WsClient, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, oauth_exports as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, utils_exports as utils };
|
|
4235
|
+
export { $extension, $locale, $openModals, $ui, $user, $wallet, $web3, $ws, BlockAuthProvider, DEFAULT_PHONE_COUNTRY, DISCOVERY_TIMEOUT_MS, EMPTY_SOLICITED_DATA_FORM, PARAM_DISPLAY_FORMATTERS, PARAM_DISPLAY_ORDER, PARAM_ERROR_KEYS, PARAM_INPUT_TYPE, PARAM_LABEL_KEYS, PARAM_NORMALIZERS, PARAM_VALIDATORS, RpcClient, SDK_PAGE_MARKER, SYNC_TIMEOUT_MS, TEXTS, WsClient, appearsExtensionInstalled, buildPhoneE164, buildPhoneValue, clearExtensionDomMarkers, clearRemainingAuthData, clearSdkPresence, closeAllModals, closeModal, confirmExtensionPresence, createAuthRuntime, createBlockAuthClient, createDeletionService, createEvmWallet, createSolanaWallet, deepLinkFor, discoverExtensionOnce, fetchUserProfile, finalizeAfterRestorationExpired, formatParamValue, formatPhoneForDisplay, formatSolicitedEmailOption, getDefaultPhoneCountry, getExtensionStoreUrl, getPhoneCountries, getPhoneCountryFlag, getPhoneDialCode, getSolicitedAcceptParams, getSolicitedFields, getSolicitedHintKey, getSolicitedParams, getUserRoleNames, getUserRoleSlugs, getUserRoles, handleRestorationExpired, handleRestoreFailure, hasAnyRole, hasAnyRoleBySlug, hasRole, hasRoleBySlug, isExtensionPresent, isExtensionStateComplete, isFirefox, isModalOpen, isPhoneCountry, isRestorationExpiredMessage, isSdkPage, isShowSignin, isSolicitedDataComplete, isSolicitedEmailSelectable, isSolicitedHintSuccess, isValidParamValue, isValidPhoneValue, loadUserProfile, makeQrDataUrl, markSdkPresence, needsExtensionUnlock, normalizeParamValue, oauth_exports as oauth, onExtensionRemoved, onExtensionStatePublished, openExtensionOnTxn, openLoginPopup, openModal, parsePhoneValue, probeExtensionPresence, reconcileExtensionState, requestExtensionRefresh, requestExtensionStateSync, requestSdkRestore, resetExtension, resetExtensionAbsentState, resetExtensionSyncModuleState, resetUi, resetUser, resetWallet, resetWeb3, resetWs, resolvePhoneDraft, saveSolicitedValue, searchPhoneCountries, setAcceptTxnError, setApiKey, setBackendMessage, setDeletionAddress, setDid, setExtensionInstalled, setExtensionIsLocked, setExtensionIsUser, setExtensionIsUserActive, setIsAcceptingTxn, setIsAppActive, setIsCheckingAppActive, setIsLoadingUser, setIsOnDeletion, setIsOtpRequired, setIsRejectingTxn, setIsSdkSignedIn, setIsServiceConnected, setIsSigned, setIsSignedFirstCheck, setIsSigning, setIsSigningLoader, setLocale, setReady, setRequests, setServiceIcon, setServiceName, setSignature, setSignedBy, setSolicitedEmailChoice, setSolicitedShared, setSolicitedValue, setToken, setUiConfig, setUser, setWaitingForSuccessLogInSince, startExtensionSync, syncExtensionStateFromStorage, t, toPhoneE164, undoSolicitedValue, updatePhoneDraft, utils_exports as utils };
|
|
3867
4236
|
//# sourceMappingURL=index.js.map
|
|
3868
4237
|
//# sourceMappingURL=index.js.map
|