@seams/wallet-server 0.27.0 → 0.28.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/artifact-manifest.json +18 -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/auth/externalAuthService.js +98 -0
- package/dist/esm/auth/externalAuthStore.js +217 -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 +10 -9
- 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 +1 -1
- 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/d1RouterApiAuthService.js +5 -2
- 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 +2 -2
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpRegistrationAttemptStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.js +2 -2
- 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 +2 -2
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletCustodyCommitStore.js +2 -2
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.js +1 -1
- package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1EvmFamilyEcdsaRegistrationBranch.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +2 -2
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationIntentService.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +3 -3
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js +1 -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/d1WalletAuthMethodRevocationReplayStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +2 -2
- 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 +4635 -4359
- package/dist/esm/router/domains/ecdsa/routerAbEcdsaStrictRegistration.js +1 -1
- package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.js +3 -3
- 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 +1 -1
- package/dist/esm/router/domains/signingOperations/routerAbEcdsaDerivationNormalSigningRoute.js +2 -2
- package/dist/esm/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.js +2 -2
- 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 +1 -1
- package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +3 -3
- package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +2 -2
- 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 +1 -1
- package/dist/esm/router/transport/fetch/routes/externalAuth.js +244 -0
- package/dist/esm/router/transport/fetch/routes/normalSigningRouterProxy.js +1 -1
- package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +4 -4
- package/dist/esm/router/transport/fetch/routes/sessions.js +2 -2
- 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 +4 -4
- package/dist/esm/router/transport/fetch/routes/walletExecutionLanePreflight.js +2 -2
- package/dist/esm/router/transport/fetch/routes/walletRegistration.js +3 -3
- package/dist/esm/shared-ts/src/auth/externalAuth.js +45 -0
- 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/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/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 +84 -0
- package/dist/types/wallet-server/src/auth/externalAuthService.d.ts +36 -0
- package/dist/types/wallet-server/src/auth/externalAuthStore.d.ts +61 -0
- package/dist/types/wallet-server/src/cloud-host.d.ts +2 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/oidc/d1OidcBoundary.d.ts +5 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/authorizationSnapshotLayout.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/runtime/staticWalletConsoleBinding.d.ts +2 -0
- package/dist/types/wallet-server/src/router/framework/apiCredentialPorts.d.ts +1 -0
- package/dist/types/wallet-server/src/router/framework/authServicePort.d.ts +1 -0
- package/dist/types/wallet-server/src/router/transport/fetch/routes/externalAuth.d.ts +5 -0
- package/migrations/d1-signer/0085_external_wallet_auth.sql +158 -0
- package/package.json +1 -1
|
@@ -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";
|
|
3
|
+
import { parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.js";
|
|
4
|
+
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
4
5
|
import { validateSecp256k1PublicKey33, verifySecp256k1RecoverableSignatureAgainstPublicKey33 } from "../../../../core/ThresholdService/evmCryptoWasm.js";
|
|
5
6
|
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
6
|
-
import { parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.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,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";
|
|
4
|
+
import { parseD1BoundaryWalletId, parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.js";
|
|
5
|
+
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
5
6
|
import { createServerAllocatedWalletId } from "../../../../shared-ts/src/utils/registrationIds.js";
|
|
6
7
|
import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
|
|
7
|
-
import { parseD1BoundaryWalletId, parseD1BoundaryWalletIdResult } from "../auth/d1RouterApiAuthBoundary.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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import { base64UrlDecode } from "../../../../shared-ts/src/utils/base64.js";
|
|
3
|
-
import "../../../../shared-ts/src/utils/encoders.js";
|
|
4
3
|
import { failedVerification } from "../../../../shared-ts/src/utils/failure.js";
|
|
4
|
+
import "../../../../shared-ts/src/utils/encoders.js";
|
|
5
5
|
import { toArrayBufferCopy } from "../../../../core/authService/portableCrypto.js";
|
|
6
6
|
import { toRecordValue } from "../auth/d1RouterApiAuthBoundary.js";
|
|
7
7
|
//#region src/router/cloudflare/d1/oidc/d1OidcBoundary.ts
|
|
@@ -134,6 +134,7 @@ function validateGoogleIdTokenClaims(input) {
|
|
|
134
134
|
const aud = parseJwtAud(payload.aud);
|
|
135
135
|
if (aud.length === 0) return failedVerification("invalid_claims", "Missing Google id_token aud");
|
|
136
136
|
if (!aud.includes(input.clientId)) return failedVerification("invalid_audience", "Google id_token audience mismatch");
|
|
137
|
+
const authorizedParty = normalizeOptionalTrimmedString(payload.azp);
|
|
137
138
|
const sub = normalizeOptionalTrimmedString(payload.sub);
|
|
138
139
|
if (!sub) return failedVerification("invalid_claims", "Missing Google id_token sub");
|
|
139
140
|
const email = normalizeOptionalTrimmedString(payload.email);
|
|
@@ -146,6 +147,11 @@ function validateGoogleIdTokenClaims(input) {
|
|
|
146
147
|
return {
|
|
147
148
|
ok: true,
|
|
148
149
|
sub,
|
|
150
|
+
issuer: "https://accounts.google.com",
|
|
151
|
+
audience: input.clientId,
|
|
152
|
+
expiresAtMs: exp * 1e3,
|
|
153
|
+
authorizedParty: authorizedParty || null,
|
|
154
|
+
audienceCount: aud.length,
|
|
149
155
|
...email ? { email } : {},
|
|
150
156
|
...name ? { name } : {},
|
|
151
157
|
...givenName ? { givenName } : {},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
2
2
|
import { failedVerification } from "../../../../shared-ts/src/utils/failure.js";
|
|
3
|
-
import { githubOAuthPublicConfig, verifyGithubOAuthCodeWithIdentityStore } from "../../../../core/authService/githubOAuth.js";
|
|
4
3
|
import { verifyGoogleOidcToken } from "./googleOidcToken.js";
|
|
4
|
+
import { githubOAuthPublicConfig, verifyGithubOAuthCodeWithIdentityStore } from "../../../../core/authService/githubOAuth.js";
|
|
5
5
|
//#region src/router/cloudflare/d1/oidc/d1OidcVerificationService.ts
|
|
6
6
|
function errorMessage(error) {
|
|
7
7
|
return error instanceof Error ? error.message : String(error || "");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { parseEmailOtpProviderUserId, parsePasskeyEnvelopeId, parseWalletAuthMethodId, parseWalletAuthorityBindingDigest, parseWalletAuthorityId, parseWalletId, parseWalletRecoveryOperationId, parseWebAuthnRpId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
3
|
+
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
4
4
|
import "../../../../shared-ts/src/utils/encoders.js";
|
|
5
|
+
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
6
|
import { isActiveRecoveredWalletAuthorityV1, walletAuthorityDigestsMatchV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
6
7
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
7
8
|
import { PASSKEY_PRF_FIRST_SALT_V1, PASSKEY_PRF_SECOND_SALT_V1 } from "../../../../shared-ts/src/utils/signingSessionSeal.js";
|
|
8
|
-
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
9
9
|
import { isHostWithinRpId, originHostnameOrEmpty } from "../../../../core/authService/webauthnOidcHelpers.js";
|
|
10
10
|
import { buildWalletRecoveryBackupAcknowledgementV1, walletRecoveryBackupIsOutstanding } from "../../../../shared-ts/src/wallet-recovery/backupAcknowledgement.js";
|
|
11
11
|
import "../../../../shared-ts/src/wallet-recovery/recoveryCodes.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseWalletId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { buildDelegatedWalletAuthorityV1, buildFullOwnerDelegatedWalletAuthorityV1, sameDelegatedWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
3
2
|
import { sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
3
|
+
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
4
|
+
import { buildDelegatedWalletAuthorityV1, buildFullOwnerDelegatedWalletAuthorityV1, sameDelegatedWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
4
5
|
import { sameWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
5
6
|
import { sameVerifiedActiveWalletAuthorityV1, walletAuthorityDigestsMatchV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
6
|
-
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
7
7
|
import { D1WalletAuthMethodStore } from "../../../../core/d1WalletAuthMethodStore.js";
|
|
8
8
|
import { parsePasskeyCustodyEnvelopeRecord } from "../../../../shared-ts/src/passkey-custody/custodyEnvelope.js";
|
|
9
9
|
import "../../../../shared-ts/src/passkey-custody/index.js";
|
package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpRecords.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parsePasskeyEnvelopeId, parseWalletAuthMethodId, parseWalletAuthorityId, parseWalletId, parseWalletRecoveryOperationId, parseWebAuthnCredentialIdB64u, parseWebAuthnRpId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
4
3
|
import { parseEnvelopeRevision } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
4
|
+
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
5
|
import { parseWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
6
6
|
import { parseWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
7
7
|
import { hasExactKeys } from "../../../../shared-ts/src/utils/exactKeys.js";
|
package/dist/esm/router/cloudflare/d1/passkeyCustody/d1WalletRecoveryGoogleEmailOtpService.js
CHANGED
|
@@ -2,9 +2,9 @@ import { parseProviderSubject, parseVerifiedGoogleEmail } from "../../../../shar
|
|
|
2
2
|
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
3
3
|
import { alphabetizeStringify, sha256BytesUtf8, sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
4
4
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
5
|
+
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
5
6
|
import "../../../../shared-ts/src/utils/encoders.js";
|
|
6
7
|
import { buildWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
7
|
-
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
8
8
|
import { consumeReservedRecoveryCode } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeReservation.js";
|
|
9
9
|
import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
|
|
10
10
|
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_UNLOCK_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseRootShareEpoch } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
+
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
2
3
|
import { deriveEvmFamilySigningKeySlotId } from "../../../../shared-ts/src/signing-lanes/evmFamilySigningKeySlotId.js";
|
|
3
4
|
import { computeEcdsaDerivationRoleLocalRelayerKeyId, computeEcdsaDerivationRoleLocalThresholdKeyId, computeSdkEcdsaDerivationApplicationBindingDigestB64u, parseSdkEcdsaDerivationSigningRootId, parseSdkEcdsaDerivationSigningRootVersion, parseSdkEcdsaDerivationThresholdKeyId } from "../../../../shared-ts/src/threshold/ecdsaDerivationRoleLocalBootstrap.js";
|
|
4
5
|
import { buildRouterAbEcdsaDerivationActiveStateIdV1 } from "../../../../shared-ts/src/utils/routerAbEcdsaDerivation.js";
|
|
5
6
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
6
|
-
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
7
7
|
import "./d1RegistrationCeremonyRecords.js";
|
|
8
8
|
//#region src/router/cloudflare/d1/registration/d1EvmFamilyEcdsaRegistrationBranch.ts
|
|
9
9
|
const REGISTRATION_WALLET_SIGNING_SESSION_REMAINING_USES = 3;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { parseChallengeSubjectId, parseEmailOtpChallengeId, parseOrgId, parseProviderSubject, parseRootShareEpoch, parseWalletAuthMethodId, parseWalletAuthorityId, parseWebAuthnRpId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
4
3
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
4
|
+
import { toRecordValue } from "../auth/d1RouterApiAuthBoundary.js";
|
|
5
|
+
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
6
|
import { parseWalletAddAuthMethodRegistrationOptions } from "../../../../shared-ts/src/utils/addAuthMethodRegistration.js";
|
|
6
7
|
import { parseRouterAbMpcMaterialActivationRef } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
7
8
|
import { parseRouterAbEd25519YaoRegistrationActivationAdmissionReceiptV1, parseRouterAbEd25519YaoRegistrationActivationResultV1, parseRouterAbEd25519YaoRegistrationAdmissionRequestV1 } from "../../../../shared-ts/src/utils/routerAbEd25519Yao.js";
|
|
@@ -27,7 +28,6 @@ import { parseImplicitNearAccountId, parseNamedNearAccountId } from "../../../..
|
|
|
27
28
|
import { findRegistrationSignerPlanNearEd25519Branch, normalizeAddSignerSelection, normalizeRegistrationSignerPlan, registrationSignerBranchKeyFromString, registrationSignerSetSelectionFromPlan } from "../../../../shared-ts/src/utils/registrationSignerPlan.js";
|
|
28
29
|
import { addAuthMethodIntentGrantFromString, addSignerIntentGrantFromString, normalizeAddAuthMethodIntentCaller } from "../../../../shared-ts/src/utils/registrationIntent.js";
|
|
29
30
|
import { parseEcdsaDerivationPublicIdentity, parseThresholdEd25519AuthorityScope, thresholdEd25519AuthorityScopeFromWalletAuthAuthority, thresholdEd25519AuthorityScopesMatch } from "../../../../core/ThresholdService/validation.js";
|
|
30
|
-
import { toRecordValue } from "../auth/d1RouterApiAuthBoundary.js";
|
|
31
31
|
import { parseStoredRegistrationSignerPlan, parseStoredWalletRegistrationPreparedContext, storedRegistrationSignerPlansMatch } from "../../../../core/RegistrationCeremonyStore.js";
|
|
32
32
|
import { parseStoredRouterAbEcdsaPendingActivationV1 } from "../../../domains/ecdsa/routerAbEcdsaStrictRegistration.js";
|
|
33
33
|
//#region src/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseWalletAuthMethodId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
3
|
+
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
3
4
|
import { normalizeAddAuthMethodInput } from "../../../../shared-ts/src/utils/registrationAuthMethodInput.js";
|
|
4
5
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
5
|
-
import { failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
6
6
|
import { thresholdEcdsaChainTargetFromValue } from "../../../../core/thresholdEcdsaChainTarget.js";
|
|
7
7
|
import { normalizeAddSignerSelection } from "../../../../shared-ts/src/utils/registrationSignerPlan.js";
|
|
8
8
|
import { addAuthMethodIntentGrantFromString, addSignerIntentGrantFromString, computeAddAuthMethodIntentDigestB64u, computeAddSignerIntentDigestB64u } from "../../../../shared-ts/src/utils/registrationIntent.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseWalletAuthMethodId, parseWalletAuthorityId, parseWalletId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
3
|
+
import { parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
3
4
|
import { parseWalletAuthMethodRecordV2, sameWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
4
5
|
import { parseWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
5
6
|
import { buildWalletSessionCapabilitySubjectsV1 } from "../../../../authorization/domain.js";
|
|
6
|
-
import { parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
7
7
|
import { prepareD1WalletPutSignerStatement, prepareD1WalletPutSubjectStatement } from "../../../../core/d1WalletStore.js";
|
|
8
8
|
import { prepareD1WalletAuthMethodV2PutStatement } from "../../../../core/d1WalletAuthMethodStore.js";
|
|
9
9
|
import { reservePasskeyCredential } from "../../../../core/passkeyCredentialClaims.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseThresholdEd25519SessionId, parseWalletKeyId, parseWebAuthnCredentialIdB64u } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
4
|
-
import { buildFullOwnerPermissionsV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
5
3
|
import { base64UrlDecode, base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
6
4
|
import { alphabetizeStringify, bytesToUnprefixedHex, sha256BytesUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
7
5
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
8
6
|
import { parseEd25519PublicKeyB64u, parseSecp256k1CompressedPublicKeyB64u } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
9
7
|
import "../../../../shared-ts/src/utils/encoders.js";
|
|
8
|
+
import { parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
9
|
+
import { buildFullOwnerPermissionsV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
10
10
|
import { buildExactAdministeredSignerManifestV1 } from "../../../../shared-ts/src/device-linking/delegatedActivationPlan.js";
|
|
11
11
|
import { routerAbMpcMaterialActivationRefFromWire, routerAbMpcMaterialActivationRefToWire, sameRouterAbMpcMaterialActivationRef } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
12
12
|
import { deriveRouterAbEd25519YaoRuntimePolicyBindingV1 } from "../../../../shared-ts/src/utils/routerAbEd25519YaoDigests.js";
|
|
@@ -17,6 +17,7 @@ import { isEmailOtpWalletAuthAuthority, isPasskeyWalletAuthAuthority, walletAuth
|
|
|
17
17
|
import { ROUTER_AB_ECDSA_DERIVATION_NORMAL_SIGNING_STATE_KIND_V1, buildRouterAbEcdsaDerivationActiveStateIdV1, buildRouterAbEcdsaDerivationPublicCapabilityV1, parseRouterAbEcdsaDerivationNormalSigningStateV1, sameRouterAbEcdsaDerivationNormalSigningStateV1, sameRouterAbEcdsaDerivationPublicCapabilityV1, sameRouterAbEcdsaRegistrationActivationReceiptV1, sameRouterAbEcdsaVerifiedClientActivationFactsV1, sameRouterAbPublicDigest32V1Wire } from "../../../../shared-ts/src/utils/routerAbEcdsaDerivation.js";
|
|
18
18
|
import { buildWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
19
19
|
import { buildActiveWalletAuthorityV1, buildWalletSignerActivationSetV1, computeWalletAuthorityDigestB64u, computeWalletSignerActivationSetDigestB64u, extendEcdsaWalletAuthorityWithEd25519, isActiveEcdsaWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
20
|
+
import { createRouterAbTraceContextV1 } from "../../../../shared-ts/src/utils/routerAbTraceContext.js";
|
|
20
21
|
import { ROUTER_AB_ED25519_NORMAL_SIGNING_STATE_KIND } from "../../../../shared-ts/src/utils/signingSessionSeal.js";
|
|
21
22
|
import { normalizeThresholdEd25519ParticipantIds } from "../../../../shared-ts/src/threshold/participants.js";
|
|
22
23
|
import { nearEd25519SigningKeyIdFromString, registrationEd25519AuthorityScopeFromAuthority, walletIdFromString } from "../../../../shared-ts/src/utils/registrationIds.js";
|
|
@@ -27,7 +28,6 @@ import "../../../../shared-ts/src/passkey-custody/index.js";
|
|
|
27
28
|
import { parseImplicitNearAccountId, parseNamedNearAccountId } from "../../../../shared-ts/src/utils/near.js";
|
|
28
29
|
import { registrationNearEd25519BranchKey } from "../../../../shared-ts/src/utils/registrationSignerPlan.js";
|
|
29
30
|
import { registrationIntentGrantFromString } from "../../../../shared-ts/src/utils/registrationIntent.js";
|
|
30
|
-
import { createRouterAbTraceContextV1 } from "../../../../shared-ts/src/utils/routerAbTraceContext.js";
|
|
31
31
|
import { buildTenantRootIdentityFromAuthenticatedDeploymentV1 } from "../../../../shared-ts/src/tenant-root/tenantRootIdentity.js";
|
|
32
32
|
import { DEFAULT_WALLET_SESSION_TTL_MS } from "../../../../shared-ts/src/threshold/sessionPolicy.js";
|
|
33
33
|
import { parseEcdsaDerivationPublicIdentity, thresholdEd25519AuthorityScopeFromWalletAuthAuthority } from "../../../../core/ThresholdService/validation.js";
|
package/dist/esm/router/cloudflare/d1/registration/walletRegistrationEstablishedSessionIssuer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseEmailOtpChallengeId, parseThresholdEcdsaSessionId, parseThresholdEd25519SessionId, parseWebAuthnCredentialIdB64u } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseAuthFactorId, parsePrincipalId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
4
3
|
import { alphabetizeStringify, sha256BytesUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
5
4
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
6
5
|
import "../../../../shared-ts/src/utils/encoders.js";
|
|
6
|
+
import { parseAuthFactorId, parsePrincipalId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
7
7
|
import { routerAbMpcMaterialActivationRefFromWire } from "../../../../shared-ts/src/utils/routerAbNormalSigningIdentity.js";
|
|
8
8
|
import { isEmailOtpWalletAuthAuthority, walletAuthAuthorityRef } from "../../../../shared-ts/src/utils/walletAuthAuthority.js";
|
|
9
9
|
import { parseSessionOrigin, parseVerifiedOwnerProofId } from "../../../../authorization/domain.js";
|
package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseWalletAuthMethodId, parseWalletId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
3
|
+
import { parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
4
4
|
import { parseWalletAuthAuthority } from "../../../../shared-ts/src/utils/walletAuthAuthority.js";
|
|
5
5
|
import { parseWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
6
6
|
import { parseWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
package/dist/esm/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPlainObject, requireNonEmptyString } from "../../../../shared-ts/src/utils/validation.js";
|
|
2
|
-
import { normalizeRuntimePolicyScope } from "../../../../shared-ts/src/threshold/signingRootScope.js";
|
|
3
2
|
import { isD1DatabaseLike, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
3
|
+
import { normalizeRuntimePolicyScope } from "../../../../shared-ts/src/threshold/signingRootScope.js";
|
|
4
4
|
import { ED25519_SIGNER_ACTIVATION_ID_PATH } from "../../../../core/d1WalletStore.js";
|
|
5
5
|
import { abusePrincipalKey, runtimePolicyScopeKey } from "../../../domains/signingOperations/routerAbNormalSigningAdmissionCore.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
2
1
|
import { alphabetizeStringify } from "../../../../shared-ts/src/utils/digests.js";
|
|
3
2
|
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
3
|
+
import { d1ChangedRows, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
4
|
+
import { parseWalletSessionMintId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
4
5
|
import { buildVoiceIdWalletSessionChallenge, parseVoiceIdWalletSessionChallenge } from "../../../../shared-ts/src/authorization/voiceIdDeviceAssertion.js";
|
|
5
6
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
6
|
-
import { d1ChangedRows, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
7
7
|
//#region src/router/cloudflare/d1/wallet/d1VoiceIdWalletSessionChallenges.ts
|
|
8
8
|
const CHALLENGE_LIFETIME_MS = 6e4;
|
|
9
9
|
const EXPIRY_CLEANUP_LIMIT = 64;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
2
2
|
import { alphabetizeStringify, sha256BytesUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
3
3
|
import "../../../../shared-ts/src/utils/encoders.js";
|
|
4
|
-
import { parseLinkedDeviceRevokeResultV1 } from "../../../../shared-ts/src/device-linking/deviceManagement.js";
|
|
5
4
|
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
5
|
+
import { parseLinkedDeviceRevokeResultV1 } from "../../../../shared-ts/src/device-linking/deviceManagement.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/wallet/d1WalletAuthMethodRevocationReplayStore.ts
|
|
7
7
|
const REVOCATION_PROOF_DIGEST_DOMAIN_V1 = "seams/wallet-auth-method-revocation-proof/v1";
|
|
8
8
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { parseChallengeSubjectId, parseEmailOtpChallengeId, parseOrgId, parseProviderSubject, parseWalletAuthMethodId, parseWebAuthnCredentialIdB64u, parseWebAuthnRpId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
3
|
-
import { buildDelegatedWalletAuthorityV1, buildFullOwnerPermissionsV1, sameDelegatedWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
4
3
|
import { base64UrlDecode, base64UrlEncode } from "../../../../shared-ts/src/utils/base64.js";
|
|
5
4
|
import { alphabetizeStringify } from "../../../../shared-ts/src/utils/digests.js";
|
|
6
5
|
import "../../../../shared-ts/src/utils/encoders.js";
|
|
6
|
+
import { toRecordValue } from "../auth/d1RouterApiAuthBoundary.js";
|
|
7
|
+
import { buildDelegatedWalletAuthorityV1, buildFullOwnerPermissionsV1, sameDelegatedWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
7
8
|
import { parseWalletAddAuthMethodRegistrationOptions } from "../../../../shared-ts/src/utils/addAuthMethodRegistration.js";
|
|
8
9
|
import { normalizeRuntimePolicyScope } from "../../../../shared-ts/src/threshold/signingRootScope.js";
|
|
9
10
|
import { buildEmailOtpWalletAuthAuthority, walletAuthAuthorityRef } from "../../../../shared-ts/src/utils/walletAuthAuthority.js";
|
|
@@ -19,7 +20,6 @@ import { addAuthMethodIntentGrantFromString, computeAddAuthMethodIntentDigestB64
|
|
|
19
20
|
import { parseWebAuthnClientDataJsonBase64url, webAuthnOriginHostnameOrEmpty } from "../../../auth/webAuthnCredentialCodecs.js";
|
|
20
21
|
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_UNLOCK_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
21
22
|
import { resolveWalletAuthMethodIdForAuthority } from "../../../../core/signingLanes/WalletExecutionLaneProjection.js";
|
|
22
|
-
import { toRecordValue } from "../auth/d1RouterApiAuthBoundary.js";
|
|
23
23
|
import { d1HostIsWithinWebAuthnRpId, resolveD1AddAuthMethodExistingAuth, resolveD1AddSignerExistingAuth, verifyD1LinkedDeviceFreshRevokeProofV1, walletAuthAuthorityFromRegistrationAuthority } from "./d1WalletAuthMethodBoundary.js";
|
|
24
24
|
import { parseWalletIdForIntent } from "../registration/d1RegistrationCeremonyRecords.js";
|
|
25
25
|
import { admitAddWalletAuthMethod } from "../../../../shared-ts/src/utils/addWalletAuthMethod.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { mpcMaterialActivationRefsEqual, parseLinkDeviceSessionId, parseLinkedDeviceEnrollmentId, parseWalletAuthorityId, parseWalletId, parseWalletRecoveryOperationId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
+
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
3
|
+
import { d1ChangedRows, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
2
4
|
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
5
|
import { parseDelegatedWalletPermissionSetV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
4
|
-
import { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
5
6
|
import { parseWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
6
7
|
import { buildRevokedWalletAuthorityV1, computeWalletAuthorityDigestB64u, parseWalletAuthorityV1, parseWalletSignerActivationSetV1, walletAuthorityDigestsMatchV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
7
8
|
import { buildWalletSessionCapabilitySubjectsV1 } from "../../../../authorization/domain.js";
|
|
8
|
-
import { d1ChangedRows, parseD1JsonColumn } from "../../../../storage/d1Sql.js";
|
|
9
9
|
import { prepareD1WalletPutSignerStatement } from "../../../../core/d1WalletStore.js";
|
|
10
10
|
import { prepareD1WalletAuthMethodV2PutStatement } from "../../../../core/d1WalletAuthMethodStore.js";
|
|
11
11
|
import { prepareD1WalletSessionAuthorityProjectionStatements } from "../authorization/walletSessionAuthorityProjection.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { requireCanonicalString, requireRecord } from "../../../../shared-ts/src/utils/validation.js";
|
|
2
2
|
import { parseUnixMs } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
3
|
-
import { parseNonNegativeSafeInteger } from "../../../../shared-ts/src/device-linking/wireFields.js";
|
|
4
3
|
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
5
4
|
import { prepareD1TenantStatement } from "../../../../core/d1TenantStore.js";
|
|
5
|
+
import { parseNonNegativeSafeInteger } from "../../../../shared-ts/src/device-linking/wireFields.js";
|
|
6
6
|
import { evictWalletEd25519CapabilityCache } from "../ed25519Yao/d1Ed25519YaoProductRegistrationPartitionedStateStore.js";
|
|
7
7
|
import { AuthorizationSnapshotLayout } from "./authorizationSnapshotLayout.js";
|
|
8
8
|
//#region src/router/cloudflare/d1/wallet/d1WalletAuthorizationCleanup.ts
|
|
@@ -35,6 +35,7 @@ const TABLES = [
|
|
|
35
35
|
"wallet_recovery_code_locators",
|
|
36
36
|
"wallets",
|
|
37
37
|
"wallet_auth_methods",
|
|
38
|
+
"external_auth_associations",
|
|
38
39
|
"wallet_relocation_approvals",
|
|
39
40
|
"wallet_authorities",
|
|
40
41
|
"wallet_relocation_authorization_import_receipts",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { requireCanonicalString, requireRecord } from "../../../../shared-ts/src/utils/validation.js";
|
|
2
2
|
import { sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
3
3
|
import { parseUnixMs } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
4
|
-
import { parseNonNegativeSafeInteger } from "../../../../shared-ts/src/device-linking/wireFields.js";
|
|
5
4
|
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
6
5
|
import { prepareD1TenantStatement } from "../../../../core/d1TenantStore.js";
|
|
6
|
+
import { parseNonNegativeSafeInteger } from "../../../../shared-ts/src/device-linking/wireFields.js";
|
|
7
7
|
import { AuthorizationSnapshotLayout } from "./authorizationSnapshotLayout.js";
|
|
8
8
|
import { D1WalletAuthorizationHistory } from "./d1WalletAuthorizationHistory.js";
|
|
9
9
|
import "./d1WalletAuthorizationSnapshot.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { requireCanonicalString } from "../../../../shared-ts/src/utils/validation.js";
|
|
2
2
|
import { sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
3
|
-
import { parseNonNegativeSafeInteger } from "../../../../shared-ts/src/device-linking/wireFields.js";
|
|
4
3
|
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
5
4
|
import { prepareD1TenantStatement } from "../../../../core/d1TenantStore.js";
|
|
5
|
+
import { parseNonNegativeSafeInteger } from "../../../../shared-ts/src/device-linking/wireFields.js";
|
|
6
6
|
import { AuthorizationSnapshotLayout } from "./authorizationSnapshotLayout.js";
|
|
7
7
|
//#region src/router/cloudflare/d1/wallet/d1WalletAuthorizationSnapshot.ts
|
|
8
8
|
const CHUNK_BYTES = 32768;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseWalletAuthMethodId, parseWalletAuthorityId, parseWalletId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
2
|
import { isPlainObject, requireCanonicalString } from "../../../../shared-ts/src/utils/validation.js";
|
|
3
|
+
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
3
4
|
import { parseSessionOrigin } from "../../../../authorization/domain.js";
|
|
4
5
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
5
|
-
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/wallet/d1WalletRelocationChallenges.ts
|
|
7
7
|
const MAX_CHALLENGE_LIFETIME_MS = 3e5;
|
|
8
8
|
var WalletRelocationChallengeBinding = class WalletRelocationChallengeBinding {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { buildDelegatedWalletAuthorityV1, buildFullOwnerPermissionsV1, sameDelegatedWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
2
1
|
import { sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
2
|
+
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
3
|
+
import { buildDelegatedWalletAuthorityV1, buildFullOwnerPermissionsV1, sameDelegatedWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/delegatedAuthority.js";
|
|
3
4
|
import { buildWalletSessionCapabilitySubjectsV1, parseSessionOrigin, walletSessionCapabilitySubjectsV1Equal } from "../../../../authorization/domain.js";
|
|
4
5
|
import { digestOpaqueValue } from "../../../../authorization/service.js";
|
|
5
|
-
import { D1_BATCH_CAS_GUARD_SQL } from "../../../../storage/d1Sql.js";
|
|
6
6
|
import { extractBearerCredential } from "../../../auth/routerApiKeyAuth.js";
|
|
7
7
|
import { WalletRelocationChallengeBinding } from "./d1WalletRelocationChallenges.js";
|
|
8
8
|
//#region src/router/cloudflare/d1/wallet/d1WalletRelocationOwnerRequest.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
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 { parseDigestB64u } from "../../../../shared-ts/src/utils/canonicalPrimitives.js";
|
|
4
|
+
import { failedVerification, failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
5
|
+
import { nonNegativeSafeInteger, optionalNonNegativeInteger, parseD1BoundaryWalletId, parseD1BoundaryWalletIdResult, parseJsonObject } from "../auth/d1RouterApiAuthBoundary.js";
|
|
4
6
|
import { WalletLifecycleLocator } from "../../../../authorization/lifecycleRouting.js";
|
|
5
7
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
6
|
-
import { failedVerification, failure } from "../../../../shared-ts/src/utils/failure.js";
|
|
7
8
|
import { decodeWebAuthnBase64UrlOrBase64, parseWebAuthnAuthenticationCredential, parseWebAuthnClientDataJsonBase64url, webAuthnCredentialIdB64uFromCredential, webAuthnOriginHostnameOrEmpty } from "../../../auth/webAuthnCredentialCodecs.js";
|
|
8
|
-
import { nonNegativeSafeInteger, optionalNonNegativeInteger, parseD1BoundaryWalletId, parseD1BoundaryWalletIdResult, parseJsonObject } from "../auth/d1RouterApiAuthBoundary.js";
|
|
9
9
|
import { parseWebAuthnAuthenticatorRowDeviceInfo, webAuthnSyncWalletBindingFromCredentialBinding } from "./d1WebAuthnRecords.js";
|
|
10
10
|
import { d1HostIsWithinWebAuthnRpId } from "../wallet/d1WalletAuthMethodBoundary.js";
|
|
11
11
|
import { webAuthnAuthenticationFailure, webAuthnLoginEd25519, webAuthnSyncCredentialBinding } from "../../../../core/authService/webauthnVerificationOutcomes.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { parsePasskeyEnvelopeId, parseWalletAuthMethodId, parseWalletAuthorityId, parseWalletId, parseWalletRecoveryOperationId, parseWebAuthnCredentialIdB64u, parseWebAuthnRpId } from "../../../../shared-ts/src/utils/domainIds.js";
|
|
2
|
-
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
3
2
|
import { normalizeOptionalTrimmedString } from "../../../../shared-ts/src/utils/normalize.js";
|
|
4
3
|
import { parseEnvelopeRevision } from "../../../../shared-ts/src/passkey-custody/primitives.js";
|
|
4
|
+
import { nonNegativeSafeInteger, optionalNonNegativeInteger, positiveInteger } from "../auth/d1RouterApiAuthBoundary.js";
|
|
5
|
+
import { parseDeviceId } from "../../../../shared-ts/src/authorization/capabilityKinds.js";
|
|
5
6
|
import { normalizeRuntimePolicyScope } from "../../../../shared-ts/src/threshold/signingRootScope.js";
|
|
6
7
|
import { parseWalletAuthMethodRecordV2 } from "../../../../shared-ts/src/utils/walletAuthMethodRecord.js";
|
|
7
8
|
import { parseWalletAuthorityV1 } from "../../../../shared-ts/src/authorization/walletAuthority.js";
|
|
@@ -9,7 +10,6 @@ import { parseWebAuthnAuthenticatorDeviceInfoJson } from "../../../../shared-ts/
|
|
|
9
10
|
import { hasExactKeys } from "../../../../shared-ts/src/utils/exactKeys.js";
|
|
10
11
|
import "../../../../shared-ts/src/passkey-custody/index.js";
|
|
11
12
|
import { parseRecoveryCodeReservationId } from "../../../../shared-ts/src/wallet-recovery/recoveryCodeReservation.js";
|
|
12
|
-
import { nonNegativeSafeInteger, optionalNonNegativeInteger, positiveInteger } from "../auth/d1RouterApiAuthBoundary.js";
|
|
13
13
|
//#region src/router/cloudflare/d1/webauthn/d1WebAuthnRecords.ts
|
|
14
14
|
function parseWebAuthnAuthenticatorRowDeviceInfo(raw) {
|
|
15
15
|
return parseWebAuthnAuthenticatorDeviceInfoJson(raw);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseExternalAuthConfiguration } from "../../../shared-ts/src/auth/externalAuth.js";
|
|
1
2
|
import { failure } from "../../../shared-ts/src/utils/failure.js";
|
|
2
3
|
import { ROUTER_API_CREDENTIAL_SCOPES } from "../../framework/apiCredentialPorts.js";
|
|
3
4
|
import { WALLET_CONSOLE_OP_PATHS_V1, decodeWalletConsoleTenantRootActiveLineageRequestV1 } from "./walletConsoleOps.js";
|
|
@@ -16,6 +17,10 @@ function parseStaticWalletConsoleBindingConfigV1(value) {
|
|
|
16
17
|
scopes: requiredScopeList(credential.scopes)
|
|
17
18
|
},
|
|
18
19
|
deployment: {
|
|
20
|
+
externalAuth: parseExternalAuthConfiguration(deployment.externalAuth ?? {
|
|
21
|
+
kind: "disabled",
|
|
22
|
+
revision: 0
|
|
23
|
+
}),
|
|
19
24
|
orgId: requiredConfigText(deployment.orgId, "deployment.orgId"),
|
|
20
25
|
projectId: requiredConfigText(deployment.projectId, "deployment.projectId"),
|
|
21
26
|
environmentId: requiredConfigText(deployment.environmentId, "deployment.environmentId"),
|
|
@@ -97,6 +102,10 @@ function registrationContextResponse(config, value) {
|
|
|
97
102
|
}
|
|
98
103
|
function projectEnvironment(config) {
|
|
99
104
|
return {
|
|
105
|
+
externalAuth: config.deployment.externalAuth ?? {
|
|
106
|
+
kind: "disabled",
|
|
107
|
+
revision: 0
|
|
108
|
+
},
|
|
100
109
|
id: config.deployment.environmentId,
|
|
101
110
|
projectId: config.deployment.projectId,
|
|
102
111
|
key: config.deployment.environmentKey,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseExternalAuthConfiguration } from "../../../shared-ts/src/auth/externalAuth.js";
|
|
1
2
|
import { ROUTER_API_CREDENTIAL_SCOPES } from "../../framework/apiCredentialPorts.js";
|
|
2
3
|
import { unavailableRegistrationContext, walletRegistrationContext } from "../../auth/walletRegistrationContext.js";
|
|
3
4
|
import { WALLET_CONSOLE_OP_PATHS_V1, WALLET_CONSOLE_SERVICE_ORIGIN_V1, decodeWalletConsoleTenantRootActiveLineageResponseV1 } from "./walletConsoleOps.js";
|
|
@@ -23,6 +24,7 @@ const PRINCIPAL_FIELDS = new Set([
|
|
|
23
24
|
"scopes"
|
|
24
25
|
]);
|
|
25
26
|
const PROJECT_ENVIRONMENT_FIELDS = new Set([
|
|
27
|
+
"externalAuth",
|
|
26
28
|
"id",
|
|
27
29
|
"projectId",
|
|
28
30
|
"key",
|
|
@@ -143,6 +145,10 @@ function parseProjectEnvironment(value) {
|
|
|
143
145
|
projectId,
|
|
144
146
|
key,
|
|
145
147
|
signingRootVersion,
|
|
148
|
+
externalAuth: parseExternalAuthConfiguration(record.externalAuth ?? {
|
|
149
|
+
kind: "disabled",
|
|
150
|
+
revision: 0
|
|
151
|
+
}),
|
|
146
152
|
...status ? { status } : {}
|
|
147
153
|
};
|
|
148
154
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ROUTER_AB_PUBLIC_KEYSET_PATH, ROUTER_AB_PUBLIC_KEYSET_VERSION_V2, ROUTER_AB_PUBLIC_KEYSET_WELL_KNOWN_PATH, parseRouterAbPublicKeysetV2 } from "../shared-ts/src/utils/routerAbPublicKeyset.js";
|
|
2
|
-
import { defineRoute, matchesRouteDefinitionRequest } from "./framework/routeDefinitions.js";
|
|
3
2
|
import { extractBearerCredential, extractRouterApiEnvironmentId, resolveSourceIpFromFetchHeaders } from "./auth/routerApiKeyAuth.js";
|
|
3
|
+
import { defineRoute, matchesRouteDefinitionRequest } from "./framework/routeDefinitions.js";
|
|
4
4
|
import { InMemoryRouterAbNormalSigningAdmissionStore, createInMemoryRouterAbNormalSigningAdmissionAdapter, createInMemoryRouterAbNormalSigningAdmissionStore, createRouterAbNormalSigningAdmissionAdapter } from "./domains/signingOperations/routerAbNormalSigningAdmissionCore.js";
|
|
5
5
|
import { CloudflareD1RouterAbNormalSigningAdmissionStore, createCloudflareD1RouterAbNormalSigningAdmissionStore } from "./cloudflare/d1/signingAdmission/d1RouterAbNormalSigningAdmissionStore.js";
|
|
6
6
|
import { getRouterApiRouteExtensionRoutes } from "./framework/routeExtensions.js";
|