@tatchi-xyz/sdk 0.31.0 → 0.32.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/README.md +2 -0
- 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 +107 -63
- package/dist/cjs/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/cjs/core/WalletIframe/client/on-events-progress-bus.js +1 -1
- package/dist/cjs/core/WalletIframe/client/on-events-progress-bus.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/core/types/sdkSentEvents.js +3 -2
- package/dist/cjs/core/types/sdkSentEvents.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/context/useTatchiWithSdkFlow.js +1 -1
- package/dist/cjs/react/context/useTatchiWithSdkFlow.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 +107 -63
- package/dist/cjs/react/src/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/cjs/react/src/core/WalletIframe/client/on-events-progress-bus.js +1 -1
- package/dist/cjs/react/src/core/WalletIframe/client/on-events-progress-bus.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/react/src/core/types/sdkSentEvents.js +3 -2
- package/dist/cjs/react/src/core/types/sdkSentEvents.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 +107 -63
- package/dist/esm/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/esm/core/WalletIframe/client/on-events-progress-bus.js +1 -1
- package/dist/esm/core/WalletIframe/client/on-events-progress-bus.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/core/types/sdkSentEvents.js +3 -2
- package/dist/esm/core/types/sdkSentEvents.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/context/useTatchiWithSdkFlow.js +1 -1
- package/dist/esm/react/context/useTatchiWithSdkFlow.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 +107 -63
- package/dist/esm/react/src/core/TatchiPasskey/registration.js.map +1 -1
- package/dist/esm/react/src/core/WalletIframe/client/on-events-progress-bus.js +1 -1
- package/dist/esm/react/src/core/WalletIframe/client/on-events-progress-bus.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/src/core/types/sdkSentEvents.js +3 -2
- package/dist/esm/react/src/core/types/sdkSentEvents.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/{delegateAction-DdkvFFKA.js → delegateAction-Bq5zkOvn.js} +1 -1
- package/dist/esm/sdk/{emailRecovery-4J-g9tlY.js → emailRecovery-B1hbE_sM.js} +6 -6
- 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-CRPf5aW2.js} +5 -5
- 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-DUIWZHp_.js} +4 -4
- package/dist/esm/sdk/offline-export-app.js +32 -21
- 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/{relay-Dq9D7fhG.js → relay-BCEyWFew.js} +1 -1
- package/dist/esm/sdk/{router-BEGGuWaB.js → router-Cj2WexK-.js} +3 -3
- package/dist/esm/sdk/{rpcCalls-CMzj_Va_.js → rpcCalls-C1sp-Epo.js} +3 -3
- package/dist/esm/sdk/{rpcCalls-B44MZora.js → rpcCalls-VL4loDKP.js} +2 -2
- package/dist/esm/sdk/{scanDevice-Cp-r-Z2T.js → scanDevice-C0HcnZym.js} +5 -5
- package/dist/esm/sdk/{sdkSentEvents-CzAZBFjP.js → sdkSentEvents-BfkcI7EN.js} +3 -2
- package/dist/esm/sdk/{signNEP413-DsyWH_Jo.js → signNEP413-lj0swHsD.js} +1 -1
- package/dist/esm/sdk/{syncAccount-CqWCmBVb.js → syncAccount-DnQ9AstS.js} +5 -5
- package/dist/esm/sdk/{syncAccount-Dt5jJbEB.js → syncAccount-xh81Vppo.js} +3 -3
- 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 +160 -105
- 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/core/types/sdkSentEvents.d.ts +18 -7
- package/dist/types/src/core/types/sdkSentEvents.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/wasm_vrf_worker_bg.wasm +0 -0
- package/package.json +4 -4
- 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,9 +4,9 @@ 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-DUIWZHp_.js";
|
|
8
8
|
import { validateVRFChallenge } from "./vrf-worker-BzQsJ5BW.js";
|
|
9
|
-
import { ActionPhase, ActionStatus, RegistrationPhase, RegistrationStatus } from "./sdkSentEvents-
|
|
9
|
+
import { ActionPhase, ActionStatus, RegistrationPhase, RegistrationStatus } from "./sdkSentEvents-BfkcI7EN.js";
|
|
10
10
|
import { BUILD_PATHS, SIGNER_WORKER_MANAGER_CONFIG } from "./config-BbNXtVtu.js";
|
|
11
11
|
import { toAccountId } from "./accountIds-DVDhXwVA.js";
|
|
12
12
|
import { computeThresholdEd25519KeygenIntentDigest, computeUiIntentDigestFromTxs, orderActionForDigest } from "./intentDigest-yivVENNK.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-VL4loDKP.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-xh81Vppo.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,10 +6953,10 @@ 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
|
-
step:
|
|
6956
|
-
phase: RegistrationPhase.
|
|
6958
|
+
step: 8,
|
|
6959
|
+
phase: RegistrationPhase.STEP_8_DATABASE_STORAGE,
|
|
6957
6960
|
status: RegistrationStatus.PROGRESS,
|
|
6958
6961
|
message: "Storing passkey wallet metadata..."
|
|
6959
6962
|
});
|
|
@@ -6967,36 +6970,17 @@ async function registerPasskeyInternal(context, nearAccountId, options, authenti
|
|
|
6967
6970
|
});
|
|
6968
6971
|
registrationState.databaseStored = true;
|
|
6969
6972
|
onEvent?.({
|
|
6970
|
-
step:
|
|
6971
|
-
phase: RegistrationPhase.
|
|
6973
|
+
step: 8,
|
|
6974
|
+
phase: RegistrationPhase.STEP_8_DATABASE_STORAGE,
|
|
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,19 +6988,52 @@ 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
|
}
|
|
7017
7034
|
onEvent?.({
|
|
7018
|
-
step:
|
|
7019
|
-
phase: RegistrationPhase.
|
|
7035
|
+
step: 9,
|
|
7036
|
+
phase: RegistrationPhase.STEP_9_REGISTRATION_COMPLETE,
|
|
7020
7037
|
status: RegistrationStatus.SUCCESS,
|
|
7021
7038
|
message: "Registration completed!"
|
|
7022
7039
|
});
|
|
@@ -7143,8 +7160,31 @@ async function activateThresholdEnrollmentPostRegistration(opts) {
|
|
|
7143
7160
|
const relayerKeyId = String(opts.relayerKeyId || "").trim();
|
|
7144
7161
|
const clientVerifyingShareB64u = String(opts.thresholdClientVerifyingShareB64u || "").trim();
|
|
7145
7162
|
const relayerVerifyingShareB64u = String(opts.relayerVerifyingShareB64u || "").trim();
|
|
7146
|
-
|
|
7163
|
+
const emitThresholdKeyEnrollmentResult = (input) => {
|
|
7164
|
+
opts.onEvent?.({
|
|
7165
|
+
step: 7,
|
|
7166
|
+
phase: RegistrationPhase.STEP_7_THRESHOLD_KEY_ENROLLMENT,
|
|
7167
|
+
status: RegistrationStatus.SUCCESS,
|
|
7168
|
+
message: input.message,
|
|
7169
|
+
thresholdKeyReady: input.thresholdKeyReady,
|
|
7170
|
+
thresholdPublicKey: thresholdPublicKey || void 0,
|
|
7171
|
+
relayerKeyId: relayerKeyId || void 0,
|
|
7172
|
+
deviceNumber: 1,
|
|
7173
|
+
warning: input.warning
|
|
7174
|
+
});
|
|
7175
|
+
};
|
|
7176
|
+
const missingEnrollmentDetails = [];
|
|
7177
|
+
if (!thresholdPublicKey) missingEnrollmentDetails.push("thresholdPublicKey");
|
|
7178
|
+
if (!relayerKeyId) missingEnrollmentDetails.push("relayerKeyId");
|
|
7179
|
+
if (!clientVerifyingShareB64u) missingEnrollmentDetails.push("clientVerifyingShareB64u");
|
|
7180
|
+
if (!relayerVerifyingShareB64u) missingEnrollmentDetails.push("relayerVerifyingShareB64u");
|
|
7181
|
+
if (missingEnrollmentDetails.length) {
|
|
7147
7182
|
console.warn("[Registration] threshold-signer requested but threshold enrollment details are missing; continuing with local-signer only");
|
|
7183
|
+
emitThresholdKeyEnrollmentResult({
|
|
7184
|
+
thresholdKeyReady: false,
|
|
7185
|
+
message: "Threshold key not ready; continuing with local-signer only",
|
|
7186
|
+
warning: `Missing threshold enrollment details: ${missingEnrollmentDetails.join(", ")}`
|
|
7187
|
+
});
|
|
7148
7188
|
return;
|
|
7149
7189
|
}
|
|
7150
7190
|
try {
|
|
@@ -7171,7 +7211,11 @@ async function activateThresholdEnrollmentPostRegistration(opts) {
|
|
|
7171
7211
|
const signedTx = signed?.signedTransaction;
|
|
7172
7212
|
if (!signedTx) throw new Error("Failed to sign AddKey(thresholdPublicKey) transaction");
|
|
7173
7213
|
await opts.nearClient.sendTransaction(signedTx, DEFAULT_WAIT_STATUS.thresholdAddKey);
|
|
7174
|
-
const thresholdKeyVerified = await verifyAccountAccessKeysPresent(opts.nearClient, opts.nearAccountId, [opts.nearPublicKey, thresholdPublicKey]
|
|
7214
|
+
const thresholdKeyVerified = await verifyAccountAccessKeysPresent(opts.nearClient, opts.nearAccountId, [opts.nearPublicKey, thresholdPublicKey], {
|
|
7215
|
+
attempts: 6,
|
|
7216
|
+
delayMs: 250,
|
|
7217
|
+
finality: "optimistic"
|
|
7218
|
+
});
|
|
7175
7219
|
if (!thresholdKeyVerified) throw new Error("Threshold access key not found on-chain after AddKey");
|
|
7176
7220
|
await IndexedDBManager.nearKeysDB.storeKeyMaterial({
|
|
7177
7221
|
kind: "threshold_ed25519_2p_v1",
|
|
@@ -7198,8 +7242,18 @@ async function activateThresholdEnrollmentPostRegistration(opts) {
|
|
|
7198
7242
|
status: RegistrationStatus.SUCCESS,
|
|
7199
7243
|
message: "Threshold access key activated on-chain"
|
|
7200
7244
|
});
|
|
7245
|
+
emitThresholdKeyEnrollmentResult({
|
|
7246
|
+
thresholdKeyReady: true,
|
|
7247
|
+
message: "Threshold key ready"
|
|
7248
|
+
});
|
|
7201
7249
|
} catch (e) {
|
|
7250
|
+
const warning = e && typeof e === "object" && "message" in e ? String(e.message || "") : String(e || "");
|
|
7202
7251
|
console.warn("[Registration] threshold enrollment activation failed; continuing with local-signer only:", e);
|
|
7252
|
+
emitThresholdKeyEnrollmentResult({
|
|
7253
|
+
thresholdKeyReady: false,
|
|
7254
|
+
message: "Threshold key not ready; continuing with local-signer only",
|
|
7255
|
+
warning
|
|
7256
|
+
});
|
|
7203
7257
|
}
|
|
7204
7258
|
}
|
|
7205
7259
|
async function verifyAccountAccessKeysPresent(nearClient$1, nearAccountId, expectedPublicKeys, opts) {
|
|
@@ -7207,14 +7261,15 @@ async function verifyAccountAccessKeysPresent(nearClient$1, nearAccountId, expec
|
|
|
7207
7261
|
if (!unique.length) return false;
|
|
7208
7262
|
const attempts = Math.max(1, Math.floor(opts?.attempts ?? 6));
|
|
7209
7263
|
const delayMs = Math.max(50, Math.floor(opts?.delayMs ?? 750));
|
|
7264
|
+
const finality = opts?.finality ?? "optimistic";
|
|
7210
7265
|
for (let i = 0; i < attempts; i++) {
|
|
7211
7266
|
try {
|
|
7212
|
-
const
|
|
7213
|
-
const keys =
|
|
7267
|
+
const accessKeyList = await nearClient$1.viewAccessKeyList(nearAccountId, { finality });
|
|
7268
|
+
const keys = accessKeyList.keys.map((k) => ensureEd25519Prefix(k.public_key)).filter(Boolean);
|
|
7214
7269
|
const allPresent = unique.every((expected) => keys.includes(expected));
|
|
7215
7270
|
if (allPresent) return true;
|
|
7216
7271
|
} catch {}
|
|
7217
|
-
await new Promise((res) => setTimeout(res, delayMs));
|
|
7272
|
+
if (i < attempts - 1) await new Promise((res) => setTimeout(res, delayMs));
|
|
7218
7273
|
}
|
|
7219
7274
|
return false;
|
|
7220
7275
|
}
|
|
@@ -7307,7 +7362,7 @@ var TatchiPasskey = class {
|
|
|
7307
7362
|
} catch {}
|
|
7308
7363
|
if (!this.iframeRouter) {
|
|
7309
7364
|
if (!this.walletIframeInitInFlight) this.walletIframeInitInFlight = (async () => {
|
|
7310
|
-
const { WalletIframeRouter } = await import("./router-
|
|
7365
|
+
const { WalletIframeRouter } = await import("./router-Cj2WexK-.js");
|
|
7311
7366
|
this.iframeRouter = new WalletIframeRouter({
|
|
7312
7367
|
walletOrigin,
|
|
7313
7368
|
servicePath: walletIframeConfig?.walletServicePath || "/wallet-service",
|
|
@@ -8040,7 +8095,7 @@ var TatchiPasskey = class {
|
|
|
8040
8095
|
await options?.afterCall?.(false);
|
|
8041
8096
|
throw e;
|
|
8042
8097
|
}
|
|
8043
|
-
const { signDelegateAction: signDelegateAction$1 } = await import("./delegateAction-
|
|
8098
|
+
const { signDelegateAction: signDelegateAction$1 } = await import("./delegateAction-Bq5zkOvn.js");
|
|
8044
8099
|
return signDelegateAction$1({
|
|
8045
8100
|
context: this.getContext(),
|
|
8046
8101
|
nearAccountId: toAccountId(nearAccountId),
|
|
@@ -8056,7 +8111,7 @@ var TatchiPasskey = class {
|
|
|
8056
8111
|
const base = args.relayerUrl.replace(/\/+$/, "");
|
|
8057
8112
|
const route = (this.configs.relayer?.delegateActionRoute || "/signed-delegate").replace(/^\/?/, "/");
|
|
8058
8113
|
const endpoint = `${base}${route}`;
|
|
8059
|
-
const { sendDelegateActionViaRelayer } = await import("./relay-
|
|
8114
|
+
const { sendDelegateActionViaRelayer } = await import("./relay-BCEyWFew.js");
|
|
8060
8115
|
return sendDelegateActionViaRelayer({
|
|
8061
8116
|
url: endpoint,
|
|
8062
8117
|
payload: {
|
|
@@ -8172,7 +8227,7 @@ var TatchiPasskey = class {
|
|
|
8172
8227
|
await args.options?.afterCall?.(false);
|
|
8173
8228
|
throw e;
|
|
8174
8229
|
}
|
|
8175
|
-
const { signNEP413Message } = await import("./signNEP413-
|
|
8230
|
+
const { signNEP413Message } = await import("./signNEP413-lj0swHsD.js");
|
|
8176
8231
|
const res = await signNEP413Message({
|
|
8177
8232
|
context: this.getContext(),
|
|
8178
8233
|
nearAccountId: toAccountId(args.nearAccountId),
|
|
@@ -8281,8 +8336,8 @@ var TatchiPasskey = class {
|
|
|
8281
8336
|
return await router.getRecoveryEmails(nearAccountId);
|
|
8282
8337
|
}
|
|
8283
8338
|
const accountId = toAccountId(nearAccountId);
|
|
8284
|
-
const { getRecoveryEmailHashesContractCall } = await import("./rpcCalls-
|
|
8285
|
-
const { getLocalRecoveryEmails, bytesToHex } = await import("./EmailRecovery-
|
|
8339
|
+
const { getRecoveryEmailHashesContractCall } = await import("./rpcCalls-C1sp-Epo.js");
|
|
8340
|
+
const { getLocalRecoveryEmails, bytesToHex } = await import("./EmailRecovery-Y7rurd4B.js");
|
|
8286
8341
|
const rawHashes = await getRecoveryEmailHashesContractCall(this.nearClient, accountId);
|
|
8287
8342
|
if (!rawHashes.length) return [];
|
|
8288
8343
|
let local = [];
|
|
@@ -8329,8 +8384,8 @@ var TatchiPasskey = class {
|
|
|
8329
8384
|
throw e;
|
|
8330
8385
|
}
|
|
8331
8386
|
const accountId = toAccountId(nearAccountId);
|
|
8332
|
-
const { prepareRecoveryEmails } = await import("./EmailRecovery-
|
|
8333
|
-
const { buildSetRecoveryEmailsActions } = await import("./rpcCalls-
|
|
8387
|
+
const { prepareRecoveryEmails } = await import("./EmailRecovery-Y7rurd4B.js");
|
|
8388
|
+
const { buildSetRecoveryEmailsActions } = await import("./rpcCalls-C1sp-Epo.js");
|
|
8334
8389
|
const { hashes: recoveryEmailHashes } = await prepareRecoveryEmails(accountId, recoveryEmails);
|
|
8335
8390
|
const actions = await buildSetRecoveryEmailsActions(this.nearClient, accountId, recoveryEmailHashes, this.configs.emailRecoveryContracts);
|
|
8336
8391
|
return this.executeAction({
|
|
@@ -8361,7 +8416,7 @@ var TatchiPasskey = class {
|
|
|
8361
8416
|
throw e;
|
|
8362
8417
|
}
|
|
8363
8418
|
try {
|
|
8364
|
-
const { SyncAccountFlow } = await import("./syncAccount-
|
|
8419
|
+
const { SyncAccountFlow } = await import("./syncAccount-DnQ9AstS.js");
|
|
8365
8420
|
const flow = new SyncAccountFlow(this.getContext(), options);
|
|
8366
8421
|
const discovered = await flow.discover(accountIdInput || "");
|
|
8367
8422
|
if (!Array.isArray(discovered) || discovered.length === 0) {
|
|
@@ -8391,7 +8446,7 @@ var TatchiPasskey = class {
|
|
|
8391
8446
|
}
|
|
8392
8447
|
}
|
|
8393
8448
|
async ensureEmailRecoveryFlow(options) {
|
|
8394
|
-
const { EmailRecoveryFlow } = await import("./emailRecovery-
|
|
8449
|
+
const { EmailRecoveryFlow } = await import("./emailRecovery-B1hbE_sM.js");
|
|
8395
8450
|
if (!this.activeEmailRecoveryFlow) this.activeEmailRecoveryFlow = new EmailRecoveryFlow(this.getContext(), options);
|
|
8396
8451
|
else if (options) this.activeEmailRecoveryFlow.setOptions(options);
|
|
8397
8452
|
return this.activeEmailRecoveryFlow;
|
|
@@ -8485,7 +8540,7 @@ var TatchiPasskey = class {
|
|
|
8485
8540
|
});
|
|
8486
8541
|
}
|
|
8487
8542
|
this.activeDeviceLinkFlow?.cancel();
|
|
8488
|
-
const { LinkDeviceFlow } = await import("./linkDevice-
|
|
8543
|
+
const { LinkDeviceFlow } = await import("./linkDevice-CRPf5aW2.js");
|
|
8489
8544
|
const flow = new LinkDeviceFlow(this.getContext(), {
|
|
8490
8545
|
cameraId: args?.cameraId,
|
|
8491
8546
|
options: args?.options
|
|
@@ -8538,7 +8593,7 @@ var TatchiPasskey = class {
|
|
|
8538
8593
|
});
|
|
8539
8594
|
return res;
|
|
8540
8595
|
}
|
|
8541
|
-
const { linkDeviceWithScannedQRData } = await import("./scanDevice-
|
|
8596
|
+
const { linkDeviceWithScannedQRData } = await import("./scanDevice-C0HcnZym.js");
|
|
8542
8597
|
return linkDeviceWithScannedQRData(this.getContext(), qrData, options);
|
|
8543
8598
|
}
|
|
8544
8599
|
/**
|
|
@@ -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 = [{
|