@tatchi-xyz/sdk 0.31.0 → 0.31.1
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/cjs/core/IndexedDBManager/passkeyClientDB.js +2 -2
- package/dist/cjs/core/IndexedDBManager/passkeyClientDB.js.map +1 -1
- package/dist/cjs/core/TatchiPasskey/faucets/createAccountRelayServer.js +9 -8
- package/dist/cjs/core/TatchiPasskey/faucets/createAccountRelayServer.js.map +1 -1
- package/dist/cjs/core/TatchiPasskey/login.js +1 -1
- package/dist/cjs/core/TatchiPasskey/login.js.map +1 -1
- package/dist/cjs/core/TatchiPasskey/registration.js +67 -56
- package/dist/cjs/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js +1 -10
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js.map +1 -1
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js +58 -67
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js.map +1 -1
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js +74 -75
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js.map +1 -1
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js +17 -7
- package/dist/cjs/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js.map +1 -1
- package/dist/cjs/core/WebAuthnManager/index.js +3 -3
- package/dist/cjs/core/WebAuthnManager/index.js.map +1 -1
- package/dist/cjs/core/defaultConfigs.js +3 -1
- package/dist/cjs/core/defaultConfigs.js.map +1 -1
- package/dist/cjs/react/components/AccountMenuButton/TransactionSettingsSection.js +3 -3
- package/dist/cjs/react/components/AccountMenuButton/TransactionSettingsSection.js.map +1 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/{PasskeyAuthMenu-CRlobBrN.css → PasskeyAuthMenu-D2eRb2-S.css} +3 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/PasskeyAuthMenu-D2eRb2-S.css.map +1 -0
- package/dist/cjs/react/components/PasskeyAuthMenu/preload.js +1 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/preload.js.map +1 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/shell.js +52 -13
- package/dist/cjs/react/components/PasskeyAuthMenu/shell.js.map +1 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/skeleton.js +4 -2
- package/dist/cjs/react/components/PasskeyAuthMenu/skeleton.js.map +1 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/ui/EmailRecoverySlide.js +5 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/ui/EmailRecoverySlide.js.map +1 -1
- package/dist/cjs/react/index.js +1 -1
- package/dist/cjs/react/src/core/IndexedDBManager/passkeyClientDB.js +2 -2
- package/dist/cjs/react/src/core/IndexedDBManager/passkeyClientDB.js.map +1 -1
- package/dist/cjs/react/src/core/TatchiPasskey/faucets/createAccountRelayServer.js +9 -8
- package/dist/cjs/react/src/core/TatchiPasskey/faucets/createAccountRelayServer.js.map +1 -1
- package/dist/cjs/react/src/core/TatchiPasskey/login.js +1 -1
- package/dist/cjs/react/src/core/TatchiPasskey/login.js.map +1 -1
- package/dist/cjs/react/src/core/TatchiPasskey/registration.js +67 -56
- package/dist/cjs/react/src/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js +1 -10
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js.map +1 -1
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js +58 -67
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js.map +1 -1
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js +74 -75
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js.map +1 -1
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js +17 -7
- package/dist/cjs/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js.map +1 -1
- package/dist/cjs/react/src/core/WebAuthnManager/index.js +3 -3
- package/dist/cjs/react/src/core/WebAuthnManager/index.js.map +1 -1
- package/dist/cjs/react/src/core/defaultConfigs.js +3 -1
- package/dist/cjs/react/src/core/defaultConfigs.js.map +1 -1
- package/dist/cjs/server/core/AuthService.js +49 -6
- package/dist/cjs/server/core/AuthService.js.map +1 -1
- package/dist/cjs/server/sdk/src/core/defaultConfigs.js.map +1 -1
- package/dist/esm/core/IndexedDBManager/passkeyClientDB.js +2 -2
- package/dist/esm/core/IndexedDBManager/passkeyClientDB.js.map +1 -1
- package/dist/esm/core/TatchiPasskey/faucets/createAccountRelayServer.js +9 -8
- package/dist/esm/core/TatchiPasskey/faucets/createAccountRelayServer.js.map +1 -1
- package/dist/esm/core/TatchiPasskey/login.js +1 -1
- package/dist/esm/core/TatchiPasskey/login.js.map +1 -1
- package/dist/esm/core/TatchiPasskey/registration.js +67 -56
- package/dist/esm/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js +1 -10
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js.map +1 -1
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js +58 -67
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js.map +1 -1
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js +74 -75
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js.map +1 -1
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js +17 -7
- package/dist/esm/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js.map +1 -1
- package/dist/esm/core/WebAuthnManager/index.js +3 -3
- package/dist/esm/core/WebAuthnManager/index.js.map +1 -1
- package/dist/esm/core/defaultConfigs.js +3 -1
- package/dist/esm/core/defaultConfigs.js.map +1 -1
- package/dist/esm/react/components/AccountMenuButton/TransactionSettingsSection.js +3 -3
- package/dist/esm/react/components/AccountMenuButton/TransactionSettingsSection.js.map +1 -1
- package/dist/esm/react/components/PasskeyAuthMenu/{PasskeyAuthMenu-D2VHZ04W.css → PasskeyAuthMenu-qTHAv58Z.css} +3 -1
- package/dist/esm/react/components/PasskeyAuthMenu/PasskeyAuthMenu-qTHAv58Z.css.map +1 -0
- package/dist/esm/react/components/PasskeyAuthMenu/preload.js +1 -1
- package/dist/esm/react/components/PasskeyAuthMenu/preload.js.map +1 -1
- package/dist/esm/react/components/PasskeyAuthMenu/shell.js +52 -13
- package/dist/esm/react/components/PasskeyAuthMenu/shell.js.map +1 -1
- package/dist/esm/react/components/PasskeyAuthMenu/skeleton.js +4 -2
- package/dist/esm/react/components/PasskeyAuthMenu/skeleton.js.map +1 -1
- package/dist/esm/react/components/PasskeyAuthMenu/ui/EmailRecoverySlide.js +5 -1
- package/dist/esm/react/components/PasskeyAuthMenu/ui/EmailRecoverySlide.js.map +1 -1
- package/dist/esm/react/index.js +1 -1
- package/dist/esm/react/src/core/IndexedDBManager/passkeyClientDB.js +2 -2
- package/dist/esm/react/src/core/IndexedDBManager/passkeyClientDB.js.map +1 -1
- package/dist/esm/react/src/core/TatchiPasskey/faucets/createAccountRelayServer.js +9 -8
- package/dist/esm/react/src/core/TatchiPasskey/faucets/createAccountRelayServer.js.map +1 -1
- package/dist/esm/react/src/core/TatchiPasskey/login.js +1 -1
- package/dist/esm/react/src/core/TatchiPasskey/login.js.map +1 -1
- package/dist/esm/react/src/core/TatchiPasskey/registration.js +67 -56
- package/dist/esm/react/src/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js +1 -10
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.js.map +1 -1
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js +58 -67
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.js.map +1 -1
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js +74 -75
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.js.map +1 -1
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js +17 -7
- package/dist/esm/react/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.js.map +1 -1
- package/dist/esm/react/src/core/WebAuthnManager/index.js +3 -3
- package/dist/esm/react/src/core/WebAuthnManager/index.js.map +1 -1
- package/dist/esm/react/src/core/defaultConfigs.js +3 -1
- package/dist/esm/react/src/core/defaultConfigs.js.map +1 -1
- package/dist/esm/react/styles/styles.css +2 -0
- package/dist/esm/sdk/{EmailRecovery-Dl8b4ONg.js → EmailRecovery-Y7rurd4B.js} +3 -3
- package/dist/esm/sdk/{EmailRecovery-v9oNO2Tc.js → EmailRecovery-lsjLWApQ.js} +1 -1
- package/dist/esm/sdk/{IndexedDBManager-B1cUvdyY.js → IndexedDBManager-CmdN7smS.js} +3 -3
- package/dist/esm/sdk/{createAdapters-Dv7ZJPf1.js → createAdapters-4c8mBiD5.js} +2 -11
- package/dist/esm/sdk/{createAdapters-Dv7ZJPf1.js.map → createAdapters-4c8mBiD5.js.map} +1 -1
- package/dist/esm/sdk/{createAdapters-1Hmc1vVC.js → createAdapters-DF32SIZa.js} +1 -10
- package/dist/esm/sdk/{defaultConfigs-BmCU1_qI.js → defaultConfigs-BQqiXif-.js} +3 -1
- package/dist/esm/sdk/{emailRecovery-4J-g9tlY.js → emailRecovery-C0LSDleV.js} +5 -5
- package/dist/esm/sdk/{getDeviceNumber-f8bfPB9U.js → getDeviceNumber-WiNzKx1x.js} +4 -2
- package/dist/esm/sdk/{getDeviceNumber-f8bfPB9U.js.map → getDeviceNumber-WiNzKx1x.js.map} +1 -1
- package/dist/esm/sdk/{linkDevice-C98klpcE.js → linkDevice-Ds1GNIDk.js} +4 -4
- package/dist/esm/sdk/{localOnly-40zxrBMm.js → localOnly-COpDBMkm.js} +2 -2
- package/dist/esm/sdk/{localOnly-40zxrBMm.js.map → localOnly-COpDBMkm.js.map} +1 -1
- package/dist/esm/sdk/{localOnly-BZPBj14l.js → localOnly-DQQuqgjJ.js} +1 -1
- package/dist/esm/sdk/{login-DnROv3eA.js → login-BKhTuGcy.js} +3 -3
- package/dist/esm/sdk/offline-export-app.js +29 -19
- package/dist/esm/sdk/offline-export-app.js.map +1 -1
- package/dist/esm/sdk/{registration-BP9M3tE1.js → registration-BR2G9tz_.js} +59 -68
- package/dist/esm/sdk/{registration-MrAOC8Ub.js → registration-R70lvG_o.js} +60 -69
- package/dist/esm/sdk/registration-R70lvG_o.js.map +1 -0
- package/dist/esm/sdk/{router-BEGGuWaB.js → router-2aGn-CTp.js} +1 -1
- package/dist/esm/sdk/{rpcCalls-CMzj_Va_.js → rpcCalls-BPI0icZG.js} +2 -2
- package/dist/esm/sdk/{rpcCalls-B44MZora.js → rpcCalls-BW3M_q3-.js} +1 -1
- package/dist/esm/sdk/{scanDevice-Cp-r-Z2T.js → scanDevice-BBSehlMx.js} +4 -4
- package/dist/esm/sdk/{syncAccount-CqWCmBVb.js → syncAccount-DEZHBiRa.js} +4 -4
- package/dist/esm/sdk/{syncAccount-Dt5jJbEB.js → syncAccount-DHKtl-xh.js} +2 -2
- package/dist/esm/sdk/{transactions-DAZrPW-6.js → transactions-Cg1TIUyK.js} +76 -77
- package/dist/esm/sdk/{transactions-CrjP8yPD.js → transactions-CxsklyCK.js} +77 -78
- package/dist/esm/sdk/transactions-CxsklyCK.js.map +1 -0
- package/dist/esm/sdk/wallet-iframe-host.js +116 -94
- package/dist/esm/server/core/AuthService.js +49 -6
- package/dist/esm/server/core/AuthService.js.map +1 -1
- package/dist/esm/server/sdk/src/core/defaultConfigs.js.map +1 -1
- package/dist/esm/wasm_vrf_worker/pkg/wasm_vrf_worker_bg.wasm +0 -0
- package/dist/types/src/__tests__/setup/bootstrap.d.ts.map +1 -1
- package/dist/types/src/core/IndexedDBManager/passkeyClientDB.d.ts +1 -1
- package/dist/types/src/core/IndexedDBManager/passkeyClientDB.d.ts.map +1 -1
- package/dist/types/src/core/TatchiPasskey/faucets/createAccountRelayServer.d.ts +6 -6
- package/dist/types/src/core/TatchiPasskey/faucets/createAccountRelayServer.d.ts.map +1 -1
- package/dist/types/src/core/TatchiPasskey/registration.d.ts.map +1 -1
- package/dist/types/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.d.ts +0 -5
- package/dist/types/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/adapters/session.d.ts.map +1 -1
- package/dist/types/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/registration.d.ts.map +1 -1
- package/dist/types/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/flows/transactions.d.ts.map +1 -1
- package/dist/types/src/core/WebAuthnManager/VrfWorkerManager/confirmTxFlow/handleSecureConfirmRequest.d.ts.map +1 -1
- package/dist/types/src/core/WebAuthnManager/index.d.ts +1 -1
- package/dist/types/src/core/WebAuthnManager/index.d.ts.map +1 -1
- package/dist/types/src/core/defaultConfigs.d.ts.map +1 -1
- package/dist/types/src/react/components/PasskeyAuthMenu/preload.d.ts.map +1 -1
- package/dist/types/src/react/components/PasskeyAuthMenu/shell.d.ts.map +1 -1
- package/dist/types/src/react/components/PasskeyAuthMenu/skeleton.d.ts +1 -1
- package/dist/types/src/react/components/PasskeyAuthMenu/skeleton.d.ts.map +1 -1
- package/dist/types/src/react/components/PasskeyAuthMenu/ui/EmailRecoverySlide.d.ts.map +1 -1
- package/dist/types/src/server/core/AuthService.d.ts.map +1 -1
- package/dist/workers/offline-export-sw.js +156 -1
- package/dist/workers/wasm_vrf_worker_bg.wasm +0 -0
- package/dist/workers/web3authn-signer.worker.js +1360 -2
- package/dist/workers/web3authn-vrf.worker.js +2857 -2
- package/package.json +1 -1
- package/dist/cjs/react/components/PasskeyAuthMenu/PasskeyAuthMenu-CRlobBrN.css.map +0 -1
- package/dist/esm/react/components/PasskeyAuthMenu/PasskeyAuthMenu-D2VHZ04W.css.map +0 -1
- package/dist/esm/sdk/registration-MrAOC8Ub.js.map +0 -1
- package/dist/esm/sdk/transactions-CrjP8yPD.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { ActionType, fromTransactionInputsWasm, toActionArgsWasm, validateAction
|
|
|
4
4
|
import { DEFAULT_WAIT_STATUS } from "./rpc-Dq3ioE9T.js";
|
|
5
5
|
import { DEFAULT_CONFIRMATION_CONFIG, DEFAULT_SIGNING_MODE, DEFAULT_THRESHOLD_BEHAVIOR, INTERNAL_WORKER_REQUEST_TYPE_SIGN_ADD_KEY_THRESHOLD_PUBLIC_KEY_NO_PROMPT, UserVerificationPolicy as UserVerificationPolicy$1, WorkerRequestType, WorkerResponseType, coerceSignerMode, getThresholdBehaviorFromSignerMode, isDecryptPrivateKeyWithPrfSuccess, isDeriveNearKeypairAndEncryptSuccess, isExtractCosePublicKeySuccess, isRecoverKeypairFromPasskeySuccess, isRegisterDevice2WithDerivedKeySuccess, isSignAddKeyThresholdPublicKeyNoPromptSuccess, isSignDelegateActionSuccess, isSignNep413MessageSuccess, isSignTransactionsWithActionsSuccess, isWorkerError, isWorkerProgress, isWorkerSuccess, mergeSignerMode } from "./signer-worker-DK847sXj.js";
|
|
6
6
|
import { base64UrlDecode } from "./base64-dqpWgddX.js";
|
|
7
|
-
import { clearCachedThresholdEd25519AuthSession, esm_default, getCachedThresholdEd25519AuthSessionJwt, getLoginSession, getRecentLogins, isThresholdSessionAuthUnavailableError, isThresholdSignerMissingKeyError, loginAndCreateSession, logoutAndClearSession, makeThresholdEd25519AuthSessionCacheKey } from "./login-
|
|
7
|
+
import { clearCachedThresholdEd25519AuthSession, esm_default, getCachedThresholdEd25519AuthSessionJwt, getLoginSession, getRecentLogins, isThresholdSessionAuthUnavailableError, isThresholdSignerMissingKeyError, loginAndCreateSession, logoutAndClearSession, makeThresholdEd25519AuthSessionCacheKey } from "./login-BKhTuGcy.js";
|
|
8
8
|
import { validateVRFChallenge } from "./vrf-worker-BzQsJ5BW.js";
|
|
9
9
|
import { ActionPhase, ActionStatus, RegistrationPhase, RegistrationStatus } from "./sdkSentEvents-CzAZBFjP.js";
|
|
10
10
|
import { BUILD_PATHS, SIGNER_WORKER_MANAGER_CONFIG } from "./config-BbNXtVtu.js";
|
|
@@ -14,14 +14,14 @@ import { CONFIRM_UI_ELEMENT_SELECTORS } from "./tags-ByzxP7Cc.js";
|
|
|
14
14
|
import { __isWalletIframeHostMode, __setWalletIframeHostMode, ensureKnownW3aElement } from "./host-mode-BIUqo9hg.js";
|
|
15
15
|
import { errorMessage, getNearShortErrorMessage, getUserFriendlyErrorMessage, isTouchIdCancellationError, toError } from "./errors-DevlT39D.js";
|
|
16
16
|
import { MinimalNearClient, SignedTransaction, isOffline, openOfflineExport } from "./overlay-Ci2FOQKE.js";
|
|
17
|
-
import { IndexedDBManager, buildThresholdEd25519Participants2pV1, configureIndexedDB, normalizeThresholdEd25519ParticipantIds } from "./IndexedDBManager-
|
|
18
|
-
import { PASSKEY_MANAGER_DEFAULT_CONFIGS, buildConfigsFromEnv } from "./defaultConfigs-
|
|
17
|
+
import { IndexedDBManager, buildThresholdEd25519Participants2pV1, configureIndexedDB, normalizeThresholdEd25519ParticipantIds } from "./IndexedDBManager-CmdN7smS.js";
|
|
18
|
+
import { PASSKEY_MANAGER_DEFAULT_CONFIGS, buildConfigsFromEnv } from "./defaultConfigs-BQqiXif-.js";
|
|
19
19
|
import { normalizeRegistrationCredential, removePrfOutputGuard, serializeRegistrationCredential, serializeRegistrationCredentialWithPRF } from "./safari-fallbacks-BcMFntiP.js";
|
|
20
20
|
import { TouchIdPrompt } from "./touchIdPrompt-JPhrOx8o.js";
|
|
21
|
-
import { checkCanRegisterUserContractCall, hasAccessKey, thresholdEd25519Keygen, waitForAccessKeyAbsent } from "./rpcCalls-
|
|
21
|
+
import { checkCanRegisterUserContractCall, hasAccessKey, thresholdEd25519Keygen, waitForAccessKeyAbsent } from "./rpcCalls-BW3M_q3-.js";
|
|
22
22
|
import { getLastLoggedInDeviceNumber } from "./getDeviceNumber-y3mMtky6.js";
|
|
23
23
|
import { SecureConfirmMessageType, SecureConfirmationType, collectAuthenticationCredentialForVrfChallenge, getIntentDigest, parseTransactionSummary, sanitizeForPostMessage, sendConfirmResponse } from "./collectAuthenticationCredentialForVrfChallenge-DqzPzwvU.js";
|
|
24
|
-
import "./syncAccount-
|
|
24
|
+
import "./syncAccount-DHKtl-xh.js";
|
|
25
25
|
|
|
26
26
|
//#region src/utils/base58.ts
|
|
27
27
|
/**
|
|
@@ -2364,13 +2364,23 @@ async function handlePromptUserConfirmInJsMainThread(ctx, message, worker) {
|
|
|
2364
2364
|
});
|
|
2365
2365
|
return;
|
|
2366
2366
|
}
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2367
|
+
try {
|
|
2368
|
+
await handler({
|
|
2369
|
+
ctx,
|
|
2370
|
+
request,
|
|
2371
|
+
worker,
|
|
2372
|
+
confirmationConfig,
|
|
2373
|
+
transactionSummary
|
|
2374
|
+
});
|
|
2375
|
+
} catch (e) {
|
|
2376
|
+
console.error("[SecureConfirm][Host] handler failed", e);
|
|
2377
|
+
sendConfirmResponse(worker, {
|
|
2378
|
+
requestId: request.requestId,
|
|
2379
|
+
intentDigest: getIntentDigest(request),
|
|
2380
|
+
confirmed: false,
|
|
2381
|
+
error: errorMessage(e) || "Secure confirmation failed"
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2374
2384
|
}
|
|
2375
2385
|
async function importFlow(label, loader) {
|
|
2376
2386
|
try {
|
|
@@ -2382,42 +2392,42 @@ async function importFlow(label, loader) {
|
|
|
2382
2392
|
}
|
|
2383
2393
|
const HANDLERS = {
|
|
2384
2394
|
[SecureConfirmationType.DECRYPT_PRIVATE_KEY_WITH_PRF]: async ({ ctx, request, worker, confirmationConfig, transactionSummary }) => {
|
|
2385
|
-
const { handleLocalOnlyFlow } = await importFlow("localOnly", () => import("./localOnly-
|
|
2395
|
+
const { handleLocalOnlyFlow } = await importFlow("localOnly", () => import("./localOnly-DQQuqgjJ.js"));
|
|
2386
2396
|
await handleLocalOnlyFlow(ctx, request, worker, {
|
|
2387
2397
|
confirmationConfig,
|
|
2388
2398
|
transactionSummary
|
|
2389
2399
|
});
|
|
2390
2400
|
},
|
|
2391
2401
|
[SecureConfirmationType.SHOW_SECURE_PRIVATE_KEY_UI]: async ({ ctx, request, worker, confirmationConfig, transactionSummary }) => {
|
|
2392
|
-
const { handleLocalOnlyFlow } = await importFlow("localOnly", () => import("./localOnly-
|
|
2402
|
+
const { handleLocalOnlyFlow } = await importFlow("localOnly", () => import("./localOnly-DQQuqgjJ.js"));
|
|
2393
2403
|
await handleLocalOnlyFlow(ctx, request, worker, {
|
|
2394
2404
|
confirmationConfig,
|
|
2395
2405
|
transactionSummary
|
|
2396
2406
|
});
|
|
2397
2407
|
},
|
|
2398
2408
|
[SecureConfirmationType.REGISTER_ACCOUNT]: async ({ ctx, request, worker, confirmationConfig, transactionSummary }) => {
|
|
2399
|
-
const { handleRegistrationFlow } = await importFlow("registration", () => import("./registration-
|
|
2409
|
+
const { handleRegistrationFlow } = await importFlow("registration", () => import("./registration-BR2G9tz_.js"));
|
|
2400
2410
|
await handleRegistrationFlow(ctx, request, worker, {
|
|
2401
2411
|
confirmationConfig,
|
|
2402
2412
|
transactionSummary
|
|
2403
2413
|
});
|
|
2404
2414
|
},
|
|
2405
2415
|
[SecureConfirmationType.LINK_DEVICE]: async ({ ctx, request, worker, confirmationConfig, transactionSummary }) => {
|
|
2406
|
-
const { handleRegistrationFlow } = await importFlow("registration", () => import("./registration-
|
|
2416
|
+
const { handleRegistrationFlow } = await importFlow("registration", () => import("./registration-BR2G9tz_.js"));
|
|
2407
2417
|
await handleRegistrationFlow(ctx, request, worker, {
|
|
2408
2418
|
confirmationConfig,
|
|
2409
2419
|
transactionSummary
|
|
2410
2420
|
});
|
|
2411
2421
|
},
|
|
2412
2422
|
[SecureConfirmationType.SIGN_TRANSACTION]: async ({ ctx, request, worker, confirmationConfig, transactionSummary }) => {
|
|
2413
|
-
const { handleTransactionSigningFlow } = await importFlow("transactions", () => import("./transactions-
|
|
2423
|
+
const { handleTransactionSigningFlow } = await importFlow("transactions", () => import("./transactions-Cg1TIUyK.js"));
|
|
2414
2424
|
await handleTransactionSigningFlow(ctx, request, worker, {
|
|
2415
2425
|
confirmationConfig,
|
|
2416
2426
|
transactionSummary
|
|
2417
2427
|
});
|
|
2418
2428
|
},
|
|
2419
2429
|
[SecureConfirmationType.SIGN_NEP413_MESSAGE]: async ({ ctx, request, worker, confirmationConfig, transactionSummary }) => {
|
|
2420
|
-
const { handleTransactionSigningFlow } = await importFlow("transactions", () => import("./transactions-
|
|
2430
|
+
const { handleTransactionSigningFlow } = await importFlow("transactions", () => import("./transactions-Cg1TIUyK.js"));
|
|
2421
2431
|
await handleTransactionSigningFlow(ctx, request, worker, {
|
|
2422
2432
|
confirmationConfig,
|
|
2423
2433
|
transactionSummary
|
|
@@ -5554,13 +5564,13 @@ var WebAuthnManager = class {
|
|
|
5554
5564
|
/**
|
|
5555
5565
|
* Persist refreshed server-encrypted VRF keypair in IndexedDB.
|
|
5556
5566
|
*/
|
|
5557
|
-
async updateServerEncryptedVrfKeypair(nearAccountId, serverEncrypted) {
|
|
5567
|
+
async updateServerEncryptedVrfKeypair(nearAccountId, serverEncrypted, deviceNumber) {
|
|
5558
5568
|
await IndexedDBManager.clientDB.updateUser(nearAccountId, { serverEncryptedVrfKeypair: {
|
|
5559
5569
|
ciphertextVrfB64u: serverEncrypted.ciphertextVrfB64u,
|
|
5560
5570
|
kek_s_b64u: serverEncrypted.kek_s_b64u,
|
|
5561
5571
|
serverKeyId: serverEncrypted.serverKeyId,
|
|
5562
5572
|
updatedAt: Date.now()
|
|
5563
|
-
} });
|
|
5573
|
+
} }, deviceNumber);
|
|
5564
5574
|
}
|
|
5565
5575
|
async clearVrfSession() {
|
|
5566
5576
|
if (typeof window !== "undefined" && this.workerBaseOrigin !== window.location.origin) return;
|
|
@@ -5668,7 +5678,7 @@ var WebAuthnManager = class {
|
|
|
5668
5678
|
const active = status.active && status.nearAccountId === nearAccountId;
|
|
5669
5679
|
if (!active) return false;
|
|
5670
5680
|
const refreshed = await this.shamir3PassEncryptCurrentVrfKeypair();
|
|
5671
|
-
await this.updateServerEncryptedVrfKeypair(nearAccountId, refreshed);
|
|
5681
|
+
await this.updateServerEncryptedVrfKeypair(nearAccountId, refreshed, userData?.deviceNumber);
|
|
5672
5682
|
return true;
|
|
5673
5683
|
} catch {
|
|
5674
5684
|
return false;
|
|
@@ -6717,23 +6727,24 @@ async function createAccountAndRegisterWithRelayServer(context, nearAccountId, p
|
|
|
6717
6727
|
const serialized = isSerialized ? normalizeRegistrationCredential(credential) : serializeRegistrationCredential(credential);
|
|
6718
6728
|
const serializedCredential = removePrfOutputGuard(serialized);
|
|
6719
6729
|
if (!Array.isArray(serializedCredential?.response?.transports)) serializedCredential.response.transports = [];
|
|
6720
|
-
const
|
|
6721
|
-
|
|
6730
|
+
const intentDigestB64u = String(vrfChallenge.intentDigest || "").trim();
|
|
6731
|
+
const intentDigestBytes = base64UrlDecode(intentDigestB64u);
|
|
6732
|
+
if (intentDigestBytes.length !== 32) throw new Error("Missing or invalid vrfChallenge.intentDigest (expected base64url-encoded 32 bytes)");
|
|
6722
6733
|
const requestData = {
|
|
6723
6734
|
new_account_id: nearAccountId,
|
|
6724
6735
|
new_public_key: publicKey,
|
|
6725
6736
|
device_number: 1,
|
|
6726
6737
|
...opts?.thresholdEd25519?.clientVerifyingShareB64u ? { threshold_ed25519: { client_verifying_share_b64u: opts.thresholdEd25519.clientVerifyingShareB64u } } : {},
|
|
6727
6738
|
vrf_data: {
|
|
6728
|
-
vrf_input_data:
|
|
6729
|
-
vrf_output:
|
|
6730
|
-
vrf_proof:
|
|
6731
|
-
public_key:
|
|
6739
|
+
vrf_input_data: vrfChallenge.vrfInput,
|
|
6740
|
+
vrf_output: vrfChallenge.vrfOutput,
|
|
6741
|
+
vrf_proof: vrfChallenge.vrfProof,
|
|
6742
|
+
public_key: vrfChallenge.vrfPublicKey,
|
|
6732
6743
|
user_id: vrfChallenge.userId,
|
|
6733
6744
|
rp_id: vrfChallenge.rpId,
|
|
6734
6745
|
block_height: Number(vrfChallenge.blockHeight),
|
|
6735
|
-
block_hash:
|
|
6736
|
-
intent_digest_32
|
|
6746
|
+
block_hash: vrfChallenge.blockHash,
|
|
6747
|
+
intent_digest_32: intentDigestB64u
|
|
6737
6748
|
},
|
|
6738
6749
|
webauthn_registration: serializedCredential,
|
|
6739
6750
|
deterministic_vrf_public_key: Array.from(base64UrlDecode(deterministicVrfPublicKey)),
|
|
@@ -6829,7 +6840,7 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
6829
6840
|
step: 1,
|
|
6830
6841
|
phase: RegistrationPhase.STEP_1_WEBAUTHN_VERIFICATION,
|
|
6831
6842
|
status: RegistrationStatus.PROGRESS,
|
|
6832
|
-
message: "
|
|
6843
|
+
message: "Generating passkey credential..."
|
|
6833
6844
|
});
|
|
6834
6845
|
const confirmationConfig = {
|
|
6835
6846
|
uiMode: "modal",
|
|
@@ -6845,26 +6856,13 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
6845
6856
|
});
|
|
6846
6857
|
const credential = registrationSession.credential;
|
|
6847
6858
|
const vrfChallenge = registrationSession.vrfChallenge;
|
|
6859
|
+
const transactionContext = registrationSession.transactionContext;
|
|
6848
6860
|
onEvent?.({
|
|
6849
6861
|
step: 1,
|
|
6850
6862
|
phase: RegistrationPhase.STEP_1_WEBAUTHN_VERIFICATION,
|
|
6851
6863
|
status: RegistrationStatus.SUCCESS,
|
|
6852
6864
|
message: "WebAuthn ceremony successful"
|
|
6853
6865
|
});
|
|
6854
|
-
const canRegisterUserPromise = webAuthnManager.checkCanRegisterUser({
|
|
6855
|
-
contractId: context.configs.contractId,
|
|
6856
|
-
credential,
|
|
6857
|
-
vrfChallenge,
|
|
6858
|
-
onEvent: (progress) => {
|
|
6859
|
-
console.debug(`Registration progress: ${progress.step} - ${progress.message}`);
|
|
6860
|
-
onEvent?.({
|
|
6861
|
-
step: 3,
|
|
6862
|
-
phase: RegistrationPhase.STEP_3_CONTRACT_PRE_CHECK,
|
|
6863
|
-
status: RegistrationStatus.PROGRESS,
|
|
6864
|
-
message: `${progress.message}`
|
|
6865
|
-
});
|
|
6866
|
-
}
|
|
6867
|
-
});
|
|
6868
6866
|
const deterministicVrfKeyResult = await webAuthnManager.deriveVrfKeypair({
|
|
6869
6867
|
credential,
|
|
6870
6868
|
nearAccountId,
|
|
@@ -6896,12 +6894,6 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
6896
6894
|
if (!derived.success || !derived.clientVerifyingShareB64u) throw new Error(derived.error || "Failed to derive threshold client verifying share");
|
|
6897
6895
|
thresholdClientVerifyingShareB64u = derived.clientVerifyingShareB64u;
|
|
6898
6896
|
}
|
|
6899
|
-
const canRegisterUserResult = await canRegisterUserPromise;
|
|
6900
|
-
if (!canRegisterUserResult.verified) {
|
|
6901
|
-
console.error(canRegisterUserResult);
|
|
6902
|
-
const errorMessage$1 = canRegisterUserResult.error || "User verification failed - account may already exist or contract is unreachable";
|
|
6903
|
-
throw new Error(`Web3Authn contract registration check failed: ${errorMessage$1}`);
|
|
6904
|
-
}
|
|
6905
6897
|
onEvent?.({
|
|
6906
6898
|
step: 2,
|
|
6907
6899
|
phase: RegistrationPhase.STEP_2_KEY_GENERATION,
|
|
@@ -6927,15 +6919,26 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
6927
6919
|
const expectedAccessKeys = [nearPublicKey];
|
|
6928
6920
|
const thresholdPublicKey = String(accountAndRegistrationResult?.thresholdEd25519?.publicKey || "").trim();
|
|
6929
6921
|
const relayerKeyId = String(accountAndRegistrationResult?.thresholdEd25519?.relayerKeyId || "").trim();
|
|
6930
|
-
const accessKeyVerified = await verifyAccountAccessKeysPresent(context.nearClient, nearAccountId, expectedAccessKeys
|
|
6931
|
-
|
|
6932
|
-
|
|
6922
|
+
const accessKeyVerified = await verifyAccountAccessKeysPresent(context.nearClient, nearAccountId, expectedAccessKeys, {
|
|
6923
|
+
attempts: 3,
|
|
6924
|
+
delayMs: 200,
|
|
6925
|
+
finality: "optimistic"
|
|
6926
|
+
});
|
|
6927
|
+
if (!accessKeyVerified) {
|
|
6928
|
+
console.warn("[Registration] Access key not yet visible after atomic registration; continuing optimistically");
|
|
6929
|
+
onEvent?.({
|
|
6930
|
+
step: 6,
|
|
6931
|
+
phase: RegistrationPhase.STEP_6_ACCOUNT_VERIFICATION,
|
|
6932
|
+
status: RegistrationStatus.SUCCESS,
|
|
6933
|
+
message: "Access key verification pending (optimistic); continuing..."
|
|
6934
|
+
});
|
|
6935
|
+
} else onEvent?.({
|
|
6933
6936
|
step: 6,
|
|
6934
6937
|
phase: RegistrationPhase.STEP_6_ACCOUNT_VERIFICATION,
|
|
6935
6938
|
status: RegistrationStatus.SUCCESS,
|
|
6936
6939
|
message: "Access key verified on-chain"
|
|
6937
6940
|
});
|
|
6938
|
-
|
|
6941
|
+
activateThresholdEnrollmentPostRegistration({
|
|
6939
6942
|
requestedSignerMode: requestedSignerModeStr,
|
|
6940
6943
|
nearAccountId,
|
|
6941
6944
|
nearPublicKey,
|
|
@@ -6950,7 +6953,7 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
6950
6953
|
webAuthnManager: context.webAuthnManager,
|
|
6951
6954
|
nearClient: context.nearClient,
|
|
6952
6955
|
onEvent
|
|
6953
|
-
});
|
|
6956
|
+
}).catch(() => {});
|
|
6954
6957
|
onEvent?.({
|
|
6955
6958
|
step: 7,
|
|
6956
6959
|
phase: RegistrationPhase.STEP_7_DATABASE_STORAGE,
|
|
@@ -6972,31 +6975,12 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
6972
6975
|
status: RegistrationStatus.SUCCESS,
|
|
6973
6976
|
message: "Registration metadata stored successfully"
|
|
6974
6977
|
});
|
|
6975
|
-
try {
|
|
6976
|
-
context.webAuthnManager.getNonceManager().initializeUser(nearAccountId, nearPublicKey);
|
|
6977
|
-
await context.webAuthnManager.getNonceManager().prefetchBlockheight(context.nearClient);
|
|
6978
|
-
} catch {}
|
|
6979
6978
|
let vrfStatus = await webAuthnManager.checkVrfStatus().catch(() => ({ active: false }));
|
|
6980
6979
|
if (!vrfStatus?.active) {
|
|
6981
|
-
const
|
|
6982
|
-
const txBlockHash = blockInfo?.header?.hash;
|
|
6983
|
-
const txBlockHeight = String(blockInfo.header?.height ?? "");
|
|
6984
|
-
const vrfChallenge2 = await webAuthnManager.generateVrfChallengeOnce({
|
|
6985
|
-
userId: nearAccountId,
|
|
6986
|
-
rpId: webAuthnManager.getRpId(),
|
|
6987
|
-
blockHash: txBlockHash,
|
|
6988
|
-
blockHeight: txBlockHeight
|
|
6989
|
-
});
|
|
6990
|
-
const authenticators = await webAuthnManager.getAuthenticatorsByUser(nearAccountId);
|
|
6991
|
-
const authCredential = await webAuthnManager.getAuthenticationCredentialsSerializedDualPrf({
|
|
6992
|
-
nearAccountId,
|
|
6993
|
-
challenge: vrfChallenge2,
|
|
6994
|
-
credentialIds: authenticators.map((a) => a.credentialId)
|
|
6995
|
-
});
|
|
6996
|
-
const unlockResult = await webAuthnManager.unlockVRFKeypair({
|
|
6980
|
+
const unlockNoPrompt = await webAuthnManager.unlockVRFKeypair({
|
|
6997
6981
|
nearAccountId,
|
|
6998
6982
|
encryptedVrfKeypair: deterministicVrfKeyResult.encryptedVrfKeypair,
|
|
6999
|
-
credential
|
|
6983
|
+
credential
|
|
7000
6984
|
}).catch((unlockError) => {
|
|
7001
6985
|
const message = unlockError && typeof unlockError === "object" && "message" in unlockError ? String(unlockError.message || "") : String(unlockError || "");
|
|
7002
6986
|
return {
|
|
@@ -7004,13 +6988,46 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
7004
6988
|
error: message
|
|
7005
6989
|
};
|
|
7006
6990
|
});
|
|
7007
|
-
if (!
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
6991
|
+
if (!unlockNoPrompt.success) {
|
|
6992
|
+
let txBlockHash = String(transactionContext?.txBlockHash || "").trim();
|
|
6993
|
+
let txBlockHeight = String(transactionContext?.txBlockHeight || "").trim();
|
|
6994
|
+
if (!txBlockHash || !txBlockHeight) {
|
|
6995
|
+
const blockInfo = await context.nearClient.viewBlock({ finality: "final" });
|
|
6996
|
+
txBlockHash = String(blockInfo?.header?.hash || "").trim();
|
|
6997
|
+
txBlockHeight = String(blockInfo?.header?.height ?? "").trim();
|
|
6998
|
+
}
|
|
6999
|
+
const vrfChallenge2 = await webAuthnManager.generateVrfChallengeOnce({
|
|
7000
|
+
userId: nearAccountId,
|
|
7001
|
+
rpId: webAuthnManager.getRpId(),
|
|
7002
|
+
blockHash: txBlockHash,
|
|
7003
|
+
blockHeight: txBlockHeight
|
|
7004
|
+
});
|
|
7005
|
+
const allowCredentialIds = String(credential?.rawId || "").trim() ? [String(credential.rawId)] : (await webAuthnManager.getAuthenticatorsByUser(nearAccountId)).map((a) => a.credentialId);
|
|
7006
|
+
const authCredential = await webAuthnManager.getAuthenticationCredentialsSerializedDualPrf({
|
|
7007
|
+
nearAccountId,
|
|
7008
|
+
challenge: vrfChallenge2,
|
|
7009
|
+
credentialIds: allowCredentialIds
|
|
7010
|
+
});
|
|
7011
|
+
const unlockResult = await webAuthnManager.unlockVRFKeypair({
|
|
7012
|
+
nearAccountId,
|
|
7013
|
+
encryptedVrfKeypair: deterministicVrfKeyResult.encryptedVrfKeypair,
|
|
7014
|
+
credential: authCredential
|
|
7015
|
+
}).catch((unlockError) => {
|
|
7016
|
+
const message = unlockError && typeof unlockError === "object" && "message" in unlockError ? String(unlockError.message || "") : String(unlockError || "");
|
|
7017
|
+
return {
|
|
7018
|
+
success: false,
|
|
7019
|
+
error: message
|
|
7020
|
+
};
|
|
7021
|
+
});
|
|
7022
|
+
if (!unlockResult.success) {
|
|
7023
|
+
console.warn("VRF keypair unlock failed:", unlockResult.error);
|
|
7024
|
+
throw new Error(unlockResult.error);
|
|
7025
|
+
}
|
|
7026
|
+
} else console.debug("Registration: VRF unlocked using registration credential; skipping extra Touch ID unlock");
|
|
7011
7027
|
} else console.debug("Registration: VRF session already active; skipping extra Touch ID unlock");
|
|
7012
7028
|
try {
|
|
7013
|
-
await webAuthnManager.initializeCurrentUser(nearAccountId
|
|
7029
|
+
await webAuthnManager.initializeCurrentUser(nearAccountId);
|
|
7030
|
+
webAuthnManager.getNonceManager().prefetchBlockheight(context.nearClient).catch(() => {});
|
|
7014
7031
|
} catch (initErr) {
|
|
7015
7032
|
console.warn("Failed to initialize current user after registration:", initErr);
|
|
7016
7033
|
}
|
|
@@ -7171,7 +7188,11 @@ async function activateThresholdEnrollmentPostRegistration(opts) {
|
|
|
7171
7188
|
const signedTx = signed?.signedTransaction;
|
|
7172
7189
|
if (!signedTx) throw new Error("Failed to sign AddKey(thresholdPublicKey) transaction");
|
|
7173
7190
|
await opts.nearClient.sendTransaction(signedTx, DEFAULT_WAIT_STATUS.thresholdAddKey);
|
|
7174
|
-
const thresholdKeyVerified = await verifyAccountAccessKeysPresent(opts.nearClient, opts.nearAccountId, [opts.nearPublicKey, thresholdPublicKey]
|
|
7191
|
+
const thresholdKeyVerified = await verifyAccountAccessKeysPresent(opts.nearClient, opts.nearAccountId, [opts.nearPublicKey, thresholdPublicKey], {
|
|
7192
|
+
attempts: 6,
|
|
7193
|
+
delayMs: 250,
|
|
7194
|
+
finality: "optimistic"
|
|
7195
|
+
});
|
|
7175
7196
|
if (!thresholdKeyVerified) throw new Error("Threshold access key not found on-chain after AddKey");
|
|
7176
7197
|
await IndexedDBManager.nearKeysDB.storeKeyMaterial({
|
|
7177
7198
|
kind: "threshold_ed25519_2p_v1",
|
|
@@ -7207,14 +7228,15 @@ async function verifyAccountAccessKeysPresent(nearClient$1, nearAccountId, expec
|
|
|
7207
7228
|
if (!unique.length) return false;
|
|
7208
7229
|
const attempts = Math.max(1, Math.floor(opts?.attempts ?? 6));
|
|
7209
7230
|
const delayMs = Math.max(50, Math.floor(opts?.delayMs ?? 750));
|
|
7231
|
+
const finality = opts?.finality ?? "optimistic";
|
|
7210
7232
|
for (let i = 0; i < attempts; i++) {
|
|
7211
7233
|
try {
|
|
7212
|
-
const
|
|
7213
|
-
const keys =
|
|
7234
|
+
const accessKeyList = await nearClient$1.viewAccessKeyList(nearAccountId, { finality });
|
|
7235
|
+
const keys = accessKeyList.keys.map((k) => ensureEd25519Prefix(k.public_key)).filter(Boolean);
|
|
7214
7236
|
const allPresent = unique.every((expected) => keys.includes(expected));
|
|
7215
7237
|
if (allPresent) return true;
|
|
7216
7238
|
} catch {}
|
|
7217
|
-
await new Promise((res) => setTimeout(res, delayMs));
|
|
7239
|
+
if (i < attempts - 1) await new Promise((res) => setTimeout(res, delayMs));
|
|
7218
7240
|
}
|
|
7219
7241
|
return false;
|
|
7220
7242
|
}
|
|
@@ -7307,7 +7329,7 @@ var TatchiPasskey = class {
|
|
|
7307
7329
|
} catch {}
|
|
7308
7330
|
if (!this.iframeRouter) {
|
|
7309
7331
|
if (!this.walletIframeInitInFlight) this.walletIframeInitInFlight = (async () => {
|
|
7310
|
-
const { WalletIframeRouter } = await import("./router-
|
|
7332
|
+
const { WalletIframeRouter } = await import("./router-2aGn-CTp.js");
|
|
7311
7333
|
this.iframeRouter = new WalletIframeRouter({
|
|
7312
7334
|
walletOrigin,
|
|
7313
7335
|
servicePath: walletIframeConfig?.walletServicePath || "/wallet-service",
|
|
@@ -8281,8 +8303,8 @@ var TatchiPasskey = class {
|
|
|
8281
8303
|
return await router.getRecoveryEmails(nearAccountId);
|
|
8282
8304
|
}
|
|
8283
8305
|
const accountId = toAccountId(nearAccountId);
|
|
8284
|
-
const { getRecoveryEmailHashesContractCall } = await import("./rpcCalls-
|
|
8285
|
-
const { getLocalRecoveryEmails, bytesToHex } = await import("./EmailRecovery-
|
|
8306
|
+
const { getRecoveryEmailHashesContractCall } = await import("./rpcCalls-BPI0icZG.js");
|
|
8307
|
+
const { getLocalRecoveryEmails, bytesToHex } = await import("./EmailRecovery-Y7rurd4B.js");
|
|
8286
8308
|
const rawHashes = await getRecoveryEmailHashesContractCall(this.nearClient, accountId);
|
|
8287
8309
|
if (!rawHashes.length) return [];
|
|
8288
8310
|
let local = [];
|
|
@@ -8329,8 +8351,8 @@ var TatchiPasskey = class {
|
|
|
8329
8351
|
throw e;
|
|
8330
8352
|
}
|
|
8331
8353
|
const accountId = toAccountId(nearAccountId);
|
|
8332
|
-
const { prepareRecoveryEmails } = await import("./EmailRecovery-
|
|
8333
|
-
const { buildSetRecoveryEmailsActions } = await import("./rpcCalls-
|
|
8354
|
+
const { prepareRecoveryEmails } = await import("./EmailRecovery-Y7rurd4B.js");
|
|
8355
|
+
const { buildSetRecoveryEmailsActions } = await import("./rpcCalls-BPI0icZG.js");
|
|
8334
8356
|
const { hashes: recoveryEmailHashes } = await prepareRecoveryEmails(accountId, recoveryEmails);
|
|
8335
8357
|
const actions = await buildSetRecoveryEmailsActions(this.nearClient, accountId, recoveryEmailHashes, this.configs.emailRecoveryContracts);
|
|
8336
8358
|
return this.executeAction({
|
|
@@ -8361,7 +8383,7 @@ var TatchiPasskey = class {
|
|
|
8361
8383
|
throw e;
|
|
8362
8384
|
}
|
|
8363
8385
|
try {
|
|
8364
|
-
const { SyncAccountFlow } = await import("./syncAccount-
|
|
8386
|
+
const { SyncAccountFlow } = await import("./syncAccount-DEZHBiRa.js");
|
|
8365
8387
|
const flow = new SyncAccountFlow(this.getContext(), options);
|
|
8366
8388
|
const discovered = await flow.discover(accountIdInput || "");
|
|
8367
8389
|
if (!Array.isArray(discovered) || discovered.length === 0) {
|
|
@@ -8391,7 +8413,7 @@ var TatchiPasskey = class {
|
|
|
8391
8413
|
}
|
|
8392
8414
|
}
|
|
8393
8415
|
async ensureEmailRecoveryFlow(options) {
|
|
8394
|
-
const { EmailRecoveryFlow } = await import("./emailRecovery-
|
|
8416
|
+
const { EmailRecoveryFlow } = await import("./emailRecovery-C0LSDleV.js");
|
|
8395
8417
|
if (!this.activeEmailRecoveryFlow) this.activeEmailRecoveryFlow = new EmailRecoveryFlow(this.getContext(), options);
|
|
8396
8418
|
else if (options) this.activeEmailRecoveryFlow.setOptions(options);
|
|
8397
8419
|
return this.activeEmailRecoveryFlow;
|
|
@@ -8485,7 +8507,7 @@ var TatchiPasskey = class {
|
|
|
8485
8507
|
});
|
|
8486
8508
|
}
|
|
8487
8509
|
this.activeDeviceLinkFlow?.cancel();
|
|
8488
|
-
const { LinkDeviceFlow } = await import("./linkDevice-
|
|
8510
|
+
const { LinkDeviceFlow } = await import("./linkDevice-Ds1GNIDk.js");
|
|
8489
8511
|
const flow = new LinkDeviceFlow(this.getContext(), {
|
|
8490
8512
|
cameraId: args?.cameraId,
|
|
8491
8513
|
options: args?.options
|
|
@@ -8538,7 +8560,7 @@ var TatchiPasskey = class {
|
|
|
8538
8560
|
});
|
|
8539
8561
|
return res;
|
|
8540
8562
|
}
|
|
8541
|
-
const { linkDeviceWithScannedQRData } = await import("./scanDevice-
|
|
8563
|
+
const { linkDeviceWithScannedQRData } = await import("./scanDevice-BBSehlMx.js");
|
|
8542
8564
|
return linkDeviceWithScannedQRData(this.getContext(), qrData, options);
|
|
8543
8565
|
}
|
|
8544
8566
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isValidAccountId, toOptionalTrimmedString, toRorOriginOrNull } from "../sdk/src/utils/validation.js";
|
|
2
2
|
import { createAuthServiceConfig } from "./config.js";
|
|
3
3
|
import { ActionType, validateActionArgsWasm } from "../sdk/src/core/types/actions.js";
|
|
4
|
+
import { base64UrlDecode } from "../sdk/src/utils/base64.js";
|
|
4
5
|
import { errorMessage, toError } from "../sdk/src/utils/errors.js";
|
|
5
6
|
import { MinimalNearClient, SignedTransaction } from "../sdk/src/core/NearClient.js";
|
|
6
7
|
import { toPublicKeyStringFromSecretKey } from "./nearKeys.js";
|
|
@@ -19,6 +20,50 @@ import initSignerWasm, { WorkerRequestType, WorkerResponseType, handle_signer_me
|
|
|
19
20
|
function isObject(v) {
|
|
20
21
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
21
22
|
}
|
|
23
|
+
function normalizeU8ArrayLike(input, fieldName) {
|
|
24
|
+
if (input instanceof Uint8Array) return Array.from(input);
|
|
25
|
+
if (typeof input === "string") try {
|
|
26
|
+
return Array.from(base64UrlDecode(input));
|
|
27
|
+
} catch (err) {
|
|
28
|
+
throw new Error(`Invalid ${fieldName}: expected base64url string (${errorMessage(err) || "decode failed"})`);
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(input)) {
|
|
31
|
+
const out = [];
|
|
32
|
+
for (const v of input) {
|
|
33
|
+
const n = Number(v);
|
|
34
|
+
if (!Number.isFinite(n) || n < 0 || n > 255) throw new Error(`Invalid ${fieldName}: expected byte array (0..255)`);
|
|
35
|
+
out.push(Math.floor(n));
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Invalid ${fieldName}: expected number[] or base64url string`);
|
|
40
|
+
}
|
|
41
|
+
function normalizeContractVrfDataForContract(input) {
|
|
42
|
+
if (!isObject(input)) throw new Error("Missing or invalid vrf_data");
|
|
43
|
+
const user_id = toOptionalTrimmedString(input.user_id);
|
|
44
|
+
const rp_id = toOptionalTrimmedString(input.rp_id);
|
|
45
|
+
const block_height_raw = input.block_height;
|
|
46
|
+
const block_height = typeof block_height_raw === "number" ? block_height_raw : Number(block_height_raw);
|
|
47
|
+
if (!user_id) throw new Error("Missing vrf_data.user_id");
|
|
48
|
+
if (!rp_id) throw new Error("Missing vrf_data.rp_id");
|
|
49
|
+
if (!Number.isFinite(block_height) || block_height <= 0) throw new Error("Invalid vrf_data.block_height");
|
|
50
|
+
const base = {
|
|
51
|
+
vrf_input_data: normalizeU8ArrayLike(input.vrf_input_data, "vrf_data.vrf_input_data"),
|
|
52
|
+
vrf_output: normalizeU8ArrayLike(input.vrf_output, "vrf_data.vrf_output"),
|
|
53
|
+
vrf_proof: normalizeU8ArrayLike(input.vrf_proof, "vrf_data.vrf_proof"),
|
|
54
|
+
public_key: normalizeU8ArrayLike(input.public_key, "vrf_data.public_key"),
|
|
55
|
+
user_id,
|
|
56
|
+
rp_id,
|
|
57
|
+
block_height,
|
|
58
|
+
block_hash: normalizeU8ArrayLike(input.block_hash, "vrf_data.block_hash"),
|
|
59
|
+
intent_digest_32: normalizeU8ArrayLike(input.intent_digest_32, "vrf_data.intent_digest_32")
|
|
60
|
+
};
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(input, "session_policy_digest_32")) {
|
|
62
|
+
const v = input.session_policy_digest_32;
|
|
63
|
+
if (v != null) base.session_policy_digest_32 = normalizeU8ArrayLike(v, "vrf_data.session_policy_digest_32");
|
|
64
|
+
}
|
|
65
|
+
return base;
|
|
66
|
+
}
|
|
22
67
|
const SIGNER_WASM_MAIN_PATH = "../../wasm_signer_worker/pkg/wasm_signer_worker_bg.wasm";
|
|
23
68
|
const SIGNER_WASM_FALLBACK_PATH = "../../../workers/wasm_signer_worker_bg.wasm";
|
|
24
69
|
function getSignerWasmUrls(logger) {
|
|
@@ -327,18 +372,16 @@ var AuthService = class {
|
|
|
327
372
|
return this.queueTransaction(async () => {
|
|
328
373
|
try {
|
|
329
374
|
if (!isValidAccountId(request.new_account_id)) throw new Error(`Invalid account ID format: ${request.new_account_id}`);
|
|
330
|
-
this.logger.info(`Checking if account ${request.new_account_id} already exists...`);
|
|
331
|
-
const accountExists = await this.checkAccountExists(request.new_account_id);
|
|
332
|
-
if (accountExists) throw new Error(`Account ${request.new_account_id} already exists. Cannot create duplicate account.`);
|
|
333
|
-
this.logger.info(`Account ${request.new_account_id} is available for atomic creation and registration`);
|
|
334
375
|
this.logger.info(`Registering account: ${request.new_account_id}`);
|
|
335
376
|
this.logger.info(`Contract: ${this.config.webAuthnContractId}`);
|
|
377
|
+
const vrf_data = normalizeContractVrfDataForContract(request.vrf_data);
|
|
378
|
+
const deterministic_vrf_public_key = normalizeU8ArrayLike(request.deterministic_vrf_public_key, "deterministic_vrf_public_key");
|
|
336
379
|
const contractArgs = {
|
|
337
380
|
new_account_id: request.new_account_id,
|
|
338
381
|
new_public_key: request.new_public_key,
|
|
339
|
-
vrf_data
|
|
382
|
+
vrf_data,
|
|
340
383
|
webauthn_registration: request.webauthn_registration,
|
|
341
|
-
deterministic_vrf_public_key
|
|
384
|
+
deterministic_vrf_public_key,
|
|
342
385
|
authenticator_options: request.authenticator_options
|
|
343
386
|
};
|
|
344
387
|
const actions = [{
|