@seams/wallet-server 0.7.1 → 0.7.3
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/THIRD_PARTY_NOTICES.md +1 -105
- package/artifact-manifest.json +21 -21
- package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/deriver-a/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/deriver-b/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/deriver-b/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/local-tools/darwin-arm64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/local-tools/darwin-x64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/local-tools/linux-x64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/router/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/router/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/signing-worker/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/signing-worker/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/tenant-root-control-plane/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/tenant-root-control-plane/index_bg.wasm +0 -0
- package/dist/esm/authorization/service.js +8 -0
- package/dist/esm/authorization/vaultProxyUse.js +2 -6
- package/dist/esm/cloud-host.js +4 -4
- package/dist/esm/core/IdentityStore.js +23 -110
- package/dist/esm/core/SessionService.js +7 -30
- package/dist/esm/core/ThresholdService/routerAbNormalSigningPolicy.js +3 -10
- package/dist/esm/core/ThresholdService/stores/WalletSessionStore.js +21 -97
- package/dist/esm/core/ThresholdService/stores/exportReplayGuard.js +7 -0
- package/dist/esm/core/WalletStore.js +4 -6
- package/dist/esm/core/authService/bytes.js +1 -4
- package/dist/esm/core/authService/emailOtpChallengeOperations.js +2 -5
- package/dist/esm/core/authService/emailOtpChallengeProof.js +9 -40
- package/dist/esm/core/authService/emailOtpChallengeVerification.js +19 -90
- package/dist/esm/core/authService/emailOtpChallenges.js +10 -45
- package/dist/esm/core/authService/emailOtpDelivery.js +10 -45
- package/dist/esm/core/authService/emailOtpEnrollment.js +9 -40
- package/dist/esm/core/authService/emailOtpGrant.js +9 -40
- package/dist/esm/core/authService/emailOtpRegistrationEnrollment.js +9 -40
- package/dist/esm/core/authService/emailOtpSeal.js +5 -20
- package/dist/esm/core/authService/emailOtpUnlock.js +20 -110
- package/dist/esm/core/authService/googleEmailOtpRegistration.js +28 -115
- package/dist/esm/core/authService/identity.js +5 -20
- package/dist/esm/core/authService/nearPublicKeyMetadata.js +6 -25
- package/dist/esm/core/authService/oidcVerification.js +22 -34
- package/dist/esm/core/authService/rateLimits.js +2 -5
- package/dist/esm/core/authService/thresholdEcdsaKeyInventory.js +2 -1
- package/dist/esm/core/authService/webauthn.js +37 -191
- package/dist/esm/core/authService/webauthnVerificationOutcomes.js +5 -24
- package/dist/esm/core/d1EcdsaSignerRead.js +76 -0
- package/dist/esm/core/d1IdentityStore.js +16 -75
- package/dist/esm/core/d1TenantStore.js +1 -1
- package/dist/esm/core/d1WalletStore.js +15 -25
- package/dist/esm/core/deviceLinking/linkedDeviceEmailOtpGrant.js +1 -5
- package/dist/esm/core/deviceLinking/linkedDeviceSessionApproval.js +1 -3
- package/dist/esm/core/deviceLinking/linkedDeviceSessionRecord.js +2 -8
- package/dist/esm/core/deviceLinking/requestProof.js +13 -4
- package/dist/esm/core/ecdsaMaterialReadSnapshot.js +85 -0
- package/dist/esm/core/nearRelayerAccountProvisioning.js +2 -5
- package/dist/esm/core/signingLanes/WalletExecutionLaneProjection.js +3 -6
- package/dist/esm/core/signingMaterial/ordinaryInactiveSignerMaterialReservation.js +2 -5
- package/dist/esm/core/storeBackends.js +1 -1
- package/dist/esm/core/thresholdEcdsaChainTarget.js +1 -3
- package/dist/esm/hosted-wallet-gateway.js +2 -2
- package/dist/esm/localHostedWalletGatewayHandler.js +13 -0
- package/dist/esm/localIntendedMaterialAdmissionFault.js +176 -0
- package/dist/esm/localIntendedPresignCancellation.js +44 -0
- package/dist/esm/router/auth/commonRouterUtils.js +24 -10
- package/dist/esm/router/auth/walletSessionFailure.js +2 -5
- package/dist/esm/router/auth/webAuthnCredentialCodecs.js +4 -15
- package/dist/esm/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.js +1 -0
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthBoundary.js +2 -6
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +5 -27
- package/dist/esm/router/cloudflare/d1/auth/walletSessionCredentialReaders.js +76 -0
- package/dist/esm/router/cloudflare/d1/authorization/authorizedOperationStatements.js +28 -21
- package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +209 -44
- package/dist/esm/router/cloudflare/d1/authorization/d1VaultProxyStore.js +8 -12
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js +50 -8
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/index.js +3 -3
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.js +12 -55
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeService.js +17 -80
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpDeliveryRuntime.js +6 -25
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.js +12 -47
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +24 -85
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +7 -30
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpServerSealRuntime.js +5 -20
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +23 -110
- package/dist/esm/router/cloudflare/d1/identity/d1IdentityService.js +9 -40
- package/dist/esm/router/cloudflare/d1/near/d1NearPublicKeyStore.js +3 -10
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcBoundary.js +18 -91
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcVerificationService.js +6 -30
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.js +4 -15
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +2 -7
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.js +9 -13
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js +11 -50
- package/dist/esm/router/cloudflare/d1/registration/d1EvmFamilyEcdsaRegistrationBranch.js +5 -20
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.js +4 -7
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +2 -1
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationIntentService.js +7 -30
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +32 -22
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js +1 -4
- package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js +119 -25
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.js +31 -168
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnRecords.js +6 -9
- package/dist/esm/router/cloudflare/durableObjects/thresholdStore.js +59 -66
- package/dist/esm/router/cloudflare/runtime/routerAbPrewarm.js +2 -2
- package/dist/esm/router/cloudflare/runtime/staticWalletConsoleBinding.js +5 -20
- package/dist/esm/router/cloudflare/runtime/tenantRootCreationGrant.js +2 -9
- package/dist/esm/router/cloudflare/runtime/walletControlOps.js +2 -1
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneCurveExecution.js +2 -1
- package/dist/esm/router/cloudflare/signingLanes/cloudflareLaneProtocolCommitter.js +2 -2
- package/dist/esm/router/cloudflare.js +2146 -1802
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPersistence.js +5 -8
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.js +3 -6
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.js +6 -25
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationSideEffectBoundary.js +39 -55
- package/dist/esm/router/domains/emailOtp/emailOtpRouteHandlers.js +15 -62
- package/dist/esm/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.js +83 -74
- package/dist/esm/router/domains/signingOperations/routerAbNormalSigningAdmission.js +1 -0
- package/dist/esm/router/domains/signingOperations/routerAbOperationStepUp.js +1 -0
- package/dist/esm/router/domains/signingOperations/walletExecutionAdmission.js +1 -4
- package/dist/esm/router/domains/tenantRoot/tenantRootIdentityResolution.js +7 -13
- package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +41 -200
- package/dist/esm/router/express.js +317 -699
- package/dist/esm/router/framework/http.js +5 -1
- package/dist/esm/router/framework/runtimeSnapshotConsumer.js +8 -35
- package/dist/esm/router/transport/fetch/createFetchRouter.js +3 -6
- package/dist/esm/router/transport/fetch/routes/auth.js +9 -41
- package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +5 -22
- package/dist/esm/router/transport/fetch/routes/nearPublicKeys.js +4 -16
- package/dist/esm/router/transport/fetch/routes/sessions.js +1 -0
- package/dist/esm/router/transport/fetch/routes/syncAccount.js +8 -36
- package/dist/esm/router/transport/fetch/routes/thresholdEcdsa.js +27 -79
- package/dist/esm/router/transport/fetch/routes/walletExecutionLanePreflight.js +4 -1
- package/dist/esm/router/transport/fetch/routes/webauthnAuthenticators.js +4 -16
- package/dist/esm/shared-ts/src/authorization/walletSignerActivationEquality.js +12 -0
- package/dist/esm/shared-ts/src/device-linking/committedSignerPackages.js +2 -5
- package/dist/esm/shared-ts/src/device-linking/delegatedActivationPlan.js +1 -5
- package/dist/esm/shared-ts/src/device-linking/ed25519ExportRoot.js +12 -16
- package/dist/esm/shared-ts/src/device-linking/sourceContribution.js +5 -8
- package/dist/esm/shared-ts/src/passkey-custody/primitives.js +5 -1
- package/dist/esm/shared-ts/src/signing-lanes/ownerContinuity.js +4 -8
- package/dist/esm/shared-ts/src/tenant-root/tenantRootIdentifier.js +12 -0
- package/dist/esm/shared-ts/src/tenant-root/tenantRootIdentity.js +2 -9
- package/dist/esm/shared-ts/src/tenant-root/tenantRootOperationRecord.js +1 -4
- package/dist/esm/shared-ts/src/utils/ecdsaKeyFactsInventory.js +2 -4
- package/dist/esm/shared-ts/src/utils/ecdsaServerTiming.js +0 -1
- package/dist/esm/shared-ts/src/utils/emailOtpDomain.js +3 -1
- package/dist/esm/shared-ts/src/utils/exactKeys.js +17 -0
- package/dist/esm/shared-ts/src/utils/failure.js +20 -0
- package/dist/esm/shared-ts/src/utils/registrationIntent.js +3 -12
- package/dist/esm/shared-ts/src/utils/registrationSignerPlan.js +2 -5
- package/dist/esm/shared-ts/src/utils/routerAbEcdsaDerivation.js +1 -1
- package/dist/esm/shared-ts/src/utils/routerAbEd25519Yao.js +1 -1
- package/dist/esm/shared-ts/src/utils/thresholdEcdsaChainTarget.js +9 -0
- package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryCommittedProjection.js +1 -4
- package/dist/esm/threshold/session/signingSessionSeal/crypto/cipher.js +10 -32
- package/dist/esm/threshold/session/signingSessionSeal/idempotencyBackends.js +3 -3
- package/dist/esm/threshold/session/signingSessionSeal/idempotencyRecords.js +3 -9
- package/dist/esm/threshold/session/signingSessionSeal/service.js +8 -35
- package/dist/esm/threshold/session/signingSessionSeal/transport/express.js +18 -94
- package/dist/esm/threshold/session/signingSessionSeal/transport/fetch.js +6 -30
- package/dist/esm/threshold/session/signingSessionSeal/transport/shared.js +5 -20
- package/dist/esm/wasm/evm_crypto/pkg/evm_crypto_bg.wasm +0 -0
- package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
- package/dist/types/shared-ts/src/authorization/delegatedAuthority.d.ts +2 -1
- package/dist/types/shared-ts/src/authorization/walletSessionIssuance.d.ts +9 -2
- package/dist/types/shared-ts/src/authorization/walletSignerActivationEquality.d.ts +4 -0
- package/dist/types/shared-ts/src/device-linking/committedSignerPackages.d.ts +3 -4
- package/dist/types/shared-ts/src/device-linking/contracts.d.ts +5 -63
- package/dist/types/shared-ts/src/device-linking/sourceContribution.d.ts +2 -0
- package/dist/types/shared-ts/src/passkey-custody/custodyEnvelope.d.ts +5 -12
- package/dist/types/shared-ts/src/passkey-custody/primitives.d.ts +9 -0
- package/dist/types/shared-ts/src/signing-lanes/execution.d.ts +11 -1
- package/dist/types/shared-ts/src/signing-lanes/ids.d.ts +1 -10
- package/dist/types/shared-ts/src/signing-lanes/rotation.d.ts +3 -5
- package/dist/types/shared-ts/src/tenant-root/tenantRootIdentifier.d.ts +3 -0
- package/dist/types/shared-ts/src/tenant-root/tenantRootOperationRecord.d.ts +2 -1
- package/dist/types/shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap.d.ts +6 -0
- package/dist/types/shared-ts/src/threshold/signingRootScope.d.ts +1 -0
- package/dist/types/shared-ts/src/utils/ecdsaKeyFactsInventory.d.ts +2 -11
- package/dist/types/shared-ts/src/utils/eip1559TxWasmJson.d.ts +16 -0
- package/dist/types/shared-ts/src/utils/emailOtpDomain.d.ts +2 -0
- package/dist/types/shared-ts/src/utils/exactKeys.d.ts +11 -0
- package/dist/types/shared-ts/src/utils/failure.d.ts +12 -0
- package/dist/types/shared-ts/src/utils/jsonRpc.d.ts +3 -4
- package/dist/types/shared-ts/src/utils/nearRpcResults.d.ts +1 -0
- package/dist/types/shared-ts/src/utils/registrationAuthMethodInput.d.ts +3 -8
- package/dist/types/shared-ts/src/utils/registrationSignerPlan.d.ts +7 -19
- package/dist/types/shared-ts/src/utils/routerAbEcdsaDerivation.d.ts +3 -1
- package/dist/types/shared-ts/src/utils/routerAbEd25519Yao.d.ts +1 -0
- package/dist/types/shared-ts/src/utils/routerAbEd25519YaoDigests.d.ts +3 -4
- package/dist/types/shared-ts/src/utils/routerAbNormalSigningIdentity.d.ts +30 -8
- package/dist/types/shared-ts/src/utils/routerApiKeyAuth.d.ts +2 -0
- package/dist/types/shared-ts/src/utils/signingSessionSeal.d.ts +10 -11
- package/dist/types/shared-ts/src/utils/thresholdEcdsaChainTarget.d.ts +25 -0
- package/dist/types/shared-ts/src/utils/variant.d.ts +18 -0
- package/dist/types/shared-ts/src/utils/walletAuthMethodRecord.d.ts +3 -6
- package/dist/types/shared-ts/src/utils/webauthnDeviceInfo.d.ts +4 -2
- package/dist/types/shared-ts/src/wallet-recovery/recoveryEnvelopes.d.ts +3 -16
- package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryPreparation.d.ts +15 -0
- package/dist/types/shared-ts/src/wallet-recovery/walletRecoveryTarget.d.ts +3 -4
- package/dist/types/wallet-server/src/authorization/domain.d.ts +13 -2
- package/dist/types/wallet-server/src/authorization/ecdsaWalletSessionAdmission.d.ts +27 -3
- package/dist/types/wallet-server/src/authorization/service.d.ts +19 -0
- package/dist/types/wallet-server/src/core/ThresholdService/stores/SessionStore.d.ts +2 -2
- package/dist/types/wallet-server/src/core/ThresholdService/stores/WalletSessionStore.d.ts +1 -1
- package/dist/types/wallet-server/src/core/ThresholdService/stores/exportReplayGuard.d.ts +3 -0
- package/dist/types/wallet-server/src/core/ThresholdService/validation.d.ts +8 -101
- package/dist/types/wallet-server/src/core/WebAuthnAuthenticatorStore.d.ts +8 -0
- package/dist/types/wallet-server/src/core/authService/bytes.d.ts +0 -1
- package/dist/types/wallet-server/src/core/authService/emailOtpChallenges.d.ts +2 -10
- package/dist/types/wallet-server/src/core/authService/emailOtpSeal.d.ts +1 -1
- package/dist/types/wallet-server/src/core/authService/emailOtpUnlock.d.ts +3 -10
- package/dist/types/wallet-server/src/core/d1EcdsaSignerRead.d.ts +39 -0
- package/dist/types/wallet-server/src/core/d1WalletStore.d.ts +10 -0
- package/dist/types/wallet-server/src/core/deviceLinking/linkedDeviceSessionRecord.d.ts +3 -4
- package/dist/types/wallet-server/src/core/ecdsaMaterialReadSnapshot.d.ts +19 -0
- package/dist/types/wallet-server/src/core/routerAbSigning/RouterAbNormalSigningRuntime.d.ts +3 -5
- package/dist/types/wallet-server/src/core/rpcClients/near/NearClient.d.ts +1 -2
- package/dist/types/wallet-server/src/core/signingLanes/WalletExecutionLaneProjection.d.ts +2 -11
- package/dist/types/wallet-server/src/core/signingLanes/signingWorkerLaneMaterialIdentity.d.ts +2 -19
- package/dist/types/wallet-server/src/core/thresholdEcdsaChainTarget.d.ts +3 -11
- package/dist/types/wallet-server/src/core/types.d.ts +2 -6
- package/dist/types/wallet-server/src/localIntendedMaterialAdmissionFault.d.ts +38 -0
- package/dist/types/wallet-server/src/localIntendedPresignCancellation.d.ts +4 -0
- package/dist/types/wallet-server/src/router/auth/authRequestValidation.d.ts +4 -9
- package/dist/types/wallet-server/src/router/auth/commonRouterUtils.d.ts +15 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthBoundary.d.ts +0 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RouterApiAuthService.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/walletSessionCredentialReaders.d.ts +9 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/authorizedOperationStatements.d.ts +4 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/authorization/d1AuthorizationStore.d.ts +10 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.d.ts +19 -2
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionStore.d.ts +2 -6
- package/dist/types/wallet-server/src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.d.ts +5 -8
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpEnrollmentStore.d.ts +2 -8
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRateLimitStore.d.ts +2 -9
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.d.ts +5 -5
- package/dist/types/wallet-server/src/router/cloudflare/d1/emailOtp/d1EmailOtpServerSealRuntime.d.ts +4 -14
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecordStore.d.ts +2 -6
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationService.d.ts +8 -6
- package/dist/types/wallet-server/src/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.d.ts +14 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/webauthn/d1WebAuthnRecords.d.ts +10 -39
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletConsoleOps.d.ts +8 -34
- package/dist/types/wallet-server/src/router/domains/ecdsa/thresholdEcdsaRequestValidation.d.ts +3 -15
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/session/routerAbEd25519YaoWalletSession.d.ts +9 -50
- package/dist/types/wallet-server/src/router/domains/passkeyCustody/walletRecoveryKeyManifest.d.ts +1 -13
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.d.ts +8 -9
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbNormalSigningAdmission.d.ts +13 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbOperationStepUp.d.ts +3 -4
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbPrivateSigningWorker.d.ts +7 -16
- package/dist/types/wallet-server/src/router/domains/syncAccount/syncAccountRequestValidation.d.ts +2 -7
- package/dist/types/wallet-server/src/router/framework/apiCredentialPorts.d.ts +3 -1
- package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +25 -4
- package/dist/types/wallet-server/src/router/framework/http.d.ts +1 -0
- package/dist/types/wallet-server/src/router/framework/ror/normalize.d.ts +1 -9
- package/dist/types/wallet-server/src/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.d.ts +3 -6
- package/dist/types/wallet-server/src/router/transport/fetch/routes/syncAccountBootstrap.d.ts +3 -5
- package/dist/types/wallet-server/src/router/transport/fetch/routes/thresholdEcdsa.d.ts +0 -1
- package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/idempotencyRecords.d.ts +1 -2
- package/dist/types/wallet-server/src/threshold/session/signingSessionSeal/signingSessionSeal.types.d.ts +6 -8
- package/package.json +1 -1
- package/dist/esm/wasm/router_ab_ecdsa_signing_worker/pkg/router_ab_ecdsa_signing_worker_bg.wasm +0 -0
|
@@ -6,6 +6,7 @@ import { ROUTER_AB_ED25519_YAO_EMAIL_OTP_RECOVERY_BOOTSTRAP_KIND_V1 } from "../.
|
|
|
6
6
|
import { walletAuthAuthorityRef } from "../../../shared-ts/src/utils/walletAuthAuthority.js";
|
|
7
7
|
import { parseSessionOrigin, parseVerifiedOwnerProofId, projectActiveWalletSession } from "../../../authorization/domain.js";
|
|
8
8
|
import { buildVerifiedWalletSessionEmailOtpFactorResult, buildVerifiedWalletSessionPasskeyFactorResult } from "../../../authorization/factorEvidence.js";
|
|
9
|
+
import { failure } from "../../../shared-ts/src/utils/failure.js";
|
|
9
10
|
import { emailOtpFailureWebhookEventDescriptors, emailOtpLoggedInWebhookEventDescriptor } from "../emailOtp/emailOtpSessionRouteHelpers.js";
|
|
10
11
|
import { EMAIL_OTP_CHANNEL } from "../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
11
12
|
import { thresholdEd25519StatusCode } from "../../../threshold/statusCodes.js";
|
|
@@ -58,11 +59,7 @@ async function refreshEmailOtpWalletUnlockSessionState(input) {
|
|
|
58
59
|
ok: false,
|
|
59
60
|
response: {
|
|
60
61
|
status: 500,
|
|
61
|
-
body:
|
|
62
|
-
ok: false,
|
|
63
|
-
code: "internal",
|
|
64
|
-
message: error instanceof Error ? error.message : "Email OTP authority refresh resolution failed"
|
|
65
|
-
}
|
|
62
|
+
body: failure("internal", error instanceof Error ? error.message : "Email OTP authority refresh resolution failed")
|
|
66
63
|
}
|
|
67
64
|
};
|
|
68
65
|
}
|
|
@@ -70,11 +67,7 @@ async function refreshEmailOtpWalletUnlockSessionState(input) {
|
|
|
70
67
|
ok: false,
|
|
71
68
|
response: {
|
|
72
69
|
status: authorityResolution.code === "internal" ? 500 : 403,
|
|
73
|
-
body:
|
|
74
|
-
ok: false,
|
|
75
|
-
code: authorityResolution.code,
|
|
76
|
-
message: authorityResolution.message
|
|
77
|
-
}
|
|
70
|
+
body: failure(authorityResolution.code, authorityResolution.message)
|
|
78
71
|
}
|
|
79
72
|
};
|
|
80
73
|
try {
|
|
@@ -91,11 +84,7 @@ async function refreshEmailOtpWalletUnlockSessionState(input) {
|
|
|
91
84
|
ok: false,
|
|
92
85
|
response: {
|
|
93
86
|
status: 500,
|
|
94
|
-
body:
|
|
95
|
-
ok: false,
|
|
96
|
-
code: "internal",
|
|
97
|
-
message: error instanceof Error ? error.message : "Email OTP Wallet Session authority projection refresh failed"
|
|
98
|
-
}
|
|
87
|
+
body: failure("internal", error instanceof Error ? error.message : "Email OTP Wallet Session authority projection refresh failed")
|
|
99
88
|
}
|
|
100
89
|
};
|
|
101
90
|
}
|
|
@@ -106,11 +95,7 @@ function walletUnlockCustodyUnavailableResponse(lookup, factor) {
|
|
|
106
95
|
ok: false,
|
|
107
96
|
response: {
|
|
108
97
|
status: lookup.kind === "manifest_unavailable" ? 503 : lookup.kind === "conflict" ? 409 : lookup.kind === "missing" ? 404 : 409,
|
|
109
|
-
body: {
|
|
110
|
-
ok: false,
|
|
111
|
-
code: lookup.kind === "manifest_unavailable" ? "custody_manifest_unavailable" : "custody_envelope_unavailable",
|
|
112
|
-
message: `${factor} wallet custody is unavailable`
|
|
113
|
-
}
|
|
98
|
+
body: failure(lookup.kind === "manifest_unavailable" ? "custody_manifest_unavailable" : "custody_envelope_unavailable", `${factor} wallet custody is unavailable`)
|
|
114
99
|
}
|
|
115
100
|
};
|
|
116
101
|
}
|
|
@@ -125,11 +110,7 @@ function projectEmailOtpCustody(verifiedUnlock, lookup) {
|
|
|
125
110
|
ok: false,
|
|
126
111
|
response: {
|
|
127
112
|
status: 500,
|
|
128
|
-
body:
|
|
129
|
-
ok: false,
|
|
130
|
-
code: "custody_binding_mismatch",
|
|
131
|
-
message: "Email OTP wallet custody binding is invalid"
|
|
132
|
-
}
|
|
113
|
+
body: failure("custody_binding_mismatch", "Email OTP wallet custody binding is invalid")
|
|
133
114
|
}
|
|
134
115
|
};
|
|
135
116
|
return {
|
|
@@ -159,11 +140,7 @@ function projectPasskeyCustody(verifiedUnlock, resolution) {
|
|
|
159
140
|
ok: false,
|
|
160
141
|
response: {
|
|
161
142
|
status: 500,
|
|
162
|
-
body:
|
|
163
|
-
ok: false,
|
|
164
|
-
code: "custody_binding_mismatch",
|
|
165
|
-
message: "Passkey wallet custody binding is invalid"
|
|
166
|
-
}
|
|
143
|
+
body: failure("custody_binding_mismatch", "Passkey wallet custody binding is invalid")
|
|
167
144
|
}
|
|
168
145
|
};
|
|
169
146
|
let ed25519 = { kind: "absent" };
|
|
@@ -175,11 +152,7 @@ function projectPasskeyCustody(verifiedUnlock, resolution) {
|
|
|
175
152
|
ok: false,
|
|
176
153
|
response: {
|
|
177
154
|
status: 500,
|
|
178
|
-
body:
|
|
179
|
-
ok: false,
|
|
180
|
-
code: "custody_binding_mismatch",
|
|
181
|
-
message: "Passkey Ed25519 custody binding is invalid"
|
|
182
|
-
}
|
|
155
|
+
body: failure("custody_binding_mismatch", "Passkey Ed25519 custody binding is invalid")
|
|
183
156
|
}
|
|
184
157
|
};
|
|
185
158
|
ed25519 = {
|
|
@@ -210,11 +183,7 @@ async function provisionFirstEcdsaWalletSession(input) {
|
|
|
210
183
|
ok: false,
|
|
211
184
|
response: {
|
|
212
185
|
status: 403,
|
|
213
|
-
body:
|
|
214
|
-
ok: false,
|
|
215
|
-
code: "scope_mismatch",
|
|
216
|
-
message: "Wallet unlock proof does not match the requested ECDSA wallet"
|
|
217
|
-
}
|
|
186
|
+
body: failure("scope_mismatch", "Wallet unlock proof does not match the requested ECDSA wallet")
|
|
218
187
|
}
|
|
219
188
|
};
|
|
220
189
|
const provisioned = await input.context.provisionWalletSession(input.authorization);
|
|
@@ -222,11 +191,7 @@ async function provisionFirstEcdsaWalletSession(input) {
|
|
|
222
191
|
ok: false,
|
|
223
192
|
response: {
|
|
224
193
|
status: provisioned.status,
|
|
225
|
-
body:
|
|
226
|
-
ok: false,
|
|
227
|
-
code: provisioned.code,
|
|
228
|
-
message: provisioned.message
|
|
229
|
-
}
|
|
194
|
+
body: failure(provisioned.code, provisioned.message)
|
|
230
195
|
}
|
|
231
196
|
};
|
|
232
197
|
return {
|
|
@@ -254,11 +219,7 @@ function walletUnlockScopeMismatchResponse() {
|
|
|
254
219
|
ok: false,
|
|
255
220
|
response: {
|
|
256
221
|
status: 403,
|
|
257
|
-
body:
|
|
258
|
-
ok: false,
|
|
259
|
-
code: "scope_mismatch",
|
|
260
|
-
message: "Email OTP unlock proof does not match the requested Ed25519 wallet"
|
|
261
|
-
}
|
|
222
|
+
body: failure("scope_mismatch", "Email OTP unlock proof does not match the requested Ed25519 wallet")
|
|
262
223
|
}
|
|
263
224
|
};
|
|
264
225
|
}
|
|
@@ -322,11 +283,7 @@ function planWalletUnlockAuthorityEcdsaSession(input) {
|
|
|
322
283
|
function walletUnlockDeviceLinkEcdsaSessionRejection() {
|
|
323
284
|
return {
|
|
324
285
|
status: 400,
|
|
325
|
-
body:
|
|
326
|
-
ok: false,
|
|
327
|
-
code: "invalid_body",
|
|
328
|
-
message: "ecdsaSessionPolicy is not supported for device-linked wallet unlock"
|
|
329
|
-
}
|
|
286
|
+
body: failure("invalid_body", "ecdsaSessionPolicy is not supported for device-linked wallet unlock")
|
|
330
287
|
};
|
|
331
288
|
}
|
|
332
289
|
function planWalletUnlockPasskeySession(input) {
|
|
@@ -369,11 +326,7 @@ async function provisionPasskeyEd25519YaoSession(input) {
|
|
|
369
326
|
ok: false,
|
|
370
327
|
response: {
|
|
371
328
|
status: 409,
|
|
372
|
-
body:
|
|
373
|
-
ok: false,
|
|
374
|
-
code: "capability_unavailable",
|
|
375
|
-
message: "Requested Ed25519 Wallet Session is unavailable"
|
|
376
|
-
}
|
|
329
|
+
body: failure("capability_unavailable", "Requested Ed25519 Wallet Session is unavailable")
|
|
377
330
|
}
|
|
378
331
|
};
|
|
379
332
|
const provisioned = await input.context.provisionWalletSession({
|
|
@@ -427,11 +380,7 @@ function walletUnlockEcdsaOperationCredential(input) {
|
|
|
427
380
|
function walletUnlockEcdsaCredentialUnavailableResponse() {
|
|
428
381
|
return {
|
|
429
382
|
status: 409,
|
|
430
|
-
body:
|
|
431
|
-
ok: false,
|
|
432
|
-
code: "capability_unavailable",
|
|
433
|
-
message: "ECDSA activation requires the exact Wallet Session operation credential"
|
|
434
|
-
}
|
|
383
|
+
body: failure("capability_unavailable", "ECDSA activation requires the exact Wallet Session operation credential")
|
|
435
384
|
};
|
|
436
385
|
}
|
|
437
386
|
/** The unlock response's Wallet Session, when the unlock holds one. */
|
|
@@ -467,11 +416,7 @@ function parseWalletUnlockRouteBody(body) {
|
|
|
467
416
|
ok: false,
|
|
468
417
|
response: {
|
|
469
418
|
status: 400,
|
|
470
|
-
body:
|
|
471
|
-
ok: false,
|
|
472
|
-
code: "invalid_body",
|
|
473
|
-
message: "Request body is required"
|
|
474
|
-
}
|
|
419
|
+
body: failure("invalid_body", "Request body is required")
|
|
475
420
|
}
|
|
476
421
|
};
|
|
477
422
|
const record = body;
|
|
@@ -480,11 +425,7 @@ function parseWalletUnlockRouteBody(body) {
|
|
|
480
425
|
ok: false,
|
|
481
426
|
response: {
|
|
482
427
|
status: 400,
|
|
483
|
-
body:
|
|
484
|
-
ok: false,
|
|
485
|
-
code: "invalid_body",
|
|
486
|
-
message: "unlockBackend is required"
|
|
487
|
-
}
|
|
428
|
+
body: failure("invalid_body", "unlockBackend is required")
|
|
488
429
|
}
|
|
489
430
|
};
|
|
490
431
|
return {
|
|
@@ -501,11 +442,7 @@ async function handleWalletUnlockChallengeRoute(input) {
|
|
|
501
442
|
const walletAuthMethodId = parseRequiredWalletAuthMethodId(body.walletAuthMethodId);
|
|
502
443
|
if (!walletAuthMethodId.ok) return {
|
|
503
444
|
status: 400,
|
|
504
|
-
body:
|
|
505
|
-
ok: false,
|
|
506
|
-
code: "invalid_body",
|
|
507
|
-
message: walletAuthMethodId.message
|
|
508
|
-
}
|
|
445
|
+
body: failure("invalid_body", walletAuthMethodId.message)
|
|
509
446
|
};
|
|
510
447
|
}
|
|
511
448
|
const result = unlockBackend === "passkey" ? await input.service.createWebAuthnLoginOptions({
|
|
@@ -688,20 +625,12 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
688
625
|
const challengeId = String(body.challengeId || "").trim();
|
|
689
626
|
if (!challengeId) return {
|
|
690
627
|
status: 400,
|
|
691
|
-
body:
|
|
692
|
-
ok: false,
|
|
693
|
-
code: "invalid_body",
|
|
694
|
-
message: "challengeId is required"
|
|
695
|
-
}
|
|
628
|
+
body: failure("invalid_body", "challengeId is required")
|
|
696
629
|
};
|
|
697
630
|
if (unlockBackend === "passkey") {
|
|
698
631
|
if (input.capabilityContext.kind !== "passkey_unlock") return {
|
|
699
632
|
status: 400,
|
|
700
|
-
body:
|
|
701
|
-
ok: false,
|
|
702
|
-
code: "invalid_body",
|
|
703
|
-
message: "Passkey unlock context is invalid"
|
|
704
|
-
}
|
|
633
|
+
body: failure("invalid_body", "Passkey unlock context is invalid")
|
|
705
634
|
};
|
|
706
635
|
let ed25519SessionRequest;
|
|
707
636
|
try {
|
|
@@ -709,11 +638,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
709
638
|
} catch (error) {
|
|
710
639
|
return {
|
|
711
640
|
status: 400,
|
|
712
|
-
body:
|
|
713
|
-
ok: false,
|
|
714
|
-
code: "invalid_body",
|
|
715
|
-
message: error instanceof Error ? error.message : "Ed25519 session request is invalid"
|
|
716
|
-
}
|
|
641
|
+
body: failure("invalid_body", error instanceof Error ? error.message : "Ed25519 session request is invalid")
|
|
717
642
|
};
|
|
718
643
|
}
|
|
719
644
|
const result = await verifyPasskeyWalletUnlock({
|
|
@@ -732,11 +657,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
732
657
|
const userId = String(result.userId || "").trim();
|
|
733
658
|
if (!userId) return {
|
|
734
659
|
status: 500,
|
|
735
|
-
body:
|
|
736
|
-
ok: false,
|
|
737
|
-
code: "internal",
|
|
738
|
-
message: "Verified passkey user is missing"
|
|
739
|
-
}
|
|
660
|
+
body: failure("internal", "Verified passkey user is missing")
|
|
740
661
|
};
|
|
741
662
|
const walletId = parseWalletId(userId);
|
|
742
663
|
const walletAuthMethodId = parseWalletAuthMethodId(result.walletAuthMethodId);
|
|
@@ -745,11 +666,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
745
666
|
const credentialIdB64u = parseWebAuthnCredentialIdB64u(result.credentialIdB64u);
|
|
746
667
|
if (!walletId.ok || !walletAuthMethodId.ok || !walletAuthorityId.ok || !rpId.ok || !credentialIdB64u.ok) return {
|
|
747
668
|
status: 500,
|
|
748
|
-
body:
|
|
749
|
-
ok: false,
|
|
750
|
-
code: "internal",
|
|
751
|
-
message: "Verified passkey identity is invalid"
|
|
752
|
-
}
|
|
669
|
+
body: failure("internal", "Verified passkey identity is invalid")
|
|
753
670
|
};
|
|
754
671
|
let authorization;
|
|
755
672
|
try {
|
|
@@ -767,11 +684,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
767
684
|
} catch (error) {
|
|
768
685
|
return {
|
|
769
686
|
status: 403,
|
|
770
|
-
body:
|
|
771
|
-
ok: false,
|
|
772
|
-
code: "owner_proof_rejected",
|
|
773
|
-
message: error instanceof Error ? error.message : "Passkey owner proof is invalid"
|
|
774
|
-
}
|
|
687
|
+
body: failure("owner_proof_rejected", error instanceof Error ? error.message : "Passkey owner proof is invalid")
|
|
775
688
|
};
|
|
776
689
|
}
|
|
777
690
|
const resolvePasskeyAuthority = () => input.service.resolveActivePasskeyAuthorityForUnlock({
|
|
@@ -789,11 +702,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
789
702
|
} catch (error) {
|
|
790
703
|
return {
|
|
791
704
|
status: 500,
|
|
792
|
-
body:
|
|
793
|
-
ok: false,
|
|
794
|
-
code: "internal",
|
|
795
|
-
message: error instanceof Error ? error.message : "Passkey authority resolution failed"
|
|
796
|
-
}
|
|
705
|
+
body: failure("internal", error instanceof Error ? error.message : "Passkey authority resolution failed")
|
|
797
706
|
};
|
|
798
707
|
}
|
|
799
708
|
if (authorityResolution.kind === "active_authority") {
|
|
@@ -810,11 +719,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
810
719
|
switch (sessionPlan.kind) {
|
|
811
720
|
case "rejected": return {
|
|
812
721
|
status: walletUnlockIssuanceRejectionStatus(sessionPlan.authorityResolution),
|
|
813
|
-
body:
|
|
814
|
-
ok: false,
|
|
815
|
-
code: sessionPlan.authorityResolution.code,
|
|
816
|
-
message: sessionPlan.authorityResolution.message
|
|
817
|
-
}
|
|
722
|
+
body: failure(sessionPlan.authorityResolution.code, sessionPlan.authorityResolution.message)
|
|
818
723
|
};
|
|
819
724
|
case "wallet_registration":
|
|
820
725
|
passkeyCustodyRequired = true;
|
|
@@ -836,11 +741,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
836
741
|
} catch (error) {
|
|
837
742
|
return {
|
|
838
743
|
status: 500,
|
|
839
|
-
body:
|
|
840
|
-
ok: false,
|
|
841
|
-
code: "internal",
|
|
842
|
-
message: error instanceof Error ? error.message : "Passkey Wallet Session issuance failed"
|
|
843
|
-
}
|
|
744
|
+
body: failure("internal", error instanceof Error ? error.message : "Passkey Wallet Session issuance failed")
|
|
844
745
|
};
|
|
845
746
|
}
|
|
846
747
|
switch (sessionResolution.kind) {
|
|
@@ -861,11 +762,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
861
762
|
break;
|
|
862
763
|
case "rejected": return {
|
|
863
764
|
status: walletUnlockIssuanceRejectionStatus(sessionResolution),
|
|
864
|
-
body:
|
|
865
|
-
ok: false,
|
|
866
|
-
code: sessionResolution.code,
|
|
867
|
-
message: sessionResolution.message
|
|
868
|
-
}
|
|
765
|
+
body: failure(sessionResolution.code, sessionResolution.message)
|
|
869
766
|
};
|
|
870
767
|
}
|
|
871
768
|
break;
|
|
@@ -884,11 +781,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
884
781
|
} catch (error) {
|
|
885
782
|
return {
|
|
886
783
|
status: 503,
|
|
887
|
-
body:
|
|
888
|
-
ok: false,
|
|
889
|
-
code: "custody_unavailable",
|
|
890
|
-
message: error instanceof Error ? error.message : "Passkey wallet custody is unavailable"
|
|
891
|
-
}
|
|
784
|
+
body: failure("custody_unavailable", error instanceof Error ? error.message : "Passkey wallet custody is unavailable")
|
|
892
785
|
};
|
|
893
786
|
}
|
|
894
787
|
const ed25519Session = await provisionPasskeyEd25519YaoSession({
|
|
@@ -930,20 +823,12 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
930
823
|
} catch (error) {
|
|
931
824
|
return {
|
|
932
825
|
status: 500,
|
|
933
|
-
body:
|
|
934
|
-
ok: false,
|
|
935
|
-
code: "internal",
|
|
936
|
-
message: error instanceof Error ? error.message : "Passkey authority refresh resolution failed"
|
|
937
|
-
}
|
|
826
|
+
body: failure("internal", error instanceof Error ? error.message : "Passkey authority refresh resolution failed")
|
|
938
827
|
};
|
|
939
828
|
}
|
|
940
829
|
if (refreshedAuthority.kind === "rejected") return {
|
|
941
830
|
status: walletUnlockIssuanceRejectionStatus(refreshedAuthority),
|
|
942
|
-
body:
|
|
943
|
-
ok: false,
|
|
944
|
-
code: refreshedAuthority.code,
|
|
945
|
-
message: refreshedAuthority.message
|
|
946
|
-
}
|
|
831
|
+
body: failure(refreshedAuthority.code, refreshedAuthority.message)
|
|
947
832
|
};
|
|
948
833
|
try {
|
|
949
834
|
walletSessionState = await refreshWalletUnlockSessionState({
|
|
@@ -954,11 +839,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
954
839
|
} catch (error) {
|
|
955
840
|
return {
|
|
956
841
|
status: 500,
|
|
957
|
-
body:
|
|
958
|
-
ok: false,
|
|
959
|
-
code: "internal",
|
|
960
|
-
message: error instanceof Error ? error.message : "Passkey Wallet Session authority projection refresh failed"
|
|
961
|
-
}
|
|
842
|
+
body: failure("internal", error instanceof Error ? error.message : "Passkey Wallet Session authority projection refresh failed")
|
|
962
843
|
};
|
|
963
844
|
}
|
|
964
845
|
}
|
|
@@ -987,20 +868,12 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
987
868
|
}
|
|
988
869
|
if (input.capabilityContext.kind === "passkey_unlock") return {
|
|
989
870
|
status: 400,
|
|
990
|
-
body:
|
|
991
|
-
ok: false,
|
|
992
|
-
code: "invalid_body",
|
|
993
|
-
message: "Email OTP unlock context is invalid"
|
|
994
|
-
}
|
|
871
|
+
body: failure("invalid_body", "Email OTP unlock context is invalid")
|
|
995
872
|
};
|
|
996
873
|
const requestedWalletAuthMethodId = parseRequiredWalletAuthMethodId(body.walletAuthMethodId);
|
|
997
874
|
if (!requestedWalletAuthMethodId.ok) return {
|
|
998
875
|
status: 400,
|
|
999
|
-
body:
|
|
1000
|
-
ok: false,
|
|
1001
|
-
code: "invalid_body",
|
|
1002
|
-
message: requestedWalletAuthMethodId.message
|
|
1003
|
-
}
|
|
876
|
+
body: failure("invalid_body", requestedWalletAuthMethodId.message)
|
|
1004
877
|
};
|
|
1005
878
|
const result = await input.service.verifyEmailOtpUnlockProof({
|
|
1006
879
|
walletId: body.walletId,
|
|
@@ -1027,11 +900,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
1027
900
|
const walletId = parseWalletId(result.walletId);
|
|
1028
901
|
if (!walletId.ok) return {
|
|
1029
902
|
status: 500,
|
|
1030
|
-
body:
|
|
1031
|
-
ok: false,
|
|
1032
|
-
code: "internal",
|
|
1033
|
-
message: "Verified Email OTP wallet identity is invalid"
|
|
1034
|
-
}
|
|
903
|
+
body: failure("internal", "Verified Email OTP wallet identity is invalid")
|
|
1035
904
|
};
|
|
1036
905
|
let authorityResolution;
|
|
1037
906
|
try {
|
|
@@ -1044,20 +913,12 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
1044
913
|
} catch (error) {
|
|
1045
914
|
return {
|
|
1046
915
|
status: 500,
|
|
1047
|
-
body:
|
|
1048
|
-
ok: false,
|
|
1049
|
-
code: "internal",
|
|
1050
|
-
message: error instanceof Error ? error.message : "Email OTP authority resolution failed"
|
|
1051
|
-
}
|
|
916
|
+
body: failure("internal", error instanceof Error ? error.message : "Email OTP authority resolution failed")
|
|
1052
917
|
};
|
|
1053
918
|
}
|
|
1054
919
|
if (authorityResolution.kind === "rejected") return {
|
|
1055
920
|
status: authorityResolution.code === "internal" ? 500 : 403,
|
|
1056
|
-
body:
|
|
1057
|
-
ok: false,
|
|
1058
|
-
code: authorityResolution.code,
|
|
1059
|
-
message: authorityResolution.message
|
|
1060
|
-
}
|
|
921
|
+
body: failure(authorityResolution.code, authorityResolution.message)
|
|
1061
922
|
};
|
|
1062
923
|
const exactEmailOtpAuthority = authorityResolution;
|
|
1063
924
|
if (planWalletUnlockAuthorityEcdsaSession({
|
|
@@ -1091,11 +952,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
1091
952
|
} catch (error) {
|
|
1092
953
|
return {
|
|
1093
954
|
status: 403,
|
|
1094
|
-
body:
|
|
1095
|
-
ok: false,
|
|
1096
|
-
code: "owner_proof_rejected",
|
|
1097
|
-
message: error instanceof Error ? error.message : "Email OTP owner proof is invalid"
|
|
1098
|
-
}
|
|
955
|
+
body: failure("owner_proof_rejected", error instanceof Error ? error.message : "Email OTP owner proof is invalid")
|
|
1099
956
|
};
|
|
1100
957
|
}
|
|
1101
958
|
let walletSessionState = { kind: "absent" };
|
|
@@ -1103,11 +960,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
1103
960
|
const walletId = parseWalletId(result.walletId);
|
|
1104
961
|
if (!walletId.ok) return {
|
|
1105
962
|
status: 500,
|
|
1106
|
-
body:
|
|
1107
|
-
ok: false,
|
|
1108
|
-
code: "internal",
|
|
1109
|
-
message: "Verified Email OTP wallet identity is invalid"
|
|
1110
|
-
}
|
|
963
|
+
body: failure("internal", "Verified Email OTP wallet identity is invalid")
|
|
1111
964
|
};
|
|
1112
965
|
let sessionResolution;
|
|
1113
966
|
try {
|
|
@@ -1122,11 +975,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
1122
975
|
} catch (error) {
|
|
1123
976
|
return {
|
|
1124
977
|
status: 500,
|
|
1125
|
-
body:
|
|
1126
|
-
ok: false,
|
|
1127
|
-
code: "internal",
|
|
1128
|
-
message: error instanceof Error ? error.message : "Email OTP Wallet Session issuance failed"
|
|
1129
|
-
}
|
|
978
|
+
body: failure("internal", error instanceof Error ? error.message : "Email OTP Wallet Session issuance failed")
|
|
1130
979
|
};
|
|
1131
980
|
}
|
|
1132
981
|
switch (sessionResolution.kind) {
|
|
@@ -1144,11 +993,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
1144
993
|
case "wallet_registration": break;
|
|
1145
994
|
case "rejected": return {
|
|
1146
995
|
status: walletUnlockIssuanceRejectionStatus(sessionResolution),
|
|
1147
|
-
body:
|
|
1148
|
-
ok: false,
|
|
1149
|
-
code: sessionResolution.code,
|
|
1150
|
-
message: sessionResolution.message
|
|
1151
|
-
}
|
|
996
|
+
body: failure(sessionResolution.code, sessionResolution.message)
|
|
1152
997
|
};
|
|
1153
998
|
}
|
|
1154
999
|
}
|
|
@@ -1198,11 +1043,7 @@ async function handleWalletUnlockVerifyRoute(input) {
|
|
|
1198
1043
|
});
|
|
1199
1044
|
if (!isWalletUnlockEd25519YaoRequestedContext(input.capabilityContext)) return {
|
|
1200
1045
|
status: 400,
|
|
1201
|
-
body:
|
|
1202
|
-
ok: false,
|
|
1203
|
-
code: "invalid_body",
|
|
1204
|
-
message: "Email OTP capability context is invalid"
|
|
1205
|
-
}
|
|
1046
|
+
body: failure("invalid_body", "Email OTP capability context is invalid")
|
|
1206
1047
|
};
|
|
1207
1048
|
const capabilityResult = await provisionEmailOtpEd25519YaoCapability({
|
|
1208
1049
|
context: input.capabilityContext,
|