@seams/wallet-server 0.28.0 → 0.30.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 +23 -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 +58 -7
- package/dist/esm/auth/externalAuthStore.js +157 -21
- package/dist/esm/auth/externalOwnerOperations.js +82 -0
- package/dist/esm/cloud-host.js +4 -4
- package/dist/esm/core/nearRelayerAccountProvisioning.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 +22 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRecoveryService.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1EmailOtpRegistrationEnrollmentFinalizer.js +1 -1
- package/dist/esm/router/cloudflare/d1/emailOtp/d1GoogleEmailOtpSessionResolver.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/d1WalletRecoveryGoogleEmailOtpService.js +2 -2
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +9 -0
- package/dist/esm/router/cloudflare/d1/registration/d1WalletExecutionAuthority.js +9 -16
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +43 -1
- 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/walletRegistrationSessionCommitReceipt.js +35 -0
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodBoundary.js +1 -1
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAuthMethodService.js +4 -3
- package/dist/esm/router/cloudflare.js +1785 -1489
- package/dist/esm/router/domains/ed25519Yao/export/routerAbEd25519YaoExport.js +2 -2
- package/dist/esm/router/domains/emailOtp/emailOtpRouteHandlers.js +1 -1
- package/dist/esm/router/domains/passkeyCustody/walletCustodyRegistrationCommit.js +1 -1
- package/dist/esm/router/domains/signingOperations/routerAbEd25519NormalSigningRoute.js +35 -1
- package/dist/esm/router/domains/walletRegistration/walletRegistrationReservation.js +17 -2
- package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +9 -1
- package/dist/esm/router/domains/walletUnlock/walletUnlockRouteHandlers.js +1 -1
- package/dist/esm/router/transport/fetch/routes/ecdsaOperationStepUpFactor.js +2 -2
- package/dist/esm/router/transport/fetch/routes/externalAuth.js +139 -32
- package/dist/esm/router/transport/fetch/routes/passkeyCustody.js +44 -304
- package/dist/esm/router/transport/fetch/routes/sessions.js +2 -2
- package/dist/esm/router/transport/fetch/routes/thresholdEd25519.js +2 -2
- package/dist/esm/router/transport/fetch/routes/walletRegistration.js +2 -2
- package/dist/esm/router/transport/fetch/walletOwnerOperationAuthorization.js +306 -0
- package/dist/esm/shared-ts/src/auth/externalAuth.js +87 -14
- package/dist/esm/shared-ts/src/authorization/index.js +1 -1
- package/dist/esm/shared-ts/src/authorization/{walletCustodyOperation.js → walletOwnerOperation.js} +4 -4
- package/dist/esm/shared-ts/src/wallet-recovery/index.js +3 -3
- package/dist/esm/wasm/evm_crypto/pkg/evm_crypto_bg.wasm +0 -0
- package/dist/esm/wasm/near_signer/pkg/wasm_signer_worker_bg.wasm +0 -0
- package/dist/esm/wasm/shamir3pass_runtime/pkg/shamir3pass_runtime_bg.wasm +0 -0
- package/dist/types/shared-ts/src/auth/externalAuth.d.ts +51 -8
- 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 +29 -10
- package/dist/types/wallet-server/src/auth/externalAuthStore.d.ts +60 -6
- package/dist/types/wallet-server/src/auth/externalOwnerOperations.d.ts +18 -0
- package/dist/types/wallet-server/src/cloud-host.d.ts +1 -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/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/d1WalletAuthMethodService.d.ts +1 -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/authServicePort.d.ts +11 -0
- package/dist/types/wallet-server/src/router/transport/fetch/walletOwnerOperationAuthorization.d.ts +23 -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
package/dist/esm/router/cloudflare/d1/registration/walletRegistrationSessionCommitReceipt.js
CHANGED
|
@@ -12,6 +12,7 @@ import "../../../../shared-ts/src/passkey-custody/index.js";
|
|
|
12
12
|
/** The home activation that a commit left for the record that completes its operation. */
|
|
13
13
|
function registrationCommitActivation(execution) {
|
|
14
14
|
switch (execution.kind) {
|
|
15
|
+
case "owner_registered":
|
|
15
16
|
case "session_issued":
|
|
16
17
|
case "session_issued_with_installation_projection": return execution.activation;
|
|
17
18
|
case "unissued":
|
|
@@ -45,6 +46,7 @@ function projectRegistrationEstablishedSessionV2(session) {
|
|
|
45
46
|
}
|
|
46
47
|
function projectRegistrationEstablishedSessionResultV2(result) {
|
|
47
48
|
switch (result.kind) {
|
|
49
|
+
case "owner_operations": throw new Error("Owner registration has no session projection");
|
|
48
50
|
case "issued": return projectRegistrationEstablishedSessionV2(result.session);
|
|
49
51
|
case "already_committed": return result.session;
|
|
50
52
|
default: return assertNeverRegistrationSessionResult(result);
|
|
@@ -55,6 +57,21 @@ function assertNeverRegistrationSessionResult(value) {
|
|
|
55
57
|
}
|
|
56
58
|
function projectWalletRegistrationSessionCommitReceiptV2(input) {
|
|
57
59
|
const response = input.execution.response;
|
|
60
|
+
if (input.execution.kind === "owner_registered") {
|
|
61
|
+
if (input.operation !== "near_provisioning" || !response.ok || response.kind !== "near_ed25519" || !("registrationEstablishedSession" in response) || response.registrationEstablishedSession.kind !== "owner_operations") throw new Error("Invalid owner registration receipt");
|
|
62
|
+
const { registrationEstablishedSession, ...finalized } = response;
|
|
63
|
+
return {
|
|
64
|
+
kind: "wallet_registration_session_commit_receipt_v2",
|
|
65
|
+
operation: "near_provisioning",
|
|
66
|
+
operationFingerprint: input.operationFingerprint,
|
|
67
|
+
registrationCeremonyId: input.registrationCeremonyId,
|
|
68
|
+
committed: {
|
|
69
|
+
kind: "near_owner_ready",
|
|
70
|
+
expectedOrigin: input.execution.expectedOrigin,
|
|
71
|
+
response: finalized
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
58
75
|
if (!response.ok) {
|
|
59
76
|
if (input.execution.kind !== "unissued") throw new Error("Registration error receipt has an issued-session marker");
|
|
60
77
|
return {
|
|
@@ -208,6 +225,24 @@ function parseWalletRegistrationSessionCommitReceiptV2(raw, parseCommitted) {
|
|
|
208
225
|
}
|
|
209
226
|
};
|
|
210
227
|
}
|
|
228
|
+
if (committedRecord.kind === "near_owner_ready") {
|
|
229
|
+
if (operation !== "near_provisioning" || !hasExactKeys(record, [
|
|
230
|
+
"kind",
|
|
231
|
+
"operation",
|
|
232
|
+
"operationFingerprint",
|
|
233
|
+
"registrationCeremonyId",
|
|
234
|
+
"committed"
|
|
235
|
+
])) return null;
|
|
236
|
+
const committed = parseCommitted(record.committed);
|
|
237
|
+
if (!committed || committed.kind !== "near_owner_ready") return null;
|
|
238
|
+
return {
|
|
239
|
+
kind: "wallet_registration_session_commit_receipt_v2",
|
|
240
|
+
operation,
|
|
241
|
+
operationFingerprint,
|
|
242
|
+
registrationCeremonyId,
|
|
243
|
+
committed
|
|
244
|
+
};
|
|
245
|
+
}
|
|
211
246
|
const walletId = parseWalletId(record.walletId);
|
|
212
247
|
const walletAuthMethodId = parseWalletAuthMethodId(record.walletAuthMethodId);
|
|
213
248
|
const authority = parseWalletAuthAuthority(record.authority);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { sha256HexUtf8 } from "../../../../shared-ts/src/utils/digests.js";
|
|
2
2
|
import { buildEmailOtpWalletAuthAuthority, buildPasskeyWalletAuthAuthority, walletAuthAuthorityRef } from "../../../../shared-ts/src/utils/walletAuthAuthority.js";
|
|
3
|
+
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_TRANSACTION_SIGN_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
3
4
|
import { webAuthnCredentialIdB64uFromCredential } from "../../../auth/webAuthnCredentialCodecs.js";
|
|
4
5
|
import { hashEmailOtpOperationBinding } from "../../../domains/emailOtp/emailOtpSessionRouteHelpers.js";
|
|
5
|
-
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_TRANSACTION_SIGN_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
6
6
|
//#region src/router/cloudflare/d1/wallet/d1WalletAuthMethodBoundary.ts
|
|
7
7
|
function walletRegistrationFinalizeAuthMethodFromAuthority(authority) {
|
|
8
8
|
switch (authority.kind) {
|
|
@@ -13,12 +13,12 @@ import { buildWalletAuthMethodRecordV2, computeWalletAuthMethodRevokeOperationFi
|
|
|
13
13
|
import { deriveWebAuthnAuthenticatorDeviceInfo } from "../../../../shared-ts/src/utils/webauthnDeviceInfo.js";
|
|
14
14
|
import { parseSessionOrigin } from "../../../../authorization/domain.js";
|
|
15
15
|
import { secureRandomBase64Url } from "../../../../shared-ts/src/utils/secureRandomId.js";
|
|
16
|
+
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_UNLOCK_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
17
|
+
import { parseWebAuthnClientDataJsonBase64url, webAuthnOriginHostnameOrEmpty } from "../../../auth/webAuthnCredentialCodecs.js";
|
|
16
18
|
import { PASSKEY_PRF_FIRST_SALT_V1, PASSKEY_PRF_SECOND_SALT_V1 } from "../../../../shared-ts/src/utils/signingSessionSeal.js";
|
|
17
19
|
import { parsePasskeyCustodyEnvelopeRecord } from "../../../../shared-ts/src/passkey-custody/custodyEnvelope.js";
|
|
18
20
|
import "../../../../shared-ts/src/passkey-custody/index.js";
|
|
19
21
|
import { addAuthMethodIntentGrantFromString, computeAddAuthMethodIntentDigestB64u } from "../../../../shared-ts/src/utils/registrationIntent.js";
|
|
20
|
-
import { parseWebAuthnClientDataJsonBase64url, webAuthnOriginHostnameOrEmpty } from "../../../auth/webAuthnCredentialCodecs.js";
|
|
21
|
-
import { EMAIL_OTP_CHANNEL, WALLET_EMAIL_OTP_ACTIONS, WALLET_EMAIL_OTP_UNLOCK_OPERATION } from "../../../../shared-ts/src/utils/emailOtpDomain.js";
|
|
22
22
|
import { resolveWalletAuthMethodIdForAuthority } from "../../../../core/signingLanes/WalletExecutionLaneProjection.js";
|
|
23
23
|
import { d1HostIsWithinWebAuthnRpId, resolveD1AddAuthMethodExistingAuth, resolveD1AddSignerExistingAuth, verifyD1LinkedDeviceFreshRevokeProofV1, walletAuthAuthorityFromRegistrationAuthority } from "./d1WalletAuthMethodBoundary.js";
|
|
24
24
|
import { parseWalletIdForIntent } from "../registration/d1RegistrationCeremonyRecords.js";
|
|
@@ -1413,7 +1413,8 @@ var CloudflareD1WalletAuthMethodService = class {
|
|
|
1413
1413
|
provider,
|
|
1414
1414
|
providerUserId,
|
|
1415
1415
|
emailHashHex: record.emailHashHex
|
|
1416
|
-
}), record.walletAuthMethodId)
|
|
1416
|
+
}), record.walletAuthMethodId),
|
|
1417
|
+
walletAuthority
|
|
1417
1418
|
};
|
|
1418
1419
|
} catch (error) {
|
|
1419
1420
|
return {
|