@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
package/dist/esm/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.js
CHANGED
|
@@ -10,7 +10,7 @@ import { extractBearerCredential } from "../../auth/routerApiKeyAuth.js";
|
|
|
10
10
|
import { walletSessionFailure, walletSessionFailureStatus } from "../../auth/walletSessionFailure.js";
|
|
11
11
|
import { validateRouterAbEcdsaDerivationWalletSessionInputs } from "../../auth/commonRouterUtils.js";
|
|
12
12
|
import { evaluateRouterAbNormalSigningAdmission, requireAuthorizationValue, requireMpcMaterialActivationId, routerAbErrorMessage, routerAbOwnerOperationFailureResult, routerAbOwnerOperationStepUpDecision, routerAbSigningError, routerAbStepUpError, routerAbWalletSessionValidationStatus } from "./routerAbNormalSigningAdmission.js";
|
|
13
|
-
import { ecdsaStepUpActiveMaterial, exactOperationStepUpSession, parseStepUpRequestOrigin,
|
|
13
|
+
import { ecdsaStepUpActiveMaterial, exactOperationStepUpSession, parseStepUpRequestOrigin, recordedStepUpOperationClaim, routerAbOperationStepUpClaimFailure, walletSessionCandidateAdmission, walletSessionScopeInvalidFailure, walletSessionUnavailableFailure } from "./routerAbOperationStepUp.js";
|
|
14
14
|
import { buildRouterAbEcdsaDerivationPrivateSigningWorkerBody, isRouterAbEcdsaSigningWorkerOperationInProgress, postRouterAbSigningWorkerJson, replayResponseFromSigningWorkerResult } from "./routerAbPrivateSigningWorker.js";
|
|
15
15
|
//#region src/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.ts
|
|
16
16
|
function routerAbEcdsaAtomicAuthorizationConfigured(authorizedOperations) {
|
|
@@ -43,6 +43,7 @@ async function resolveRouterAbEcdsaOwnerOperationStepUpPreparation(input) {
|
|
|
43
43
|
const walletId = parseWalletId(request.scope.wallet_id);
|
|
44
44
|
if (!walletId.ok) return void 0;
|
|
45
45
|
const activeMaterial = await input.resolveEcdsaMaterialActivation({
|
|
46
|
+
source: { kind: "database" },
|
|
46
47
|
walletId: walletId.value,
|
|
47
48
|
materialActivation: request.material_activation
|
|
48
49
|
});
|
|
@@ -165,6 +166,7 @@ function routerAbWalletSessionError(code) {
|
|
|
165
166
|
*/
|
|
166
167
|
async function resolveFreshRouterAbEcdsaMaterialActivation(input) {
|
|
167
168
|
const resolved = await input.resolveEcdsaMaterialActivation({
|
|
169
|
+
source: { kind: "database" },
|
|
168
170
|
walletId: input.walletId,
|
|
169
171
|
materialActivation: input.expected
|
|
170
172
|
});
|
|
@@ -184,15 +186,7 @@ async function resolveFreshRouterAbEcdsaMaterialActivation(input) {
|
|
|
184
186
|
};
|
|
185
187
|
}
|
|
186
188
|
function validateRouterAbEcdsaV2NormalSigningRequestForSession(input) {
|
|
187
|
-
|
|
188
|
-
try {
|
|
189
|
-
request = parseRouterAbEcdsaOperationStepUpRequest(input);
|
|
190
|
-
} catch (error) {
|
|
191
|
-
return {
|
|
192
|
-
ok: false,
|
|
193
|
-
error: routerAbStepUpError(400, "invalid_body", routerAbErrorMessage(error))
|
|
194
|
-
};
|
|
195
|
-
}
|
|
189
|
+
const request = input.request;
|
|
196
190
|
if (request.authorization.kind !== "reusable_wallet_session" || request.authorization.wallet_session_id !== input.session.walletSessionId || request.scope.wallet_id !== String(input.session.walletId) || request.material_activation.material_owner !== String(input.session.walletId) || request.material_activation.signing_worker !== request.scope.signing_worker.server_id || !sameRouterAbMpcMaterialActivationRef(request.material_activation, request.scope.material_activation) || !sameRouterAbMpcMaterialActivationRef(request.material_activation, input.admittedMaterialActivation)) return {
|
|
197
191
|
ok: false,
|
|
198
192
|
error: routerAbWalletSessionError(WALLET_SESSION_FAILURE_CODES.scopeMismatch)
|
|
@@ -221,7 +215,7 @@ function validateRouterAbEcdsaV2NormalSigningRequestForSession(input) {
|
|
|
221
215
|
};
|
|
222
216
|
}
|
|
223
217
|
async function admitRouterAbEcdsaReusableWalletSessionOperation(input) {
|
|
224
|
-
if (typeof input.authorizedOperations.admitEcdsaWalletSessionOperation !== "function") return {
|
|
218
|
+
if (typeof input.authorizedOperations.admitEcdsaWalletSessionOperation !== "function" || typeof input.authorizedOperations.resolveEcdsaWalletSessionOperation !== "function") return {
|
|
225
219
|
ok: false,
|
|
226
220
|
error: routerAbStepUpError(501, "not_configured", "ECDSA atomic authorization is not configured")
|
|
227
221
|
};
|
|
@@ -231,7 +225,7 @@ async function admitRouterAbEcdsaReusableWalletSessionOperation(input) {
|
|
|
231
225
|
};
|
|
232
226
|
const nowMs = Date.now();
|
|
233
227
|
try {
|
|
234
|
-
const session = input.binding.kind === "wallet_session_operation_credential_v1" ? input.binding.context.authorization.session : input.binding.candidate.status.session;
|
|
228
|
+
const session = input.binding.kind === "wallet_session_operation_credential_v1" ? input.binding.validated.admission.context.authorization.session : input.binding.candidate.status.session;
|
|
235
229
|
const tenantId = session.tenantId;
|
|
236
230
|
const principalId = session.principalId;
|
|
237
231
|
const walletId = session.walletId;
|
|
@@ -242,16 +236,12 @@ async function admitRouterAbEcdsaReusableWalletSessionOperation(input) {
|
|
|
242
236
|
ok: false,
|
|
243
237
|
error: routerAbStepUpError(403, "wallet_session_mismatch", "Reusable Wallet Session identity does not match")
|
|
244
238
|
};
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
walletId: String(walletId),
|
|
248
|
-
expected: input.materialActivation
|
|
249
|
-
});
|
|
250
|
-
if (!freshMaterial.ok) return {
|
|
239
|
+
const material = input.material;
|
|
240
|
+
if (!sameRouterAbMpcMaterialActivationRef(material.materialActivation, input.request.material_activation)) return {
|
|
251
241
|
ok: false,
|
|
252
|
-
error: routerAbStepUpError(
|
|
242
|
+
error: routerAbStepUpError(403, "material_mismatch", "Signing material does not match the request")
|
|
253
243
|
};
|
|
254
|
-
const capabilityId = requireAuthorizationValue(parseCapabilityId(
|
|
244
|
+
const capabilityId = requireAuthorizationValue(parseCapabilityId(material.materialActivation.capability));
|
|
255
245
|
const operationId = requireAuthorizationValue(parseCapabilityOperationId(input.request.operation_id));
|
|
256
246
|
const envelope = buildCapabilityOperationEnvelope({
|
|
257
247
|
tenantId,
|
|
@@ -265,13 +255,11 @@ async function admitRouterAbEcdsaReusableWalletSessionOperation(input) {
|
|
|
265
255
|
displayDigest: parseDigestB64u(input.request.operation_digests.display_digest_b64u)
|
|
266
256
|
}
|
|
267
257
|
});
|
|
268
|
-
const
|
|
269
|
-
const auditEventId = requireAuthorizationValue(parseAuthorizationAuditEventId(`ecdsa-operation-audit:${operationId}`));
|
|
270
|
-
const outcome = await input.authorizedOperations.admitEcdsaWalletSessionOperation({
|
|
258
|
+
const admissionInput = {
|
|
271
259
|
operation: {
|
|
272
260
|
tenantId,
|
|
273
|
-
authorizedOperationId,
|
|
274
|
-
auditEventId,
|
|
261
|
+
authorizedOperationId: requireAuthorizationValue(parseAuthorizedOperationId(`ecdsa-authorized-operation:${operationId}:${input.request.request_id}`)),
|
|
262
|
+
auditEventId: requireAuthorizationValue(parseAuthorizationAuditEventId(`ecdsa-operation-audit:${operationId}`)),
|
|
275
263
|
operation: envelope,
|
|
276
264
|
authorization: {
|
|
277
265
|
kind: "authorization_grant",
|
|
@@ -284,12 +272,35 @@ async function admitRouterAbEcdsaReusableWalletSessionOperation(input) {
|
|
|
284
272
|
claimedAtMs: nowMs
|
|
285
273
|
},
|
|
286
274
|
material: {
|
|
275
|
+
readSnapshot: material.readSnapshot,
|
|
287
276
|
walletId,
|
|
288
|
-
keyHandle:
|
|
289
|
-
runtimePolicyScope:
|
|
290
|
-
materialActivation:
|
|
277
|
+
keyHandle: material.keyHandle,
|
|
278
|
+
runtimePolicyScope: material.runtimePolicyScope,
|
|
279
|
+
materialActivation: material.materialActivation
|
|
291
280
|
}
|
|
292
|
-
}
|
|
281
|
+
};
|
|
282
|
+
if (input.phase === "finalize") {
|
|
283
|
+
const resolved = await input.authorizedOperations.resolveEcdsaWalletSessionOperation(admissionInput);
|
|
284
|
+
if (resolved.kind === "authorized_operation_missing") return {
|
|
285
|
+
ok: false,
|
|
286
|
+
error: routerAbStepUpError(409, resolved.kind, "ECDSA finalize requires a claimed prepare operation")
|
|
287
|
+
};
|
|
288
|
+
const failure = routerAbReusableWalletSessionClaimFailure(resolved);
|
|
289
|
+
if (failure) return {
|
|
290
|
+
ok: false,
|
|
291
|
+
error: failure
|
|
292
|
+
};
|
|
293
|
+
if (resolved.kind === "operation_in_progress" || resolved.kind === "replayed") return {
|
|
294
|
+
ok: true,
|
|
295
|
+
phase: "finalize",
|
|
296
|
+
admission: resolved
|
|
297
|
+
};
|
|
298
|
+
return {
|
|
299
|
+
ok: false,
|
|
300
|
+
error: routerAbStepUpError(409, resolved.kind, "Authorized operation is unavailable")
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
const outcome = await input.authorizedOperations.admitEcdsaWalletSessionOperation(admissionInput);
|
|
293
304
|
const claimFailure = routerAbReusableWalletSessionClaimFailure(outcome);
|
|
294
305
|
if (claimFailure) return {
|
|
295
306
|
ok: false,
|
|
@@ -297,6 +308,7 @@ async function admitRouterAbEcdsaReusableWalletSessionOperation(input) {
|
|
|
297
308
|
};
|
|
298
309
|
if (outcome.kind === "claimed" || outcome.kind === "operation_in_progress" || outcome.kind === "replayed") return {
|
|
299
310
|
ok: true,
|
|
311
|
+
phase: "prepare",
|
|
300
312
|
admission: outcome
|
|
301
313
|
};
|
|
302
314
|
return {
|
|
@@ -342,6 +354,10 @@ async function authorizeRouterAbEcdsaWalletSessionRequest(input) {
|
|
|
342
354
|
result: validated.error
|
|
343
355
|
};
|
|
344
356
|
const activeMaterial = await input.resolveEcdsaMaterialActivation({
|
|
357
|
+
source: {
|
|
358
|
+
kind: "credential_snapshot",
|
|
359
|
+
materialRead: input.materialRead
|
|
360
|
+
},
|
|
345
361
|
walletId: String(input.session.walletId),
|
|
346
362
|
materialActivation: validated.admission.materialActivation
|
|
347
363
|
});
|
|
@@ -359,6 +375,10 @@ async function authorizeRouterAbEcdsaWalletSessionRequest(input) {
|
|
|
359
375
|
result: routerAbStepUpError(403, "wallet_session_scope_mismatch", "Wallet Session V2 scope does not match the active material")
|
|
360
376
|
};
|
|
361
377
|
const admissionDecision = await evaluateRouterAbNormalSigningAdmission({
|
|
378
|
+
policyReadSource: {
|
|
379
|
+
kind: "credential_snapshot",
|
|
380
|
+
policyRead: input.policyRead
|
|
381
|
+
},
|
|
362
382
|
adapter: input.admissionAdapter,
|
|
363
383
|
curve: "ecdsa",
|
|
364
384
|
authorizationKind: "wallet_session_operation_credential_v1",
|
|
@@ -393,29 +413,21 @@ async function authorizeRouterAbEcdsaWalletSessionRequest(input) {
|
|
|
393
413
|
};
|
|
394
414
|
}
|
|
395
415
|
async function resolveRouterAbEcdsaExhaustedCandidateAuthorization(input) {
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
operation: {
|
|
402
|
-
keyFamily: "ecdsa_secp256k1",
|
|
403
|
-
operationKind: "evm.sign_transaction"
|
|
404
|
-
}
|
|
416
|
+
const candidate = input.candidate;
|
|
417
|
+
const session = candidate.status.session;
|
|
418
|
+
const admission = walletSessionCandidateAdmission(session, candidate, {
|
|
419
|
+
keyFamily: "ecdsa_secp256k1",
|
|
420
|
+
operationKind: "evm.sign_transaction"
|
|
405
421
|
});
|
|
406
|
-
if (!exhausted) return null;
|
|
407
|
-
if (!exhausted.ok) return {
|
|
408
|
-
ok: false,
|
|
409
|
-
result: exhausted.error
|
|
410
|
-
};
|
|
411
|
-
const { candidate, session, admission } = exhausted;
|
|
412
422
|
if (!admission.ok || admission.keyFamily !== "ecdsa_secp256k1") return {
|
|
413
423
|
ok: false,
|
|
414
424
|
result: routerAbWalletSessionError(WALLET_SESSION_FAILURE_CODES.scopeMismatch)
|
|
415
425
|
};
|
|
416
426
|
const authorized = await authorizeRouterAbEcdsaWalletSessionRequest({
|
|
427
|
+
materialRead: input.materialRead,
|
|
428
|
+
policyRead: input.policyRead,
|
|
417
429
|
phase: input.phase,
|
|
418
|
-
|
|
430
|
+
request: input.request,
|
|
419
431
|
session,
|
|
420
432
|
admittedMaterialActivation: routerAbMpcMaterialActivationRefToWire(admission.materialActivation),
|
|
421
433
|
admissionAdapter: input.admissionAdapter,
|
|
@@ -468,6 +480,7 @@ async function authenticateRouterAbEcdsaOperationStepUp(input) {
|
|
|
468
480
|
let resolvedMaterial;
|
|
469
481
|
try {
|
|
470
482
|
resolvedMaterial = await input.resolveEcdsaMaterialActivation({
|
|
483
|
+
source: { kind: "database" },
|
|
471
484
|
walletId: scope.wallet_id,
|
|
472
485
|
materialActivation: admittedMaterialActivation
|
|
473
486
|
});
|
|
@@ -575,6 +588,7 @@ async function handleRouterAbEcdsaOperationStepUpRoute(input) {
|
|
|
575
588
|
const materialActivationId = requireMpcMaterialActivationId(activeMaterial.materialActivation.activation_id);
|
|
576
589
|
if (!input.admissionAdapter) return routerAbStepUpError(501, "not_configured", "Router A/B ECDSA operation step-up admission is not configured");
|
|
577
590
|
const admission = await input.admissionAdapter.evaluatePolicy({
|
|
591
|
+
policyReadSource: { kind: "database" },
|
|
578
592
|
curve: "ecdsa",
|
|
579
593
|
phase: input.phase,
|
|
580
594
|
walletId: authenticated.session.walletId,
|
|
@@ -624,19 +638,19 @@ async function handleRouterAbEcdsaOperationStepUpRoute(input) {
|
|
|
624
638
|
};
|
|
625
639
|
}
|
|
626
640
|
async function authorizeRouterAbEcdsaDerivationNormalSigningRoute(input) {
|
|
627
|
-
let
|
|
641
|
+
let parsedRequest;
|
|
628
642
|
try {
|
|
629
|
-
|
|
643
|
+
parsedRequest = parseRouterAbEcdsaOperationStepUpRequest({
|
|
630
644
|
phase: input.phase,
|
|
631
645
|
body: input.body
|
|
632
|
-
})
|
|
646
|
+
});
|
|
633
647
|
} catch (error) {
|
|
634
648
|
return {
|
|
635
649
|
ok: false,
|
|
636
650
|
result: routerAbStepUpError(400, "invalid_body", routerAbErrorMessage(error))
|
|
637
651
|
};
|
|
638
652
|
}
|
|
639
|
-
if (
|
|
653
|
+
if (parsedRequest.authorization.kind === "operation_step_up") {
|
|
640
654
|
const stepUp = await handleRouterAbEcdsaOperationStepUpRoute({
|
|
641
655
|
body: input.body,
|
|
642
656
|
headers: input.headers,
|
|
@@ -660,22 +674,12 @@ async function authorizeRouterAbEcdsaDerivationNormalSigningRoute(input) {
|
|
|
660
674
|
};
|
|
661
675
|
}
|
|
662
676
|
const validated = await validateRouterAbEcdsaDerivationWalletSessionInputs({
|
|
677
|
+
materialActivation: parsedRequest.material_activation,
|
|
663
678
|
headers: input.headers,
|
|
664
679
|
authorizationSessions: input.authorizationSessions,
|
|
665
680
|
operationKind: "evm.sign_transaction"
|
|
666
681
|
});
|
|
667
682
|
if (!validated.ok) {
|
|
668
|
-
if (validated.code === "wallet_session_unavailable" && input.authorizationSessions) {
|
|
669
|
-
const exhaustedCandidate = await resolveRouterAbEcdsaExhaustedCandidateAuthorization({
|
|
670
|
-
phase: input.phase,
|
|
671
|
-
body: input.body,
|
|
672
|
-
headers: input.headers,
|
|
673
|
-
authorizationSessions: input.authorizationSessions,
|
|
674
|
-
admissionAdapter: input.admissionAdapter,
|
|
675
|
-
resolveEcdsaMaterialActivation: input.resolveEcdsaMaterialActivation
|
|
676
|
-
});
|
|
677
|
-
if (exhaustedCandidate) return exhaustedCandidate;
|
|
678
|
-
}
|
|
679
683
|
const stepUp = await resolveRouterAbEcdsaOwnerOperationStepUpPreparation({
|
|
680
684
|
body: input.body,
|
|
681
685
|
phase: input.phase,
|
|
@@ -692,10 +696,21 @@ async function authorizeRouterAbEcdsaDerivationNormalSigningRoute(input) {
|
|
|
692
696
|
})
|
|
693
697
|
};
|
|
694
698
|
}
|
|
699
|
+
if (validated.kind === "wallet_session_operation_credential_exhausted_candidate_v1") return await resolveRouterAbEcdsaExhaustedCandidateAuthorization({
|
|
700
|
+
materialRead: validated.materialRead,
|
|
701
|
+
policyRead: validated.policyRead,
|
|
702
|
+
phase: input.phase,
|
|
703
|
+
request: parsedRequest,
|
|
704
|
+
candidate: validated.candidate,
|
|
705
|
+
admissionAdapter: input.admissionAdapter,
|
|
706
|
+
resolveEcdsaMaterialActivation: input.resolveEcdsaMaterialActivation
|
|
707
|
+
});
|
|
695
708
|
const session = validated.admission.context.authorization.session;
|
|
696
709
|
const authorized = await authorizeRouterAbEcdsaWalletSessionRequest({
|
|
710
|
+
materialRead: validated.materialRead,
|
|
711
|
+
policyRead: validated.policyRead,
|
|
697
712
|
phase: input.phase,
|
|
698
|
-
|
|
713
|
+
request: parsedRequest,
|
|
699
714
|
session,
|
|
700
715
|
admittedMaterialActivation: routerAbMpcMaterialActivationRefToWire(validated.admission.admission.materialActivation),
|
|
701
716
|
admissionAdapter: input.admissionAdapter,
|
|
@@ -727,18 +742,13 @@ async function handleRouterAbEcdsaDerivationNormalSigningRouteCore(input) {
|
|
|
727
742
|
headers: input.headers
|
|
728
743
|
});
|
|
729
744
|
if (!input.authorizedOperations) return routerAbStepUpError(501, "not_configured", "Reusable Wallet Session authorization is not configured");
|
|
745
|
+
const request = parseRouterAbEcdsaOperationStepUpRequest(input);
|
|
730
746
|
const claimed = await admitRouterAbEcdsaReusableWalletSessionOperation({
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
} : {
|
|
737
|
-
kind: "wallet_session_operation_credential_exhausted_candidate_v1",
|
|
738
|
-
candidate: authorization.candidate
|
|
739
|
-
},
|
|
740
|
-
authorizedOperations: input.authorizedOperations,
|
|
741
|
-
resolveEcdsaMaterialActivation: input.resolveEcdsaMaterialActivation
|
|
747
|
+
phase: input.phase,
|
|
748
|
+
request,
|
|
749
|
+
material: authorization.activeMaterial,
|
|
750
|
+
binding: authorization,
|
|
751
|
+
authorizedOperations: input.authorizedOperations
|
|
742
752
|
});
|
|
743
753
|
if (!claimed.ok) return claimed.error;
|
|
744
754
|
if (claimed.admission.kind === "replayed") return routerAbEcdsaReplayResult(claimed.admission.operation);
|
|
@@ -746,7 +756,7 @@ async function handleRouterAbEcdsaDerivationNormalSigningRouteCore(input) {
|
|
|
746
756
|
if (!runtime) return routerAbEcdsaPrivateSigningWorkerUnavailableResult();
|
|
747
757
|
const signingWorker = runtime.getSigningWorkerPrivateTransport();
|
|
748
758
|
if (signingWorker.kind === "unconfigured") return routerAbEcdsaPrivateSigningWorkerUnavailableResult();
|
|
749
|
-
if (
|
|
759
|
+
if (claimed.phase === "prepare") {
|
|
750
760
|
if (claimed.admission.kind === "operation_in_progress") return routerAbEcdsaOperationInProgressResult();
|
|
751
761
|
const operation = claimed.admission.operation;
|
|
752
762
|
const replay = await runtime.reservePrepareReplay({
|
|
@@ -801,7 +811,6 @@ async function handleRouterAbEcdsaDerivationNormalSigningRouteCore(input) {
|
|
|
801
811
|
body: forwarded.body
|
|
802
812
|
};
|
|
803
813
|
}
|
|
804
|
-
if (claimed.admission.kind === "claimed") return routerAbStepUpError(409, "authorized_operation_missing", "ECDSA finalize requires a claimed prepare operation");
|
|
805
814
|
const forwarded = await postRouterAbSigningWorkerJson({
|
|
806
815
|
config: signingWorker,
|
|
807
816
|
path: input.privatePath,
|
|
@@ -152,6 +152,7 @@ async function evaluateRouterAbNormalSigningAdmission(input) {
|
|
|
152
152
|
});
|
|
153
153
|
return await input.adapter.evaluatePolicy({
|
|
154
154
|
curve: "ecdsa",
|
|
155
|
+
policyReadSource: input.policyReadSource,
|
|
155
156
|
phase: input.phase,
|
|
156
157
|
walletId: input.walletId,
|
|
157
158
|
materialActivationId: requireMpcMaterialActivationId(input.admission.materialActivation.activation_id),
|
|
@@ -230,6 +230,7 @@ async function authenticateRouterAbWalletOperationStepUpIdentity(input) {
|
|
|
230
230
|
if (admission.curve === "ecdsa" && input.keyFamily === "ecdsa_secp256k1") {
|
|
231
231
|
const active = ecdsaStepUpActiveMaterial({
|
|
232
232
|
activeMaterial: await input.resolveEcdsaMaterialActivation({
|
|
233
|
+
source: { kind: "database" },
|
|
233
234
|
walletId: input.walletId,
|
|
234
235
|
materialActivation: admittedMaterialActivation
|
|
235
236
|
}),
|
|
@@ -165,7 +165,7 @@ async function prepareOwnerWalletExecution(input) {
|
|
|
165
165
|
if (lane.walletKeyId !== input.evidence.walletKey.walletKeyId) return refused("wallet_key_mismatch");
|
|
166
166
|
if (!operationMatchesWalletKey(input.authorizedOperation, input.evidence.walletKey)) return refused("curve_mismatch");
|
|
167
167
|
if (String(claimedOperation.operation.capabilityId) !== String(input.evidence.materialActivation.capability)) return refused("capability_mismatch");
|
|
168
|
-
if (!
|
|
168
|
+
if (!mpcMaterialActivationRefsEqual(input.evidence.materialActivation, input.evidence.expectedMaterialActivation)) return refused("material_activation_mismatch");
|
|
169
169
|
if (lane.participantBindingDigestB64u !== input.evidence.verifiedLaneParticipantBindingDigestB64u || String(lane.ownerParticipantContinuity.signingWorkerId) !== String(input.evidence.materialActivation.signingWorker)) return refused("participant_binding_mismatch");
|
|
170
170
|
if (await computeOwnerLaneParticipantBindingDigestV1(lane.ownerParticipantContinuity) !== lane.participantBindingDigestB64u) return refused("participant_binding_mismatch");
|
|
171
171
|
if (lane.lifecycle.activationReceiptDigestB64u !== input.evidence.verifiedActivationReceiptDigestB64u) return refused("activation_receipt_mismatch");
|
|
@@ -213,9 +213,6 @@ function operationMatchesWalletKey(operation, walletKey) {
|
|
|
213
213
|
case "ecdsa_secp256k1": return operation.operation.operation.capabilityKind === CAPABILITY_KINDS.evmEcdsaMpcSigning;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
function sameMaterialActivation(left, right) {
|
|
217
|
-
return left.activationId === right.activationId && left.capability === right.capability && left.materialOwner === right.materialOwner && left.keyBinding === right.keyBinding && left.lifecycleBinding === right.lifecycleBinding && left.signingWorker === right.signingWorker;
|
|
218
|
-
}
|
|
219
216
|
function refused(reason) {
|
|
220
217
|
return {
|
|
221
218
|
kind: "refused",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sameRouterAbMpcMaterialActivationRef } from "../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
2
2
|
import { signingRootScopeFromRuntimePolicyScope } from "../../../shared-ts/src/threshold/signingRootScope.js";
|
|
3
|
+
import { failure } from "../../../shared-ts/src/utils/failure.js";
|
|
3
4
|
import { buildTenantRootIdentityFromAuthenticatedDeploymentV1, isTenantRootIdentityFieldCanonicalV1 } from "../../../shared-ts/src/tenant-root/tenantRootIdentity.js";
|
|
4
5
|
//#region src/router/domains/tenantRoot/tenantRootIdentityResolution.ts
|
|
5
6
|
const FORBIDDEN_TENANT_ROOT_SELECTOR_FIELDS_V1 = [
|
|
@@ -59,20 +60,13 @@ function ecdsaStableMaterialRootBinding(activeMaterial) {
|
|
|
59
60
|
function assertNeverServerResolvedMaterial(value) {
|
|
60
61
|
throw new Error(`Unsupported server-resolved tenant-root material: ${String(value)}`);
|
|
61
62
|
}
|
|
62
|
-
function mismatch(code, message) {
|
|
63
|
-
return {
|
|
64
|
-
ok: false,
|
|
65
|
-
code,
|
|
66
|
-
message
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
63
|
function findForbiddenTenantRootSelectorFieldV1(input) {
|
|
70
64
|
for (const field of FORBIDDEN_TENANT_ROOT_SELECTOR_FIELDS_V1) if (Object.prototype.hasOwnProperty.call(input, field)) return field;
|
|
71
65
|
return null;
|
|
72
66
|
}
|
|
73
67
|
function resolveTenantRootIdentityV1(input) {
|
|
74
68
|
const forbiddenSelector = findForbiddenTenantRootSelectorFieldV1(input);
|
|
75
|
-
if (forbiddenSelector) return
|
|
69
|
+
if (forbiddenSelector) return failure("caller_selected_tenant_root", `Caller-supplied tenant-root selector field is forbidden: ${forbiddenSelector}`);
|
|
76
70
|
let runtimePolicyScope;
|
|
77
71
|
let materialRootBinding;
|
|
78
72
|
switch (input.kind) {
|
|
@@ -86,12 +80,12 @@ function resolveTenantRootIdentityV1(input) {
|
|
|
86
80
|
break;
|
|
87
81
|
default: return assertNeverServerResolvedMaterial(input);
|
|
88
82
|
}
|
|
89
|
-
if (!materialRootBinding.materialActivationMatches) return
|
|
83
|
+
if (!materialRootBinding.materialActivationMatches) return failure("material_activation_mismatch", "B5 material activation does not match its established material identity");
|
|
90
84
|
const nonCanonicalScopeField = findNonCanonicalRuntimePolicyScopeFieldV1(runtimePolicyScope);
|
|
91
|
-
if (nonCanonicalScopeField) return
|
|
85
|
+
if (nonCanonicalScopeField) return failure("non_canonical_tenant_root_field", `B5 runtime policy scope field is not canonical: ${nonCanonicalScopeField}`);
|
|
92
86
|
const expectedSigningRoot = signingRootScopeFromRuntimePolicyScope(runtimePolicyScope);
|
|
93
|
-
if (materialRootBinding.signingRootId !== expectedSigningRoot.signingRootId) return
|
|
94
|
-
if (materialRootBinding.signingRootVersion !== expectedSigningRoot.signingRootVersion) return
|
|
87
|
+
if (materialRootBinding.signingRootId !== expectedSigningRoot.signingRootId) return failure("signing_root_id_mismatch", "B5 signing-root ID does not match authenticated deployment configuration");
|
|
88
|
+
if (materialRootBinding.signingRootVersion !== expectedSigningRoot.signingRootVersion) return failure("signing_root_version_mismatch", "B5 signing-root version does not match authenticated deployment configuration");
|
|
95
89
|
const identity = buildTenantRootIdentityFromAuthenticatedDeploymentV1({
|
|
96
90
|
orgId: runtimePolicyScope.orgId,
|
|
97
91
|
projectId: runtimePolicyScope.projectId,
|
|
@@ -99,7 +93,7 @@ function resolveTenantRootIdentityV1(input) {
|
|
|
99
93
|
signingRootId: expectedSigningRoot.signingRootId,
|
|
100
94
|
signingRootVersion: expectedSigningRoot.signingRootVersion
|
|
101
95
|
});
|
|
102
|
-
if (!identity.ok) return
|
|
96
|
+
if (!identity.ok) return failure("non_canonical_tenant_root_field", `Authenticated tenant-root identity field is not canonical: ${identity.error.kind === "invalid_field" ? identity.error.field : "identity"}`);
|
|
103
97
|
return {
|
|
104
98
|
ok: true,
|
|
105
99
|
identity: identity.value
|