@seams/wallet-server 0.27.0 → 0.29.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 +19 -4
- package/artifact-manifest.json +28 -13
- package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/deriver-b/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/router/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/signing-worker/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/tenant-root-control-plane/build-stamp.json +1 -1
- package/dist/esm/application-auth.js +2 -0
- package/dist/esm/auth/applicationAuth.js +85 -0
- package/dist/esm/auth/externalAuthService.js +149 -0
- package/dist/esm/auth/externalAuthStore.js +353 -0
- package/dist/esm/auth/externalOwnerOperations.js +82 -0
- package/dist/esm/authorization/domain.js +2 -2
- package/dist/esm/authorization/factorEvidence.js +1 -1
- package/dist/esm/authorization/service.js +2 -2
- package/dist/esm/authorization/vaultProxyUse.js +1 -1
- package/dist/esm/cloud-host.js +12 -11
- package/dist/esm/core/ThresholdService/validation.js +1 -1
- package/dist/esm/core/WebAuthnCredentialBindingStore.js +1 -1
- package/dist/esm/core/authService/webauthn.js +1 -1
- package/dist/esm/core/d1EcdsaSignerRead.js +1 -1
- package/dist/esm/core/d1WalletAuthMethodStore.js +2 -2
- package/dist/esm/core/d1WalletStore.js +1 -1
- package/dist/esm/core/deviceLinking/linkedDeviceEmailOtpGrant.js +1 -1
- package/dist/esm/core/deviceLinking/linkedDeviceManagement.js +1 -1
- package/dist/esm/core/deviceLinking/linkedDeviceSessionRecord.js +2 -2
- package/dist/esm/core/nearRelayerAccountProvisioning.js +2 -2
- package/dist/esm/hosted-wallet-gateway.js +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/router/auth/webAuthnCredentialCodecs.js +1 -1
- package/dist/esm/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.js +2 -0
- package/dist/esm/router/cloudflare/d1/auth/d1RecordedOwnerOperation.js +43 -0
- package/dist/esm/router/cloudflare/d1/auth/d1RouterApiAuthService.js +27 -3
- package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +2 -2
- package/dist/esm/router/cloudflare/d1/authorization/d1VaultProxyStore.js +2 -2
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js +3 -3
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEd25519ExportRootStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.js +2 -2
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSessionStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceSourceContributionPreparationPlanner.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetAuthenticatorStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetPlanner.js +1 -1
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceVerifiedLinkBuilder.js +2 -2
- package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceVerifiedLinkSourceReader.js +1 -1
- package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoCapabilityPersistence.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeService.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.js +2 -2
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +3 -3
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +3 -3
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcBoundary.js +7 -1
- package/dist/esm/router/cloudflare/d1/oidc/d1OidcVerificationService.js +1 -1
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1PasskeyCustodyRouteService.js +4 -4
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +4 -4
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.js +1 -1
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js +3 -3
- package/dist/esm/router/cloudflare/d1/registration/d1EvmFamilyEcdsaRegistrationBranch.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +11 -2
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationIntentService.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1WalletExecutionAuthority.js +9 -16
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +46 -4
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetup.js +12 -0
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.js +1 -0
- package/dist/esm/router/cloudflare/d1/registration/registrationCompletionWrite.js +1 -0
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js +36 -1
- package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/authorizationSnapshotLayout.js +1 -0
- package/dist/esm/router/cloudflare/d1/wallet/d1VoiceIdWalletSessionChallenges.js +2 -2
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodBoundary.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodRevocationReplayStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +6 -5
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorityStore.js +2 -2
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationCleanup.js +2 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationIntake.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthorizationSnapshot.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationChallenges.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletRelocationOwnerRequest.js +2 -2
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnAuthService.js +2 -2
- package/dist/esm/router/cloudflare/d1/webauthn/d1WebAuthnRecords.js +2 -2
- package/dist/esm/router/cloudflare/runtime/staticWalletConsoleBinding.js +9 -0
- package/dist/esm/router/cloudflare/runtime/walletConsoleOpsClient.js +6 -0
- package/dist/esm/router/cloudflare-adaptor.js +1 -1
- package/dist/esm/router/cloudflare.js +6139 -5567
- package/dist/esm/router/domains/ecdsa/routerAbEcdsaStrictRegistration.js +1 -1
- package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.js +5 -5
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery.js +2 -2
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryWalletSessionAuthorization.js +1 -1
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.js +1 -1
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistration.js +1 -1
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.js +1 -1
- package/dist/esm/router/domains/emailOtp/emailOtpRouteHandlers.js +2 -2
- package/dist/esm/router/domains/passkeyCustody/walletCustodyRegistrationCommit.js +1 -1
- package/dist/esm/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.js +2 -2
- package/dist/esm/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.js +37 -3
- package/dist/esm/router/domains/signingOperations/routerAbOperationStepUp.js +1 -1
- package/dist/esm/router/domains/tenantRoot/tenantRootIdentityResolution.js +1 -1
- package/dist/esm/router/domains/walletRegistration/walletRegistrationReservation.js +18 -3
- package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +12 -4
- package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +3 -3
- package/dist/esm/router/framework/http.js +1 -1
- package/dist/esm/router/framework/routeDefinitions.js +2 -1
- package/dist/esm/router/transport/fetch/createFetchRouter.js +5 -3
- package/dist/esm/router/transport/fetch/routes/auth.js +1 -1
- package/dist/esm/router/transport/fetch/routes/deviceLinking.js +3 -3
- package/dist/esm/router/transport/fetch/routes/deviceLinkingOwnerAuthorization.js +1 -1
- package/dist/esm/router/transport/fetch/routes/ecdsaOperationStepUpFactor.js +3 -3
- package/dist/esm/router/transport/fetch/routes/externalAuth.js +351 -0
- package/dist/esm/router/transport/fetch/routes/normalSigningRouterProxy.js +1 -1
- package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +46 -306
- package/dist/esm/router/transport/fetch/routes/sessions.js +4 -4
- package/dist/esm/router/transport/fetch/routes/syncAccount.js +2 -2
- package/dist/esm/router/transport/fetch/routes/syncAccountBootstrap.js +1 -1
- package/dist/esm/router/transport/fetch/routes/thresholdEcdsa.js +4 -4
- package/dist/esm/router/transport/fetch/routes/thresholdEd25519.js +6 -6
- package/dist/esm/router/transport/fetch/routes/walletExecutionLanePreflight.js +2 -2
- package/dist/esm/router/transport/fetch/routes/walletRegistration.js +4 -4
- package/dist/esm/router/transport/fetch/walletOwnerOperationAuthorization.js +306 -0
- package/dist/esm/shared-ts/src/auth/externalAuth.js +118 -0
- package/dist/esm/shared-ts/src/authorization/index.js +1 -1
- package/dist/esm/shared-ts/src/authorization/voiceIdDeviceAssertion.js +1 -1
- package/dist/esm/shared-ts/src/authorization/walletAuthority.js +2 -2
- package/dist/esm/shared-ts/src/authorization/{walletCustodyOperation.js → walletOwnerOperation.js} +4 -4
- package/dist/esm/shared-ts/src/device-linking/delegatedActivationPlan.js +1 -1
- package/dist/esm/shared-ts/src/device-linking/digests.js +1 -1
- package/dist/esm/shared-ts/src/device-linking/ed25519ExportRoot.js +1 -1
- package/dist/esm/shared-ts/src/device-linking/parsers.js +2 -2
- package/dist/esm/shared-ts/src/device-linking/sourceContribution.js +1 -1
- package/dist/esm/shared-ts/src/device-linking/walletSessionCredentialDelivery.js +1 -1
- package/dist/esm/shared-ts/src/device-linking/wireFields.js +2 -2
- package/dist/esm/shared-ts/src/passkey-custody/custodyEnvelope.js +1 -1
- package/dist/esm/shared-ts/src/passkey-custody/custodySecretBinding.js +1 -1
- package/dist/esm/shared-ts/src/signing-lanes/ownerContinuity.js +1 -1
- package/dist/esm/shared-ts/src/utils/routerAbEcdsaDerivation.js +1 -1
- package/dist/esm/shared-ts/src/utils/walletAuthAuthority.js +1 -1
- package/dist/esm/shared-ts/src/wallet-recovery/index.js +3 -3
- package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryCommittedProjection.js +1 -1
- package/dist/esm/shared-ts/src/wallet-recovery/walletRecoveryEnvelopeSet.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/crypto/cipher.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/service.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/transport/fetch.js +1 -1
- package/dist/esm/threshold/session/signingSessionSeal/transport/shared.js +1 -1
- package/dist/types/shared-ts/src/auth/externalAuth.d.ts +127 -0
- package/dist/types/shared-ts/src/authorization/index.d.ts +1 -1
- package/dist/types/shared-ts/src/authorization/walletOwnerOperation.d.ts +10 -0
- package/dist/types/shared-ts/src/utils/registrationEstablishedSession.d.ts +4 -0
- package/dist/types/shared-ts/src/utils/registrationIntent.d.ts +2 -0
- package/dist/types/shared-ts/src/utils/walletManagementProtocol.d.ts +1 -1
- package/dist/types/wallet-server/src/application-auth.d.ts +3 -0
- package/dist/types/wallet-server/src/auth/applicationAuth.d.ts +29 -0
- package/dist/types/wallet-server/src/auth/externalAuthService.d.ts +55 -0
- package/dist/types/wallet-server/src/auth/externalAuthStore.d.ts +115 -0
- package/dist/types/wallet-server/src/auth/externalOwnerOperations.d.ts +18 -0
- package/dist/types/wallet-server/src/cloud-host.d.ts +2 -1
- package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.d.ts +12 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.d.ts +5 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/auth/d1RecordedOwnerOperation.d.ts +16 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/oidc/d1OidcBoundary.d.ts +5 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.d.ts +1 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationSetup.d.ts +2 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.d.ts +7 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/authorizationSnapshotLayout.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodService.d.ts +1 -0
- package/dist/types/wallet-server/src/router/cloudflare/runtime/staticWalletConsoleBinding.d.ts +2 -0
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.d.ts +2 -2
- package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbOperationStepUp.d.ts +1 -1
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts +1 -0
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationReservation.d.ts +11 -6
- package/dist/types/wallet-server/src/router/framework/apiCredentialPorts.d.ts +1 -0
- package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +12 -0
- package/dist/types/wallet-server/src/router/transport/fetch/routes/externalAuth.d.ts +5 -0
- package/dist/types/wallet-server/src/router/transport/fetch/walletOwnerOperationAuthorization.d.ts +23 -0
- package/migrations/d1-signer/0085_external_wallet_auth.sql +158 -0
- package/migrations/d1-signer/0086_application_auth.sql +67 -0
- package/migrations/d1-signer/0087_registration_without_session.sql +43 -0
- package/package.json +7 -2
- package/dist/types/shared-ts/src/authorization/walletCustodyOperation.d.ts +0 -10
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parseWebAuthnRpId } from "../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { normalizeOptionalString } from "../../shared-ts/src/utils/normalize.js";
|
|
3
3
|
import { isPlainObject } from "../../shared-ts/src/utils/validation.js";
|
|
4
|
-
import { rejectUnknownFields } from "../../shared-ts/src/utils/exactRecord.js";
|
|
5
4
|
import { base64UrlDecode } from "../../shared-ts/src/utils/base64.js";
|
|
6
5
|
import { parseDigestB64u } from "../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
7
6
|
import "../../shared-ts/src/utils/encoders.js";
|
|
7
|
+
import { rejectUnknownFields } from "../../shared-ts/src/utils/exactRecord.js";
|
|
8
8
|
import { isEmailOtpWalletAuthAuthority, isPasskeyWalletAuthAuthority, isVoiceIdWalletAuthAuthority } from "../../shared-ts/src/utils/walletAuthAuthority.js";
|
|
9
9
|
//#region src/core/ThresholdService/validation.ts
|
|
10
10
|
function decodeFixedB64u(value, expectedLength) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import { isObject } from "../shared-ts/src/utils/validation.js";
|
|
3
|
-
import { normalizeRuntimePolicyScope } from "../shared-ts/src/threshold/signingRootScope.js";
|
|
4
3
|
import { prepareD1TenantStatement } from "./d1TenantStore.js";
|
|
4
|
+
import { normalizeRuntimePolicyScope } from "../shared-ts/src/threshold/signingRootScope.js";
|
|
5
5
|
//#region src/core/WebAuthnCredentialBindingStore.ts
|
|
6
6
|
const INSERT_CREDENTIAL_BINDING_SQL = `INSERT INTO webauthn_credential_bindings (
|
|
7
7
|
namespace,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import { base64UrlEncode } from "../../shared-ts/src/utils/base64.js";
|
|
3
|
-
import "../../shared-ts/src/utils/encoders.js";
|
|
4
3
|
import { failure } from "../../shared-ts/src/utils/failure.js";
|
|
4
|
+
import "../../shared-ts/src/utils/encoders.js";
|
|
5
5
|
import { errorMessage } from "../../shared-ts/src/utils/errors.js";
|
|
6
6
|
import { decodeBase64UrlOrBase64, isHostWithinRpId, loadSimpleWebAuthnServer, originHostnameOrEmpty, parseClientDataJsonBase64url } from "./webauthnOidcHelpers.js";
|
|
7
7
|
//#region src/core/authService/webauthn.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isPlainObject } from "../shared-ts/src/utils/validation.js";
|
|
2
|
+
import { parseD1JsonColumn } from "../storage/d1Sql.js";
|
|
2
3
|
import { sameRouterAbMpcMaterialActivationRef } from "../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
3
4
|
import { EcdsaMaterialReadSnapshot } from "./ecdsaMaterialReadSnapshot.js";
|
|
4
5
|
import { parseWalletEcdsaSignerRecord } from "./WalletStore.js";
|
|
5
|
-
import { parseD1JsonColumn } from "../storage/d1Sql.js";
|
|
6
6
|
//#region src/core/d1EcdsaSignerRead.ts
|
|
7
7
|
function prepareWalletEcdsaSignersRead(database, scope, walletId) {
|
|
8
8
|
return database.prepare(`SELECT record_json FROM wallet_signers
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parseWebAuthnRpId } from "../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { normalizeOptionalTrimmedString } from "../shared-ts/src/utils/normalize.js";
|
|
3
3
|
import { isPlainObject } from "../shared-ts/src/utils/validation.js";
|
|
4
|
-
import { parseWalletAuthMethodRecordV2, walletAuthMethodRecordId } from "../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
5
4
|
import { D1_BATCH_CAS_GUARD_SQL, parseD1JsonColumn } from "../storage/d1Sql.js";
|
|
6
|
-
import { walletIdFromString } from "../shared-ts/src/utils/registrationIds.js";
|
|
7
5
|
import { D1Schema, D1TenantTable, ensureD1Schema } from "./d1TenantStore.js";
|
|
6
|
+
import { parseWalletAuthMethodRecordV2, walletAuthMethodRecordId } from "../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
7
|
+
import { walletIdFromString } from "../shared-ts/src/utils/registrationIds.js";
|
|
8
8
|
//#region src/core/d1WalletAuthMethodStore.ts
|
|
9
9
|
/** Names the wallet auth-method store in D1 scope errors. */
|
|
10
10
|
const WALLET_AUTH_METHOD_D1_STORE = "wallet auth-method store";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { parseWalletId } from "../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { normalizeOptionalTrimmedString } from "../shared-ts/src/utils/normalize.js";
|
|
3
3
|
import { isPlainObject } from "../shared-ts/src/utils/validation.js";
|
|
4
|
+
import { D1_BATCH_CAS_GUARD_SQL, formatD1ExecStatement, parseD1JsonColumn } from "../storage/d1Sql.js";
|
|
4
5
|
import { sameRouterAbMpcMaterialActivationRef } from "../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
5
6
|
import { parseRouterAbEd25519YaoRecoveryActivationResultV1, parseRouterAbEd25519YaoRecoveryAdmissionRequestV1, parseRouterAbEd25519YaoRegistrationActivationAdmissionReceiptV1, parseRouterAbEd25519YaoRegistrationActivationResultV1, parseRouterAbEd25519YaoRegistrationAdmissionRequestV1 } from "../shared-ts/src/utils/routerAbEd25519Yao.js";
|
|
6
7
|
import { normalizeRuntimePolicyScope, signingRootScopeFromRuntimePolicyScope } from "../shared-ts/src/threshold/signingRootScope.js";
|
|
7
8
|
import { sameRouterAbEcdsaDerivationPublicCapabilityV1 } from "../shared-ts/src/utils/routerAbEcdsaDerivation.js";
|
|
8
9
|
import { thresholdEcdsaChainTargetKey } from "../shared-ts/src/utils/thresholdEcdsaChainTarget.js";
|
|
9
10
|
import { ecdsaPostRegistrationRequestMatchesCapability, parseWalletEcdsaPendingSessionActivationRecord, parseWalletEcdsaSignerRecord } from "./WalletStore.js";
|
|
10
|
-
import { D1_BATCH_CAS_GUARD_SQL, formatD1ExecStatement, parseD1JsonColumn } from "../storage/d1Sql.js";
|
|
11
11
|
import { EcdsaMaterialRead, parseWalletEcdsaSignerRows, prepareWalletEcdsaSignersRead } from "./d1EcdsaSignerRead.js";
|
|
12
12
|
import { normalizeThresholdEd25519ParticipantIds } from "../shared-ts/src/threshold/participants.js";
|
|
13
13
|
//#region src/core/d1WalletStore.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parseLinkDeviceSessionId, parseLinkedDeviceEnrollmentId, parseLinkedDeviceId, parseVerifiedEmailAddress, parseWalletAuthMethodId, parseWalletId, parseWebAuthnCredentialIdB64u } from "../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { requireRecord } from "../../shared-ts/src/utils/validation.js";
|
|
3
|
-
import { rejectUnknownFields } from "../../shared-ts/src/utils/exactRecord.js";
|
|
4
3
|
import { base64UrlEncode } from "../../shared-ts/src/utils/base64.js";
|
|
5
4
|
import { sha256BytesUtf8 } from "../../shared-ts/src/utils/digests.js";
|
|
6
5
|
import { parseDigestB64u, sha256Utf8DigestB64u } from "../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
7
6
|
import { parseUnixMs, requireParsed } from "../../shared-ts/src/passkey-custody/primitives.js";
|
|
7
|
+
import { rejectUnknownFields } from "../../shared-ts/src/utils/exactRecord.js";
|
|
8
8
|
//#region src/core/deviceLinking/linkedDeviceEmailOtpGrant.ts
|
|
9
9
|
/**
|
|
10
10
|
* The durable one-time Email OTP verification grant.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseLinkedDeviceId, parseWalletAuthorityId } from "../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { buildDelegatedWalletAuthorityV1, buildFullOwnerPermissionsV1, hasDelegatedWalletPermissionV1, sameDelegatedWalletAuthorityV1 } from "../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
3
2
|
import { base64UrlDecode, base64UrlEncode } from "../../shared-ts/src/utils/base64.js";
|
|
3
|
+
import { buildDelegatedWalletAuthorityV1, buildFullOwnerPermissionsV1, hasDelegatedWalletPermissionV1, sameDelegatedWalletAuthorityV1 } from "../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
4
4
|
//#region src/core/deviceLinking/linkedDeviceManagement.ts
|
|
5
5
|
const MAX_LINKED_DEVICE_LIST_LIMIT_V1 = 50;
|
|
6
6
|
var LinkedDeviceListCursorError = class extends Error {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { hasWhitespaceOrControlCharacters, parseLinkDeviceSessionId, parseVerifiedEmailAddress, parseWalletAuthMethodId, parseWalletAuthorityId } from "../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId } from "../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { requireRecordCopy } from "../../shared-ts/src/utils/validation.js";
|
|
4
|
-
import { sameDelegatedWalletAuthorityV1 } from "../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
5
3
|
import { parseDigestB64u } from "../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
4
|
+
import { parseDeviceId } from "../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
|
+
import { sameDelegatedWalletAuthorityV1 } from "../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
6
6
|
import { assertNeverLinkSessionStateV1 } from "../../shared-ts/src/device-linking/contracts.js";
|
|
7
7
|
import { parseExactAdministeredSignerManifestV1 } from "../../shared-ts/src/device-linking/delegatedActivationPlan.js";
|
|
8
8
|
import { parseLinkedDeviceOrdinaryMaterialSourceContributionPreparationTupleV1 } from "../../shared-ts/src/device-linking/sourceContribution.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { coerceNonEmptyString, requireRecordOrArray } from "../shared-ts/src/utils/validation.js";
|
|
2
2
|
import { base64UrlDecode, base64UrlEncode } from "../shared-ts/src/utils/base64.js";
|
|
3
3
|
import { sha256Bytes } from "../shared-ts/src/utils/digests.js";
|
|
4
|
+
import { failure } from "../shared-ts/src/utils/failure.js";
|
|
4
5
|
import { base58Encode } from "../shared-ts/src/utils/base58.js";
|
|
5
6
|
import "../shared-ts/src/utils/encoders.js";
|
|
6
|
-
import {
|
|
7
|
+
import { errorMessage } from "../shared-ts/src/utils/errors.js";
|
|
7
8
|
import { ActionType, validateActionArgsWasm } from "../shared-ts/src/near/actions.js";
|
|
8
9
|
import { deriveImplicitNearAccountIdFromEd25519PublicKey, parseImplicitNearAccountId, parseNamedNearAccountId } from "../shared-ts/src/utils/near.js";
|
|
9
|
-
import { errorMessage } from "../shared-ts/src/utils/errors.js";
|
|
10
10
|
import { threshold_ed25519_build_near_tx_unsigned_borsh, threshold_ed25519_decode_signed_near_tx_borsh, threshold_ed25519_finalize_near_tx_from_signature } from "../wasm/near_signer/pkg/wasm_signer_worker.js";
|
|
11
11
|
import { toPublicKeyStringFromSecretKey } from "./nearKeys.js";
|
|
12
12
|
import { requireFinalizeNearTxFromSignatureOutput, requireSingleUnsignedNearTxBorshOutput, signNearDigestWithSecretKey } from "./authService/nearPrivateKeySigning.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { parseWalletId } from "./shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseTenantId } from "./shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { base64UrlEncode } from "./shared-ts/src/utils/base64.js";
|
|
3
|
+
import { parseD1JsonColumn } from "./storage/d1Sql.js";
|
|
4
|
+
import { parseTenantId } from "./shared-ts/src/authorization/capabilityKinds.js";
|
|
4
5
|
import { parseRouterAbPublicKeysetV2 } from "./shared-ts/src/utils/routerAbPublicKeyset.js";
|
|
5
6
|
import { ROUTER_AB_ED25519_YAO_EXPORT_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_EXPORT_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_ACTIVATE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_RECOVERY_STATUS_PATH_V1, ROUTER_AB_ED25519_YAO_REGISTRATION_ADMISSION_PATH_V1, ROUTER_AB_ED25519_YAO_REGISTRATION_EXECUTE_PATH_V1, ROUTER_AB_ED25519_YAO_WARM_RECOVERY_BOOTSTRAP_PATH_V1 } from "./shared-ts/src/utils/routerAbEd25519Yao.js";
|
|
6
7
|
import { parseSessionOrigin } from "./authorization/domain.js";
|
|
7
|
-
import {
|
|
8
|
+
import { withCors } from "./router/framework/http.js";
|
|
8
9
|
import { D1WalletStore } from "./core/d1WalletStore.js";
|
|
9
10
|
import { D1WalletAuthMethodStore } from "./core/d1WalletAuthMethodStore.js";
|
|
10
11
|
import { WALLET_OBJECT_ADDRESSES_HEADER, WALLET_OBJECT_IDENTITY_HEADER, walletObjectIdentity, walletObjectIdentityHeaders } from "./router/cloudflare/runtime/walletObjectAddresses.js";
|
|
@@ -12,7 +13,6 @@ import { RouterAbEcdsaPresignRuntime } from "./core/routerAbSigning/RouterAbEcds
|
|
|
12
13
|
import { buildTenantRootIdentityFromAuthenticatedDeploymentV1, decodeTenantRootIdentityWireV1 } from "./shared-ts/src/tenant-root/tenantRootIdentity.js";
|
|
13
14
|
import "./shared-ts/src/tenant-root/index.js";
|
|
14
15
|
import { createWalletConsoleOpsClient } from "./router/cloudflare/runtime/walletConsoleOpsClient.js";
|
|
15
|
-
import { withCors } from "./router/framework/http.js";
|
|
16
16
|
import { createCloudflareWalletGatewayRouterV1 } from "./router/cloudflare/runtime/walletGateway.js";
|
|
17
17
|
import { createWalletRuntimeOpsHandler } from "./router/cloudflare/runtime/walletRuntimeOpsHandler.js";
|
|
18
18
|
import { handleWalletControlRequest } from "./router/cloudflare/runtime/walletControlOps.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseMpcWalletSigningQuotaId, parseWalletSessionId } from "./shared-ts/src/authorization/capabilityKinds.js";
|
|
2
2
|
import { AUTHORIZED_OPERATION_REPLAY_BODY_MAX_BYTES, authorizedOperationReplayBodyInit, buildActiveWalletSessionQuota, buildAuthorizedOperation, buildExactWalletSessionQuotaProjectionV1, buildPersistedActiveWalletSessionAuthorizationV2, buildWalletSessionAuthorizationV2, buildWalletSessionCapabilitySubjectsV1, computeAuthorizedOperationResultDigest, exactWalletSessionCapabilitySubjectsResolveAuthority, parseAuthorizedOperationReplayResponse, parseHostedWalletSeamsSessionExchangeCode, parseHostedWalletSeamsSessionExchangeNonce, parseHostedWalletSessionCredentialId, parseHostedWalletSessionOperationCredentialToken, parseHostedWalletSessionOperationCredentialV1, parsePrimaryWalletSessionOperationCredentialToken, parseSessionOrigin, parseVerifiedOwnerProofId, parseWalletSessionAuthorizationV2, projectActiveWalletSession, projectExactWalletSessionAuthorizationV1, walletSessionAuthorizationV2RecordsEqual, walletSessionCapabilitySubjectsV1Equal } from "./authorization/domain.js";
|
|
3
3
|
import { AuthorizationService, digestOpaqueValue } from "./authorization/service.js";
|
|
4
|
+
import { SessionService, buildCorsOrigins, parseCsvList } from "./core/SessionService.js";
|
|
4
5
|
import { authorizeSigningSessionSealRequest, buildSigningSessionSealApplyPath, buildSigningSessionSealRemovePath, parseSigningSessionSealApplyBody, parseSigningSessionSealRemoveBody, resolveSigningSessionSealBasePath, signingSessionSealAuthorizeStatusCode, signingSessionSealStatusCode } from "./threshold/session/signingSessionSeal/transport/shared.js";
|
|
5
6
|
import { LocalWorkerVaultProxyGateway, VaultProxyUseService, buildVaultProxyUseOperation, createVaultProxyUseRouteExtension, parseVaultProxyDestination } from "./authorization/vaultProxyUse.js";
|
|
6
|
-
import { SessionService, buildCorsOrigins, parseCsvList } from "./core/SessionService.js";
|
|
7
7
|
import { computeEip1559TxHash, encodeEip1559SignedTxFromSignature65, ensureEvmCryptoWasm, secp256k1PrivateKey32ToPublicKey33, secp256k1PublicKey33ToEthereumAddress, signSecp256k1Recoverable } from "./core/ThresholdService/evmCryptoWasm.js";
|
|
8
8
|
import { buildWalletEd25519SignerId } from "./core/WalletStore.js";
|
|
9
9
|
import { D1WalletStore, WALLET_STORE_D1_SCHEMA_SQL, buildWalletEcdsaSignerRecord, ensureWalletStoreD1Schema } from "./core/d1WalletStore.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import { isPlainObject } from "../../shared-ts/src/utils/validation.js";
|
|
3
3
|
import { base64Decode, base64UrlDecode, base64UrlEncode } from "../../shared-ts/src/utils/base64.js";
|
|
4
|
-
import "../../shared-ts/src/utils/encoders.js";
|
|
5
4
|
import { failure } from "../../shared-ts/src/utils/failure.js";
|
|
5
|
+
import "../../shared-ts/src/utils/encoders.js";
|
|
6
6
|
import { errorMessage } from "../../shared-ts/src/utils/errors.js";
|
|
7
7
|
//#region src/router/auth/webAuthnCredentialCodecs.ts
|
|
8
8
|
function containsWebAuthnExtensionOutput(value) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { parseTenantId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
2
|
+
import { resolveRecordedPasskeyOwnerOperation } from "./d1RecordedOwnerOperation.js";
|
|
2
3
|
//#region src/router/cloudflare/d1/auth/d1AuthorizedOperationRouteService.ts
|
|
3
4
|
function createD1AuthorizedOperationRouteService(assembly) {
|
|
4
5
|
const tenantId = parseTenantId(assembly.options.orgId);
|
|
5
6
|
if (!tenantId.ok) throw new Error(`orgId cannot identify an authorization tenant: ${tenantId.error.message}`);
|
|
6
7
|
return {
|
|
7
8
|
tenantId: tenantId.value,
|
|
9
|
+
resolveRecordedPasskeyOwnerOperation: resolveRecordedPasskeyOwnerOperation.bind(null, assembly, tenantId.value),
|
|
8
10
|
resolveEcdsaWalletSessionOperation: assembly.authorizationStore.resolveEcdsaWalletSessionOperation.bind(assembly.authorizationStore),
|
|
9
11
|
admitEcdsaWalletSessionOperation: assembly.authorizationStore.admitEcdsaWalletSessionOperation.bind(assembly.authorizationStore),
|
|
10
12
|
admitEd25519WalletSessionOperation: assembly.authorizationStore.admitEd25519WalletSessionOperation.bind(assembly.authorizationStore),
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CAPABILITY_KINDS } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
2
|
+
import { walletAuthAuthorityRef } from "../../../../shared-ts/src/utils/walletAuthAuthority.js";
|
|
3
|
+
//#region src/router/cloudflare/d1/auth/d1RecordedOwnerOperation.ts
|
|
4
|
+
/** A continuation uses only the factor digest and exact operation recorded after owner verification. */
|
|
5
|
+
async function resolveRecordedPasskeyOwnerOperation(source, tenantId, input) {
|
|
6
|
+
const operation = await source.authorizationService.readAuthorizedOperationById({
|
|
7
|
+
tenantId,
|
|
8
|
+
authorizedOperationId: input.authorizedOperationId
|
|
9
|
+
});
|
|
10
|
+
if (!operation || operation.authorization.kind !== "verified_step_up" || operation.quota.kind !== "quota_neutral" || operation.operation.operation.capabilityKind !== CAPABILITY_KINDS.nearEd25519MpcSigning) return null;
|
|
11
|
+
const scope = source.options;
|
|
12
|
+
const evidence = await scope.database.prepare(`SELECT authority_digest, expires_at_ms
|
|
13
|
+
FROM verified_wallet_operation_evidence_sets
|
|
14
|
+
WHERE namespace = ? AND org_id = ? AND project_id = ? AND env_id = ?
|
|
15
|
+
AND tenant_id = ? AND wallet_id = ? AND principal_id = ?
|
|
16
|
+
AND evidence_set_digest = ? AND request_origin = ? AND audience = ?
|
|
17
|
+
AND lane_digest = ? AND intent_digest = ? AND display_digest = ?
|
|
18
|
+
AND capability_kind = ? AND operation_kind = ?
|
|
19
|
+
AND verified_at_ms <= ? AND expires_at_ms > ? AND assurance = 'step_up'
|
|
20
|
+
LIMIT 1`).bind(scope.namespace, scope.orgId, scope.projectId, scope.envId, tenantId, input.walletId, operation.operation.principalId, operation.authorization.evidenceSetDigest, input.requestOrigin, input.requestOrigin, operation.operation.digests.laneDigest, operation.operation.digests.intentDigest, operation.operation.digests.displayDigest, operation.operation.operation.capabilityKind, operation.operation.operation.operationKind, input.nowMs, input.nowMs).first();
|
|
21
|
+
if (!evidence || typeof evidence.authority_digest !== "string" || typeof evidence.expires_at_ms !== "number") return null;
|
|
22
|
+
const methods = await source.walletAuthMethodStore.listForWalletV2({ walletId: input.walletId });
|
|
23
|
+
for (const method of methods) {
|
|
24
|
+
if (method.kind !== "passkey" || method.status !== "active") continue;
|
|
25
|
+
const resolved = await source.walletAuthMethods.resolveActivePasskeyAuthorityForVerifiedCredential({
|
|
26
|
+
walletId: input.walletId,
|
|
27
|
+
rpId: method.rpId,
|
|
28
|
+
credentialIdB64u: method.credentialIdB64u
|
|
29
|
+
});
|
|
30
|
+
if (!resolved.ok) continue;
|
|
31
|
+
if ((await walletAuthAuthorityRef({ authority: resolved.authority })).authorityDigest !== evidence.authority_digest) continue;
|
|
32
|
+
return {
|
|
33
|
+
operation,
|
|
34
|
+
authority: resolved.authority,
|
|
35
|
+
expiresAtMs: evidence.expires_at_ms
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { resolveRecordedPasskeyOwnerOperation };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=d1RecordedOwnerOperation.js.map
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { parseWalletAuthMethodId, parseWalletAuthorityId, parseWalletId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId, parsePrincipalId, parseTenantId, parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
3
|
+
import { sha256BytesPortable, toRecordValue } from "./d1RouterApiAuthBoundary.js";
|
|
4
|
+
import { ExternalAuthService } from "../../../../auth/externalAuthService.js";
|
|
5
|
+
import { ExternalAuthStore } from "../../../../auth/externalAuthStore.js";
|
|
6
|
+
import { parseDeviceId, parsePrincipalId, parseTenantId, parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
4
7
|
import { parseRouterAbEcdsaRegistrationActivationReceiptV1 } from "../../../../shared-ts/src/utils/routerAbEcdsaDerivation.js";
|
|
8
|
+
import { parseWebAuthnAuthenticationCredential } from "../../../auth/webAuthnCredentialCodecs.js";
|
|
5
9
|
import { D1WalletStore } from "../../../../core/d1WalletStore.js";
|
|
6
10
|
import { D1WalletAuthMethodStore } from "../../../../core/d1WalletAuthMethodStore.js";
|
|
7
11
|
import { normalizeLogger } from "../../../../core/logger.js";
|
|
8
12
|
import { executeSignedDelegateWithRelayer } from "../../../../delegateAction/index.js";
|
|
9
13
|
import { parseWalletUnlockIssuanceRejectionCode } from "../../../framework/authServicePort.js";
|
|
10
|
-
import { parseWebAuthnAuthenticationCredential } from "../../../auth/webAuthnCredentialCodecs.js";
|
|
11
14
|
import { resolveActiveOwnerWalletExecutionLane, resolveWalletAuthMethodIdForAuthority } from "../../../../core/signingLanes/WalletExecutionLaneProjection.js";
|
|
12
15
|
import { DEFAULT_WALLET_SESSION_TTL_MS, LINKED_DEVICE_WALLET_SESSION_TTL_MS } from "../../../../shared-ts/src/threshold/sessionPolicy.js";
|
|
13
16
|
import { createDeviceLinkingOwnerRequestAuthenticatorV1 } from "../../../transport/fetch/routes/deviceLinkingOwnerAuthorization.js";
|
|
14
|
-
import { sha256BytesPortable, toRecordValue } from "./d1RouterApiAuthBoundary.js";
|
|
15
17
|
import { verifyD1LinkedDeviceFreshRevokeProofV1 } from "../wallet/d1WalletAuthMethodBoundary.js";
|
|
16
18
|
import { D1LinkedDeviceAuthorityInstallServiceV1 } from "../deviceLinking/d1LinkedDeviceAuthorityInstallService.js";
|
|
17
19
|
import { D1WalletAuthorityStore } from "../wallet/d1WalletAuthorityStore.js";
|
|
@@ -473,6 +475,27 @@ function parseWalletRegistrationSessionCommitReceipt(raw) {
|
|
|
473
475
|
function parseWalletRegistrationSessionCommitReceiptCommitted(raw, receipt) {
|
|
474
476
|
const record = toRecordValue(raw);
|
|
475
477
|
if (!record || typeof record.kind !== "string") return null;
|
|
478
|
+
if (record.kind === "near_owner_ready") {
|
|
479
|
+
if (!hasExactKeys(record, [
|
|
480
|
+
"kind",
|
|
481
|
+
"expectedOrigin",
|
|
482
|
+
"response"
|
|
483
|
+
])) return null;
|
|
484
|
+
const response = parseD1WalletRegistrationFinalizeReplayResponse(record.response);
|
|
485
|
+
if (!response?.ok || response.kind !== "near_ed25519") return null;
|
|
486
|
+
let expectedOrigin;
|
|
487
|
+
try {
|
|
488
|
+
expectedOrigin = new URL(String(record.expectedOrigin)).origin;
|
|
489
|
+
} catch {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
if (expectedOrigin !== record.expectedOrigin) return null;
|
|
493
|
+
return {
|
|
494
|
+
kind: "near_owner_ready",
|
|
495
|
+
expectedOrigin,
|
|
496
|
+
response
|
|
497
|
+
};
|
|
498
|
+
}
|
|
476
499
|
if (record.kind === "ecdsa_ready") {
|
|
477
500
|
if (!hasExactKeys(record, [
|
|
478
501
|
"kind",
|
|
@@ -1315,6 +1338,7 @@ function createD1RouterAccountRouteService(assembly) {
|
|
|
1315
1338
|
function createCloudflareD1RouterApiAuthService(input) {
|
|
1316
1339
|
const assembly = createCloudflareD1RouterApiAuthAssembly(input);
|
|
1317
1340
|
return {
|
|
1341
|
+
externalAuth: new ExternalAuthService(new ExternalAuthStore(assembly.options.database, assembly.options), assembly.walletStore, assembly.walletAuthMethodStore),
|
|
1318
1342
|
walletExecution: assembly.options.walletExecution,
|
|
1319
1343
|
relocationEmailOtp: assembly.relocationEmailOtp,
|
|
1320
1344
|
walletRegistration: createD1WalletRegistrationRouteService(assembly),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { CAPABILITY_KINDS, parseAuthorizationAuditEventId, parseAuthorizationGrantRef, parseAuthorizedOperationId, parseCapabilityId, parseCapabilityOperationId, parseCapabilityOperationRef, parseMpcWalletSigningQuotaId, parsePrincipalId, parseTenantId, parseWalletSessionAuthorizationId, parseWalletSessionId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
3
|
+
import { D1_BATCH_CAS_GUARD_SQL, d1ChangedRows, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
4
|
+
import { CAPABILITY_KINDS, parseAuthorizationAuditEventId, parseAuthorizationGrantRef, parseAuthorizedOperationId, parseCapabilityId, parseCapabilityOperationId, parseCapabilityOperationRef, parseMpcWalletSigningQuotaId, parsePrincipalId, parseTenantId, parseWalletSessionAuthorizationId, parseWalletSessionId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
4
5
|
import { buildCapabilityOperationEnvelope, computeCapabilityOperationFingerprintDigest, parseCapabilityOperationFingerprintDigest } from "../../../../shared-ts/src/authorization/operationFingerprint.js";
|
|
5
6
|
import { routerAbMpcMaterialActivationRefFromWire, routerAbMpcMaterialActivationRefToWire, sameRouterAbMpcMaterialActivationRef } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
6
7
|
import { buildActiveWalletSessionQuota, buildAuthorizedOperation, buildExactWalletSessionQuotaProjectionV1, computeAuthorizedOperationResultDigest, exactWalletSessionCapabilitySubjectsResolveAuthority, parseAuthorizedOperationReplayResponse, parseHostedWalletSessionCredentialId, parseSessionOrigin, parseWalletSessionAuthorizationV2, walletSessionAuthorizationV2RecordsEqual } from "../../../../authorization/domain.js";
|
|
7
8
|
import { ECDSA_INSTALLATION_SNAPSHOT_COLUMNS } from "../../../../core/ecdsaMaterialReadSnapshot.js";
|
|
8
|
-
import { D1_BATCH_CAS_GUARD_SQL, d1ChangedRows, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
9
9
|
import { EcdsaMaterialRead } from "../../../../core/d1EcdsaSignerRead.js";
|
|
10
10
|
import { D1WalletStore, ED25519_SIGNER_ACTIVATION_ID_PATH } from "../../../../core/d1WalletStore.js";
|
|
11
11
|
import { normalizeWalletAuthMethodV2 } from "../../../../core/d1WalletAuthMethodStore.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { parseCapabilityId, parseTenantId, parseVaultId, parseVaultItemId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
2
1
|
import { base64UrlDecode, base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
3
2
|
import { alphabetizeStringify } from "../../../../shared-ts/src/utils/digests.js";
|
|
4
|
-
import { parseVaultProxyDestination } from "../../../../authorization/vaultProxyUse.js";
|
|
5
3
|
import { toArrayBufferCopy } from "../../../../core/authService/portableCrypto.js";
|
|
4
|
+
import { parseCapabilityId, parseTenantId, parseVaultId, parseVaultItemId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
|
+
import { parseVaultProxyDestination } from "../../../../authorization/vaultProxyUse.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/authorization/d1VaultProxyStore.ts
|
|
7
7
|
const VAULT_PROXY_SECRET_AAD_DOMAIN_V1 = "seams:vault:proxy-secret:v1";
|
|
8
8
|
const AES_GCM_NONCE_BYTES = 12;
|
package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceAuthorityInstallService.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseLinkDeviceSessionId, parseWalletAuthMethodId, parseWalletAuthorityId, parseWalletId, parseWalletKeyId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId, parsePrincipalId, parseTenantId, parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { isPlainObject } from "../../../../shared-ts/src/utils/validation.js";
|
|
4
|
-
import { buildDelegatedWalletAuthorityV1, parseDelegatedWalletPermissionSetV1, validateDelegatedWalletAuthorityAttenuationV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
5
3
|
import { base64UrlDecode, base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
6
4
|
import { alphabetizeStringify, sha256BytesUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
7
5
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
6
|
+
import { parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
7
|
+
import { parseDeviceId, parsePrincipalId, parseTenantId, parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
8
|
+
import { buildDelegatedWalletAuthorityV1, parseDelegatedWalletPermissionSetV1, validateDelegatedWalletAuthorityAttenuationV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
8
9
|
import { routerAbMpcMaterialActivationRefFromWire, routerAbMpcMaterialActivationRefToWire } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
9
10
|
import { parseRouterAbEd25519YaoApplicationBindingFactsV1, parseRouterAbEd25519YaoCeremonyBindingV1, sameRouterAbEd25519YaoActivationBindingV1 } from "../../../../shared-ts/src/utils/routerAbEd25519Yao.js";
|
|
10
11
|
import { assertLinkedDeviceOrdinaryMaterialSourceContributionMatchesContextV1, parseLinkedDeviceEcdsaSourceContributionPackageV1, parseLinkedDeviceEcdsaSourceDerivationV1, parseLinkedDeviceOrdinaryMaterialSourceContributionV1 } from "../../../../shared-ts/src/device-linking/sourceContribution.js";
|
|
@@ -19,7 +20,6 @@ import { computeLinkedDevicePublicKeyDigestV1 } from "../../../../shared-ts/src/
|
|
|
19
20
|
import { walletSessionAuthorizationV2RecordsEqual } from "../../../../authorization/domain.js";
|
|
20
21
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
21
22
|
import { EcdsaMaterialReadSnapshot } from "../../../../core/ecdsaMaterialReadSnapshot.js";
|
|
22
|
-
import { parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
23
23
|
import { parseWalletEcdsaSignerRows, prepareWalletEcdsaSignersRead } from "../../../../core/d1EcdsaSignerRead.js";
|
|
24
24
|
import "../../../../core/deviceLinking/requestProof.js";
|
|
25
25
|
import { reservePasskeyCredential } from "../../../../core/passkeyCredentialClaims.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { linkedDeviceEd25519ExportRootMatchesRecipientV1, parseLinkedDeviceEd25519ExportRootPackageV1, parseLinkedDeviceEd25519ExportRootRecipientV1 } from "../../../../shared-ts/src/device-linking/ed25519ExportRoot.js";
|
|
2
1
|
import { d1ChangedRows, queryD1One } from "../../../../storage/d1Sql.js";
|
|
2
|
+
import { linkedDeviceEd25519ExportRootMatchesRecipientV1, parseLinkedDeviceEd25519ExportRootPackageV1, parseLinkedDeviceEd25519ExportRootRecipientV1 } from "../../../../shared-ts/src/device-linking/ed25519ExportRoot.js";
|
|
3
3
|
//#region src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceEd25519ExportRootStore.ts
|
|
4
4
|
const TRANSFER_TABLE = "linked_device_ed25519_export_root_transfers";
|
|
5
5
|
var D1LinkedDeviceEd25519ExportRootStoreV1 = class {
|
package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceOwnerAuthorizationProvider.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseEcdsaRelayerKeyId, parseLinkDeviceSessionId, parseLinkedDeviceEnrollmentId, parseLinkedDeviceId, parseProviderSubject } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseWalletSessionAuthorizationId, parseWalletSessionId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
|
-
import { buildFullOwnerDelegatedWalletAuthorityV1, hasDelegatedWalletPermissionV1, validateDelegatedWalletAuthorityAttenuationV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
4
2
|
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
5
3
|
import { alphabetizeStringify, sha256BytesUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
6
4
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
7
5
|
import { parseSecp256k1CompressedPublicKeyB64u } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
6
|
+
import { parseWalletSessionAuthorizationId, parseWalletSessionId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
7
|
+
import { buildFullOwnerDelegatedWalletAuthorityV1, hasDelegatedWalletPermissionV1, validateDelegatedWalletAuthorityAttenuationV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
8
8
|
import { routerAbMpcMaterialActivationRefFromWire } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
9
9
|
import { deriveRouterAbEd25519YaoApplicationBindingDigestV1 } from "../../../../shared-ts/src/utils/routerAbEd25519YaoDigests.js";
|
|
10
10
|
import { parseRouterAbEd25519YaoActivationBindingV1 } from "../../../../shared-ts/src/utils/routerAbEd25519Yao.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { hasControlCharacter, parseLinkDeviceSessionId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
+
import { d1ChangedRows, queryD1All } from "../../../../storage/d1Sql.js";
|
|
2
3
|
import { assertNeverLinkSessionStateV1 } from "../../../../shared-ts/src/device-linking/contracts.js";
|
|
3
4
|
import { parseLinkedDeviceApprovalV1, parseLinkedDeviceSessionClaimV1 } from "../../../../shared-ts/src/device-linking/parsers.js";
|
|
4
5
|
import { computeLinkedDeviceApprovalDigestV1, computeLinkedDeviceSessionClaimDigestV1 } from "../../../../shared-ts/src/device-linking/digests.js";
|
|
5
|
-
import { d1ChangedRows, queryD1All } from "../../../../storage/d1Sql.js";
|
|
6
6
|
import { requireLinkedDeviceBootstrapRecord } from "../../../../core/deviceLinking/linkedDeviceBootstrap.js";
|
|
7
7
|
import { LinkedDeviceRetiredSessionShapeErrorV1, approvalTranscriptMatchesDigest, claimTranscriptMatchesDigest, conflictResult, integrityResult, invalidStateResult, isPrecommitState, linkedDeviceEmailOtpChallengesEqualV1, linkedDeviceQrPayloadsEqualV1, parseLinkedDeviceSessionRecordV1, sessionExpiryMsV1, sourceContributionTranscriptMatchesDigest } from "../../../../core/deviceLinking/linkedDeviceSessionRecord.js";
|
|
8
8
|
import { parseD1LinkedDeviceSessionRowV1, parseD1LinkedDeviceSessionTranscriptRowV1 } from "./d1LinkedDeviceSessionRecords.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildMpcMaterialActivationRef, parseMpcMaterialActivationId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { base64UrlDecode, base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
4
3
|
import { parseSecp256k1CompressedPublicKeyB64u } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
4
|
+
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
5
|
import { routerAbMpcMaterialActivationRefToWire } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
6
6
|
import { parseLinkedDeviceOrdinaryMaterialSourceContributionPreparationTupleV1 } from "../../../../shared-ts/src/device-linking/sourceContribution.js";
|
|
7
7
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetAuthenticatorStore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseWebAuthnCredentialIdB64u } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { unknownWebAuthnAuthenticatorDeviceInfo } from "../../../../shared-ts/src/utils/webauthnDeviceInfo.js";
|
|
3
2
|
import { d1ChangedRows } from "../../../../storage/d1Sql.js";
|
|
3
|
+
import { unknownWebAuthnAuthenticatorDeviceInfo } from "../../../../shared-ts/src/utils/webauthnDeviceInfo.js";
|
|
4
4
|
//#region src/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetAuthenticatorStore.ts
|
|
5
5
|
const TARGET_CREDENTIAL_TABLE = "linked_device_target_credentials";
|
|
6
6
|
var D1LinkedDeviceTargetAuthenticatorStoreV1 = class {
|
package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceTargetCredentialProvider.js
CHANGED
|
@@ -3,11 +3,11 @@ import { requireCanonicalString, requireRecord } from "../../../../shared-ts/src
|
|
|
3
3
|
import { base64UrlDecode, base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
4
4
|
import { alphabetizeStringify } from "../../../../shared-ts/src/utils/digests.js";
|
|
5
5
|
import { parseDigestB64u, sha256Utf8DigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
6
|
+
import { d1ChangedRows } from "../../../../storage/d1Sql.js";
|
|
6
7
|
import { routerAbMpcMaterialActivationRefFromWire } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
7
8
|
import { parseLinkedDeviceOrdinaryMaterialSourceContributionPreparationTupleV1 } from "../../../../shared-ts/src/device-linking/sourceContribution.js";
|
|
8
9
|
import { parseLinkedDeviceTargetCredentialRegistrationResultV1, parseLinkedDeviceTargetCredentialRegistrationV1, parseLinkedDeviceTargetPreparationV1 } from "../../../../shared-ts/src/device-linking/parsers.js";
|
|
9
10
|
import { assertLinkedDeviceTargetCredentialRegistrationMatchesPreparationV1, computeLinkedDevicePasskeyTargetConfigurationDigestV1, computeLinkedDeviceTargetPreparationDigestV1 } from "../../../../shared-ts/src/device-linking/digests.js";
|
|
10
|
-
import { d1ChangedRows } from "../../../../storage/d1Sql.js";
|
|
11
11
|
import { errorMessage } from "../../../../shared-ts/src/utils/errors.js";
|
|
12
12
|
import { parseClientDataJsonBase64url } from "../../../../core/authService/webauthnOidcHelpers.js";
|
|
13
13
|
import { linkedDeviceX25519RecipientPublicKeyB64uV1 } from "./d1LinkedDeviceSourceContributionPreparationPlanner.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseWalletAuthMethodId, parseWebAuthnRpId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { hasDelegatedWalletPermissionV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
3
2
|
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
3
|
+
import { hasDelegatedWalletPermissionV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
4
4
|
import { buildLinkedDeviceTargetPreparationV1 } from "../../../../shared-ts/src/device-linking/parsers.js";
|
|
5
5
|
import { computeLinkedDevicePasskeyTargetConfigurationDigestV1 } from "../../../../shared-ts/src/device-linking/digests.js";
|
|
6
6
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseWebAuthnCredentialIdB64u } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
|
-
import { buildDelegatedWalletAuthorityV1, validateDelegatedWalletAuthorityAttenuationV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
4
2
|
import { base64UrlDecode, base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
5
3
|
import { alphabetizeStringify } from "../../../../shared-ts/src/utils/digests.js";
|
|
6
4
|
import { sha256Utf8DigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
5
|
+
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
6
|
+
import { buildDelegatedWalletAuthorityV1, validateDelegatedWalletAuthorityAttenuationV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
7
7
|
import { buildExactAdministeredSignerManifestV1 } from "../../../../shared-ts/src/device-linking/delegatedActivationPlan.js";
|
|
8
8
|
import { walletAuthorityDigestsMatchV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
9
9
|
import { sourceKeyManifestDigestForFamilyV1 } from "../../../../core/deviceLinking/linkedDeviceSessionRecord.js";
|
package/dist/esm/router/cloudflare/d1/deviceLinking/d1LinkedDeviceVerifiedLinkSourceReader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseWalletKeyId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseWalletSessionAuthorizationId, parseWalletSessionId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
4
3
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
4
|
+
import { parseWalletSessionAuthorizationId, parseWalletSessionId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
5
|
import { buildExactAdministeredSignerManifestV1 } from "../../../../shared-ts/src/device-linking/delegatedActivationPlan.js";
|
|
6
6
|
import { routerAbMpcMaterialActivationRefFromWire } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
7
7
|
import { deriveEvmFamilySigningKeySlotId } from "../../../../shared-ts/src/signing-lanes/evmFamilySigningKeySlotId.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseWalletId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
+
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
2
3
|
import { routerAbMpcMaterialActivationRefFromWire } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
3
4
|
import { parseWalletAuthorityV1, replaceActiveWalletAuthorityEd25519MaterialActivationV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
4
5
|
import { buildWalletSessionAuthorizationV2, buildWalletSessionCapabilitySubjectsV1 } from "../../../../authorization/domain.js";
|
|
5
|
-
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
6
6
|
import { parsePersistedWalletSessionAuthorizationV2 } from "../authorization/persistedWalletSessionAuthorization.js";
|
|
7
7
|
import { ed25519NearPublicKeyFromBytes, replaceYaoEd25519WalletSignerActiveCapability } from "./d1Ed25519YaoWalletSigner.js";
|
|
8
8
|
//#region src/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoCapabilityPersistence.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
|
-
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
3
2
|
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
3
|
+
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
4
4
|
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
5
5
|
import { emailOtpChallengePurposeIsValid, emailOtpChallengeRecord, generateNumericOtp } from "./d1EmailOtpRecords.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeIssuer.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
|
-
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
3
2
|
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
3
|
+
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
4
4
|
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_REGISTRATION_OPERATION, WALLET_EMAIL_OTP_UNLOCK_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
5
5
|
import { emailOtpGrantRecord, maskEmail, parseEmailOtpLoginOperation } from "./d1EmailOtpRecords.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeService.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
2
1
|
import { parseD1NonNegativeCount } from "../auth/d1RouterApiAuthBoundary.js";
|
|
2
|
+
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
3
3
|
import { emailOtpChallengeContextValues, emailOtpChallengeWithAttemptCount, parseEmailOtpChallengeRow, parseEmailOtpRegistrationVerificationReceiptV1, parseEmailOtpUnlockChallengeRow } from "./d1EmailOtpRecords.js";
|
|
4
4
|
import { emailOtpChallengeRows, emailOtpUnlockChallengeRows } from "../../../../core/emailOtpD1Statements.js";
|
|
5
5
|
//#region src/router/cloudflare/d1/emailOtp/d1EmailOtpChallengeStore.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import { base64UrlDecode } from "../../../../shared-ts/src/utils/base64.js";
|
|
3
|
+
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
3
4
|
import "../../../../shared-ts/src/utils/encoders.js";
|
|
5
|
+
import { isB64uString, nonNegativeSafeInteger, parseJsonObject, positiveSafeInteger } from "../auth/d1RouterApiAuthBoundary.js";
|
|
4
6
|
import { hasExactKeys } from "../../../../shared-ts/src/utils/exactKeys.js";
|
|
5
|
-
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
6
7
|
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_UNLOCK_OPERATION, isWalletEmailOtpLoginOperation } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
7
|
-
import { isB64uString, nonNegativeSafeInteger, parseJsonObject, positiveSafeInteger } from "../auth/d1RouterApiAuthBoundary.js";
|
|
8
8
|
import { parseCurrentEmailOtpChallengeRow, parseCurrentEmailOtpGrantRow, parseCurrentEmailOtpUnlockChallengeRow, parseEmailOtpChallengePurpose } from "../../../../core/EmailOtpRecords.js";
|
|
9
9
|
//#region src/router/cloudflare/d1/emailOtp/d1EmailOtpRecords.ts
|
|
10
10
|
function maskEmail(email) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
|
-
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
3
2
|
import { failedVerification, failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
4
|
-
import { validateSecp256k1PublicKey33, verifySecp256k1RecoverableSignatureAgainstPublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
|
|
5
|
-
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
6
3
|
import { parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.js";
|
|
4
|
+
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
5
|
+
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
6
|
+
import { validateSecp256k1PublicKey33, verifySecp256k1RecoverableSignatureAgainstPublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
|
|
7
7
|
import { bytesEqual, clampedEmailOtpUnlockTtlMs, decodeFixedBase64Url, emailOtpUnlockChallengeRecord } from "./d1EmailOtpRecords.js";
|
|
8
8
|
//#region src/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.ts
|
|
9
9
|
function errorMessage(error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
3
|
-
import { validateSecp256k1PublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
|
|
4
3
|
import { emailOtpDeviceEnrollmentId } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
4
|
+
import { validateSecp256k1PublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
|
|
5
5
|
import { validateEmailOtpEnrollmentMaterial } from "./d1EmailOtpRecords.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.ts
|
|
7
7
|
function parseEmailOtpEnrollmentMaterialBoundaryInput(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
|
-
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
3
2
|
import { d1MutationChanges } from "../auth/d1RouterApiAuthBoundary.js";
|
|
3
|
+
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
4
4
|
import { abandonedGoogleEmailOtpRegistrationAttemptRecord, parseGoogleEmailOtpRegistrationAttemptRow } from "./d1GoogleEmailOtpRegistrationRecords.js";
|
|
5
5
|
import { registrationAttemptMatchesReplacementScope, registrationAttemptMatchesStartedScope } from "../../../../core/EmailOtpRecords.js";
|
|
6
6
|
import { completeGoogleRegistration } from "./d1GoogleRegistrationCompletion.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parseGoogleProviderSubject, parseOrgId, parseVerifiedGoogleEmail } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
3
|
-
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
4
3
|
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
5
|
-
import { createServerAllocatedWalletId } from "../../../../shared-ts/src/utils/registrationIds.js";
|
|
6
|
-
import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
|
|
7
4
|
import { parseD1BoundaryWalletId, parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.js";
|
|
5
|
+
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
6
|
+
import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
|
|
7
|
+
import { createServerAllocatedWalletId } from "../../../../shared-ts/src/utils/registrationIds.js";
|
|
8
8
|
import { abandonedGoogleEmailOtpRegistrationAttemptRecord, expiredGoogleEmailOtpRegistrationAttemptRecord, googleEmailOtpRegistrationOfferForResponse, requireRuntimePolicyScope } from "./d1GoogleEmailOtpRegistrationRecords.js";
|
|
9
9
|
import { googleEmailOtpStaleIdentityMapping, hasDifferentWalletIdentitySubject } from "../identity/d1IdentityRecords.js";
|
|
10
10
|
//#region src/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.ts
|