@seams/wallet-server 0.9.3 → 0.10.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/THIRD_PARTY_NOTICES.md +33 -1
- package/artifact-manifest.json +57 -37
- package/cloudflare-router-ab/build/deriver-a/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/deriver-a/index.js +2 -2
- package/cloudflare-router-ab/build/deriver-a/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/deriver-b/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/deriver-b/index.js +2 -2
- package/cloudflare-router-ab/build/deriver-b/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/local-tools/darwin-arm64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/local-tools/darwin-x64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/local-tools/linux-x64/router_ab_local_init +0 -0
- package/cloudflare-router-ab/build/router/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/router/index.js +1 -1
- package/cloudflare-router-ab/build/router/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/signing-worker/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/signing-worker/index.js +1 -1
- package/cloudflare-router-ab/build/signing-worker/index_bg.wasm +0 -0
- package/cloudflare-router-ab/build/tenant-root-control-plane/build-stamp.json +1 -1
- package/cloudflare-router-ab/build/tenant-root-control-plane/index.js +1 -1
- package/cloudflare-router-ab/build/tenant-root-control-plane/index_bg.wasm +0 -0
- package/cloudflare-router-ab/migrations/deriver-a/0020_registration_preparation.sql +7 -0
- package/cloudflare-router-ab/migrations/deriver-b/0020_registration_preparation.sql +7 -0
- package/dist/esm/cloud-host.js +9 -9
- package/dist/esm/core/d1Ed25519SignerRead.js +3 -19
- package/dist/esm/hosted-wallet-gateway.js +15 -1
- package/dist/esm/localHostedWalletGatewayHandler.js +1 -1
- package/dist/esm/router/cloudflare/d1/authorization/d1AuthorizationStore.js +26 -20
- package/dist/esm/router/cloudflare/d1/ed25519Yao/d1Ed25519YaoProductRegistrationPartitionedStateStore.js +1 -1
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyRecords.js +21 -2
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.js +11 -4
- package/dist/esm/router/cloudflare/d1/registration/d1RegistrationSetupRateLimit.js +34 -0
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationCommitStore.js +17 -16
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationService.js +45 -65
- package/dist/esm/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.js +87 -10
- package/dist/esm/router/cloudflare/d1/wallet/d1WalletAddSignerService.js +1 -1
- package/dist/esm/router/cloudflare/runtime/walletGateway.js +2 -0
- package/dist/esm/router/cloudflare-adaptor.js +7 -7
- package/dist/esm/router/cloudflare.js +8812 -8594
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoCapabilityCommit.js +45 -24
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.js +52 -3
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitionedStateStore.js +1 -1
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationPartitioning.js +13 -5
- package/dist/esm/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationRequestScopedRuntime.js +41 -7
- package/dist/esm/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryRequestScopedCloudflare.js +1 -1
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.js +24 -4
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistration.js +24 -14
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.js +10 -1
- package/dist/esm/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationRequestScopedCloudflare.js +45 -5
- package/dist/esm/router/domains/walletRegistration/walletRegistrationRoutes.js +48 -8
- package/dist/esm/router/express.js +107 -16
- package/dist/esm/router/framework/registrationSetupDispatch.js +28 -2
- package/dist/esm/router/framework/registrationSetupRateLimit.js +0 -0
- package/dist/esm/router/transport/fetch/routes/walletRegistration.js +3 -2
- package/dist/esm/storage/d1Retry.js +38 -0
- package/dist/types/shared-ts/src/utils/walletManagementProtocol.d.ts +1 -1
- package/dist/types/wallet-server/src/core/RegistrationCeremonyStore.d.ts +12 -0
- package/dist/types/wallet-server/src/core/d1Ed25519SignerRead.d.ts +1 -4
- package/dist/types/wallet-server/src/core/threeRouteRegistrationContracts.d.ts +50 -6
- package/dist/types/wallet-server/src/hosted-wallet-gateway.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationCeremonyStore.d.ts +7 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1RegistrationSetupRateLimit.d.ts +7 -0
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationService.d.ts +1 -1
- package/dist/types/wallet-server/src/router/cloudflare/d1/registration/d1WalletRegistrationSetupExecution.d.ts +3 -0
- package/dist/types/wallet-server/src/router/cloudflare/runtime/walletGateway.d.ts +1 -1
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoCapabilityCommit.d.ts +18 -4
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration.d.ts +35 -4
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistrationRequestScopedRuntime.d.ts +1 -1
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery.d.ts +7 -0
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecoveryRequestScopedCloudflare.d.ts +2 -2
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoHttpRegistrationBackend.d.ts +5 -3
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistration.d.ts +18 -3
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationIntentAuthorization.d.ts +2 -0
- package/dist/types/wallet-server/src/router/domains/ed25519Yao/registration/routerAbEd25519YaoRegistrationRequestScopedCloudflare.d.ts +39 -0
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts +6 -0
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationReservation.d.ts +16 -2
- package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationRoutes.d.ts +1 -0
- package/dist/types/wallet-server/src/router/framework/registrationSetupRateLimit.d.ts +11 -0
- package/dist/types/wallet-server/src/router/framework/routerApi.d.ts +1 -0
- package/dist/types/wallet-server/src/storage/d1Retry.d.ts +10 -0
- package/migrations/d1-signer/0079_tenant_lookup_indexes.sql +33 -0
- package/migrations/d1-signer/0080_registration_setup_rate_limits.sql +11 -0
- package/package.json +1 -1
- package/src/README.md +1 -1
|
@@ -9276,6 +9276,22 @@ async function handleRouterApiWalletRegistrationSetup(input) {
|
|
|
9276
9276
|
});
|
|
9277
9277
|
if (!resolved.ok) return routeJson(resolved.status, resolved.body);
|
|
9278
9278
|
const principal = context.principal;
|
|
9279
|
+
if (input.services.registrationSetupRateLimit) try {
|
|
9280
|
+
if (!(await input.services.registrationSetupRateLimit({
|
|
9281
|
+
apiKeyId: principal.apiKeyId,
|
|
9282
|
+
orgId: principal.orgId,
|
|
9283
|
+
projectId: context.environment.projectId,
|
|
9284
|
+
envId: context.environment.key,
|
|
9285
|
+
sourceIp: input.sourceIp || "unknown"
|
|
9286
|
+
})).allowed) return routeJson(429, {
|
|
9287
|
+
ok: false,
|
|
9288
|
+
code: "rate_limited",
|
|
9289
|
+
message: "Too many registration attempts. Wait one minute and try again.",
|
|
9290
|
+
retryAfterMs: 6e4
|
|
9291
|
+
});
|
|
9292
|
+
} catch {
|
|
9293
|
+
return routeError(503, "internal", "Registration setup rate limit is unavailable");
|
|
9294
|
+
}
|
|
9279
9295
|
const runtimePolicyScope = {
|
|
9280
9296
|
orgId: principal.orgId,
|
|
9281
9297
|
projectId: context.environment.projectId,
|
|
@@ -9402,15 +9418,38 @@ function parseWalletRegistrationRespondRequest(body) {
|
|
|
9402
9418
|
const parsedAuthority = parseWalletRegistrationAuthorityProof(body);
|
|
9403
9419
|
if (!parsedAuthority.ok) return parsedAuthority;
|
|
9404
9420
|
const authority = parsedAuthority.value;
|
|
9405
|
-
if (planKind
|
|
9406
|
-
ok:
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
signedSetup,
|
|
9410
|
-
authority,
|
|
9411
|
-
planKind
|
|
9412
|
-
}
|
|
9421
|
+
if (planKind !== "near_ed25519" && body.ed25519Execution !== void 0) return {
|
|
9422
|
+
ok: false,
|
|
9423
|
+
code: "invalid_body",
|
|
9424
|
+
message: "only an Ed25519-only respond carries its Yao execution"
|
|
9413
9425
|
};
|
|
9426
|
+
if (planKind === "near_ed25519") {
|
|
9427
|
+
if (body.ed25519Execution === void 0) return {
|
|
9428
|
+
ok: true,
|
|
9429
|
+
value: {
|
|
9430
|
+
registrationCeremonyId,
|
|
9431
|
+
signedSetup,
|
|
9432
|
+
authority,
|
|
9433
|
+
planKind
|
|
9434
|
+
}
|
|
9435
|
+
};
|
|
9436
|
+
const ed25519Execution = parseRouterAbEd25519YaoRegistrationActivationExecuteRequestV1(body.ed25519Execution);
|
|
9437
|
+
if (!ed25519Execution.ok) return {
|
|
9438
|
+
ok: false,
|
|
9439
|
+
code: "invalid_body",
|
|
9440
|
+
message: ed25519Execution.message
|
|
9441
|
+
};
|
|
9442
|
+
return {
|
|
9443
|
+
ok: true,
|
|
9444
|
+
value: {
|
|
9445
|
+
registrationCeremonyId,
|
|
9446
|
+
signedSetup,
|
|
9447
|
+
authority,
|
|
9448
|
+
planKind,
|
|
9449
|
+
ed25519Execution: ed25519Execution.value
|
|
9450
|
+
}
|
|
9451
|
+
};
|
|
9452
|
+
}
|
|
9414
9453
|
const ecdsa = isPlainObject(body.ecdsa) ? body.ecdsa : null;
|
|
9415
9454
|
if (!ecdsa || ecdsa.kind !== "router_ab_ecdsa_registration_v1") return {
|
|
9416
9455
|
ok: false,
|
|
@@ -10625,7 +10664,7 @@ function resolveWalletRegistrationRoute(ctx) {
|
|
|
10625
10664
|
async function handleWalletRegistration(ctx) {
|
|
10626
10665
|
const route = resolveWalletRegistrationRoute(ctx);
|
|
10627
10666
|
if (!route) return null;
|
|
10628
|
-
if (ctx.request.headers.get("X-Seams-Wallet-Protocol") !== "
|
|
10667
|
+
if (ctx.request.headers.get("X-Seams-Wallet-Protocol") !== "4") return jsonFailure(409, "wallet_protocol_mismatch", "Your wallet application needs an update. Reload this page and try again. If the problem continues, ask the application developer to upgrade the Wallet SDK.");
|
|
10629
10668
|
const common = {
|
|
10630
10669
|
body: await readJson(ctx.request),
|
|
10631
10670
|
headers: Object.fromEntries(ctx.request.headers.entries()),
|
|
@@ -10645,7 +10684,8 @@ async function handleWalletRegistration(ctx) {
|
|
|
10645
10684
|
routerAbPublicKeyset: ctx.opts.routerAbPublicKeyset,
|
|
10646
10685
|
session: ctx.opts.session,
|
|
10647
10686
|
publishableKeyAuth: ctx.opts.publishableKeyAuth,
|
|
10648
|
-
registrationContext: ctx.opts.registrationContext
|
|
10687
|
+
registrationContext: ctx.opts.registrationContext,
|
|
10688
|
+
registrationSetupRateLimit: ctx.opts.registrationSetupRateLimit
|
|
10649
10689
|
},
|
|
10650
10690
|
sourceIp: resolveSourceIpFromFetchHeaders(ctx.request.headers) || void 0,
|
|
10651
10691
|
signingSessionSeal: ctx.opts.signingSessionSeal,
|
|
@@ -24750,6 +24790,9 @@ function randomSession() {
|
|
|
24750
24790
|
while (isZero(bytes));
|
|
24751
24791
|
return Array.from(bytes);
|
|
24752
24792
|
}
|
|
24793
|
+
function isSessionId(bytes) {
|
|
24794
|
+
return bytes.length === 32 && bytes.every((byte) => Number.isInteger(byte) && byte >= 0 && byte <= 255) && bytes.some((byte) => byte !== 0);
|
|
24795
|
+
}
|
|
24753
24796
|
function isZero(bytes) {
|
|
24754
24797
|
for (const byte of bytes) if (byte !== 0) return false;
|
|
24755
24798
|
return true;
|
|
@@ -25067,8 +25110,19 @@ var RouterAbEd25519YaoHttpRegistrationBackend = class {
|
|
|
25067
25110
|
this.lastRouterServerTiming = null;
|
|
25068
25111
|
return timing;
|
|
25069
25112
|
}
|
|
25070
|
-
async
|
|
25071
|
-
|
|
25113
|
+
async prepareRegistrationPair(identity, request, receipt, expiresAtMs) {
|
|
25114
|
+
const tenantRoot = await this.resolveRegistrationDispatchRoot(routerAbEd25519YaoRegistrationSigningRootIdV1(request));
|
|
25115
|
+
if (!(await this.post("/router-ab/router/ed25519-yao/registration/prepare", identity, {
|
|
25116
|
+
tenant_root: tenantRoot,
|
|
25117
|
+
application: request.application_binding,
|
|
25118
|
+
participant_ids: request.participant_ids,
|
|
25119
|
+
binding: receipt.binding,
|
|
25120
|
+
ownership_generation: identity.ownershipGeneration,
|
|
25121
|
+
expires_at_ms: expiresAtMs
|
|
25122
|
+
}, createRouterAbTraceContextV1().value, "exact")).ok) throw new Error("Registration pair preparation failed");
|
|
25123
|
+
}
|
|
25124
|
+
async admit(request, _traceContext, mintedSessionId) {
|
|
25125
|
+
return await this.admitActivation(request, "registration", mintedSessionId);
|
|
25072
25126
|
}
|
|
25073
25127
|
async admitRecovery(request, _traceContext) {
|
|
25074
25128
|
return await this.admitActivation(request, "recovery");
|
|
@@ -25129,7 +25183,7 @@ var RouterAbEd25519YaoHttpRegistrationBackend = class {
|
|
|
25129
25183
|
signing_worker_recipient_public_key: this.config.signingWorkerRecipientPublicKey
|
|
25130
25184
|
};
|
|
25131
25185
|
}
|
|
25132
|
-
async admitActivation(request, operation) {
|
|
25186
|
+
async admitActivation(request, operation, mintedSessionId) {
|
|
25133
25187
|
if (request.scope.signing_worker_id !== this.config.signingWorkerId) return {
|
|
25134
25188
|
ok: false,
|
|
25135
25189
|
status: 400,
|
|
@@ -25138,7 +25192,13 @@ var RouterAbEd25519YaoHttpRegistrationBackend = class {
|
|
|
25138
25192
|
};
|
|
25139
25193
|
const stableContextBinding = await deriveRouterAbEd25519YaoStableContextBindingV1(request.application_binding, request.participant_ids);
|
|
25140
25194
|
const keyset = this.keyset();
|
|
25141
|
-
|
|
25195
|
+
if (mintedSessionId !== void 0 && !isSessionId(mintedSessionId)) return {
|
|
25196
|
+
ok: false,
|
|
25197
|
+
status: 500,
|
|
25198
|
+
code: "admission_failed",
|
|
25199
|
+
message: `${operation} minted session is invalid`
|
|
25200
|
+
};
|
|
25201
|
+
const sessionId = mintedSessionId === void 0 ? randomSession() : [...mintedSessionId];
|
|
25142
25202
|
switch (operation) {
|
|
25143
25203
|
case "registration": return {
|
|
25144
25204
|
ok: true,
|
|
@@ -26206,10 +26266,10 @@ var RouterAbEd25519YaoProductRegistrationRuntime = class {
|
|
|
26206
26266
|
startRegistrationDispatchRoot() {
|
|
26207
26267
|
return null;
|
|
26208
26268
|
}
|
|
26209
|
-
async bindAndAdmitVerifiedRegistration(input) {
|
|
26269
|
+
async bindAndAdmitVerifiedRegistration(input, _companionWrite, _startedDispatchRoot, mintedSessionId) {
|
|
26210
26270
|
const bound = await this.input.authorization.bindAndAuthorizeAdmission(input);
|
|
26211
26271
|
if (!bound.ok) return bound;
|
|
26212
|
-
const admitted = await this.input.registrationService.admit(bound.admissionRequest);
|
|
26272
|
+
const admitted = await this.input.registrationService.admit(bound.admissionRequest, void 0, mintedSessionId);
|
|
26213
26273
|
if (!admitted.ok) return admitted;
|
|
26214
26274
|
return {
|
|
26215
26275
|
ok: true,
|
|
@@ -26219,6 +26279,33 @@ var RouterAbEd25519YaoProductRegistrationRuntime = class {
|
|
|
26219
26279
|
companionWrite: "not_committed"
|
|
26220
26280
|
};
|
|
26221
26281
|
}
|
|
26282
|
+
/** This runtime issues a receipt at its admission only. */
|
|
26283
|
+
async describeRegistrationAdmission() {
|
|
26284
|
+
return {
|
|
26285
|
+
ok: false,
|
|
26286
|
+
status: 503,
|
|
26287
|
+
code: "admission_failed",
|
|
26288
|
+
message: "This runtime describes no admission before its proof"
|
|
26289
|
+
};
|
|
26290
|
+
}
|
|
26291
|
+
/** This runtime executes through its registration route only. */
|
|
26292
|
+
async executeAdmittedRegistration() {
|
|
26293
|
+
return {
|
|
26294
|
+
result: {
|
|
26295
|
+
ok: false,
|
|
26296
|
+
status: 503,
|
|
26297
|
+
code: "execution_failed",
|
|
26298
|
+
message: "This runtime executes a registration through its execute route"
|
|
26299
|
+
},
|
|
26300
|
+
timing: {
|
|
26301
|
+
credentialDigestMs: 0,
|
|
26302
|
+
d1AdmissionReadMs: 0,
|
|
26303
|
+
routerExecutionMs: 0,
|
|
26304
|
+
routerServerTiming: null,
|
|
26305
|
+
resultReconstructionMs: 0
|
|
26306
|
+
}
|
|
26307
|
+
};
|
|
26308
|
+
}
|
|
26222
26309
|
async consumeActivated(request) {
|
|
26223
26310
|
return await this.input.registrationService.consumeActivated(request);
|
|
26224
26311
|
}
|
|
@@ -26228,6 +26315,10 @@ var RouterAbEd25519YaoProductRegistrationRuntime = class {
|
|
|
26228
26315
|
async resolveActiveCapability(input) {
|
|
26229
26316
|
return await this.input.capabilityResolver.resolveActiveCapability(input);
|
|
26230
26317
|
}
|
|
26318
|
+
/** This runtime's recovery state already holds every capability it resolves. */
|
|
26319
|
+
async rehydrateActiveCapability(input) {
|
|
26320
|
+
return await this.input.capabilityResolver.resolveActiveCapability(input);
|
|
26321
|
+
}
|
|
26231
26322
|
};
|
|
26232
26323
|
function createRouterAbEd25519YaoProductRegistrationRuntimeV1(input) {
|
|
26233
26324
|
return new RouterAbEd25519YaoProductRegistrationRuntime(input);
|
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
//#region src/router/framework/registrationSetupDispatch.ts
|
|
2
|
+
/** A transient storage fault outlived its retries. The same request can succeed later. */
|
|
3
|
+
const SETUP_STORAGE_UNAVAILABLE = {
|
|
4
|
+
status: 503,
|
|
5
|
+
message: "Wallet registration setup is temporarily unavailable. Try again."
|
|
6
|
+
};
|
|
7
|
+
const SETUP_INTERNAL_FAILURE = {
|
|
8
|
+
status: 500,
|
|
9
|
+
message: "Wallet registration setup failed"
|
|
10
|
+
};
|
|
2
11
|
async function dispatchWalletRegistrationSetup(context, input) {
|
|
3
12
|
const forwarded = await context.dispatcher?.dispatch(input);
|
|
4
13
|
if (forwarded) return forwarded;
|
|
5
14
|
const result = await context.local.setupWalletRegistration(input);
|
|
6
|
-
return {
|
|
7
|
-
status:
|
|
15
|
+
if (result.ok) return {
|
|
16
|
+
status: 200,
|
|
17
|
+
body: result
|
|
18
|
+
};
|
|
19
|
+
const serverFailure = result.code === "storage_unavailable" ? SETUP_STORAGE_UNAVAILABLE : result.code === "internal" ? SETUP_INTERNAL_FAILURE : null;
|
|
20
|
+
if (!serverFailure) return {
|
|
21
|
+
status: 400,
|
|
8
22
|
body: result
|
|
9
23
|
};
|
|
24
|
+
console.error("[wallet-registration] setup failed", {
|
|
25
|
+
code: result.code,
|
|
26
|
+
reason: result.message
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
status: serverFailure.status,
|
|
30
|
+
body: {
|
|
31
|
+
ok: false,
|
|
32
|
+
code: result.code,
|
|
33
|
+
message: serverFailure.message
|
|
34
|
+
}
|
|
35
|
+
};
|
|
10
36
|
}
|
|
11
37
|
//#endregion
|
|
12
38
|
export { dispatchWalletRegistrationSetup };
|
|
File without changes
|
|
@@ -44,7 +44,7 @@ function resolveWalletRegistrationRoute(ctx) {
|
|
|
44
44
|
async function handleWalletRegistration(ctx) {
|
|
45
45
|
const route = resolveWalletRegistrationRoute(ctx);
|
|
46
46
|
if (!route) return null;
|
|
47
|
-
if (ctx.request.headers.get("X-Seams-Wallet-Protocol") !== "
|
|
47
|
+
if (ctx.request.headers.get("X-Seams-Wallet-Protocol") !== "4") return jsonFailure(409, "wallet_protocol_mismatch", "Your wallet application needs an update. Reload this page and try again. If the problem continues, ask the application developer to upgrade the Wallet SDK.");
|
|
48
48
|
const common = {
|
|
49
49
|
body: await readJson(ctx.request),
|
|
50
50
|
headers: Object.fromEntries(ctx.request.headers.entries()),
|
|
@@ -64,7 +64,8 @@ async function handleWalletRegistration(ctx) {
|
|
|
64
64
|
routerAbPublicKeyset: ctx.opts.routerAbPublicKeyset,
|
|
65
65
|
session: ctx.opts.session,
|
|
66
66
|
publishableKeyAuth: ctx.opts.publishableKeyAuth,
|
|
67
|
-
registrationContext: ctx.opts.registrationContext
|
|
67
|
+
registrationContext: ctx.opts.registrationContext,
|
|
68
|
+
registrationSetupRateLimit: ctx.opts.registrationSetupRateLimit
|
|
68
69
|
},
|
|
69
70
|
sourceIp: resolveSourceIpFromFetchHeaders(ctx.request.headers) || void 0,
|
|
70
71
|
signingSessionSeal: ctx.opts.signingSessionSeal,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/storage/d1Retry.ts
|
|
2
|
+
/**
|
|
3
|
+
* The faults Cloudflare documents as safe to retry for D1: the connection to
|
|
4
|
+
* the database dropped, or the database restarted under the query. The request
|
|
5
|
+
* itself was sound. D1 retries read-only queries on its own; writes reach the
|
|
6
|
+
* caller.
|
|
7
|
+
*/
|
|
8
|
+
const TRANSIENT_D1_ERROR_FRAGMENTS = [
|
|
9
|
+
"Network connection lost",
|
|
10
|
+
"storage caused object to be reset",
|
|
11
|
+
"reset because its code was updated"
|
|
12
|
+
];
|
|
13
|
+
/** One wait before each retry, so an operation runs three times at most. */
|
|
14
|
+
const TRANSIENT_D1_RETRY_DELAYS_MS = [25, 100];
|
|
15
|
+
function isTransientD1Error(error) {
|
|
16
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
17
|
+
return TRANSIENT_D1_ERROR_FRAGMENTS.some((fragment) => message.includes(fragment));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Runs `operation` again after a transient D1 fault. Such a fault does not say
|
|
21
|
+
* whether a write committed, so `operation` must give the same result when it
|
|
22
|
+
* runs after its own earlier commit: reads, `INSERT OR IGNORE`, and conditional
|
|
23
|
+
* writes that accept their own outcome. It must build its statements on each
|
|
24
|
+
* run. Every other error, and the last transient one, reaches the caller.
|
|
25
|
+
*/
|
|
26
|
+
async function retryTransientD1(operation) {
|
|
27
|
+
for (const delayMs of TRANSIENT_D1_RETRY_DELAYS_MS) try {
|
|
28
|
+
return await operation();
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (!isTransientD1Error(error)) throw error;
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
32
|
+
}
|
|
33
|
+
return await operation();
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { isTransientD1Error, retryTransientD1 };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=d1Retry.js.map
|
|
@@ -10,6 +10,7 @@ import type { RuntimePolicyScope } from '../../../shared-ts/src/threshold/signin
|
|
|
10
10
|
import { type ThresholdEcdsaChainTarget } from './thresholdEcdsaChainTarget';
|
|
11
11
|
import type { RouterAbEd25519YaoActivationAdmissionReceiptV1, RouterAbEd25519YaoActivationResultV1, RouterAbEd25519YaoBytes32V1, RouterAbEd25519YaoRegistrationAdmissionRequestV1 } from '../../../shared-ts/src/utils/routerAbEd25519Yao';
|
|
12
12
|
import type { RouterAbEcdsaDerivationPublicCapabilityV1, RouterAbEcdsaRegistrationActivationReceiptV1, RouterAbEcdsaRegistrationRequestV1, RouterAbEcdsaStrictForwardedRegistrationResponseV1, RouterAbEcdsaVerifiedClientActivationFactsV1 } from '../../../shared-ts/src/utils/routerAbEcdsaDerivation';
|
|
13
|
+
import type { RouterAbMpcMaterialActivationRefWire } from '../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
|
|
13
14
|
import type { RouterAbEcdsaPendingActivationV1 } from '../router/domains/ecdsa/routerAbEcdsaStrictRegistration';
|
|
14
15
|
import type { WalletEd25519SignerRecord } from './WalletStore';
|
|
15
16
|
import { type WalletAuthAuthorityRef } from '../../../shared-ts/src/utils/walletAuthAuthority';
|
|
@@ -216,6 +217,15 @@ export type StoredWalletRegistrationCeremonyAuthorityState = {
|
|
|
216
217
|
authority: StoredRegistrationAuthority;
|
|
217
218
|
authMethod?: never;
|
|
218
219
|
};
|
|
220
|
+
/**
|
|
221
|
+
* The Yao identity of a registration's NEAR branch. Setup mints it, and the
|
|
222
|
+
* admission that respond issues after the proof is over these values. It
|
|
223
|
+
* grants nothing: no admission exists until the proof is verified.
|
|
224
|
+
*/
|
|
225
|
+
export type StoredWalletRegistrationEd25519YaoMint = {
|
|
226
|
+
materialActivation: RouterAbMpcMaterialActivationRefWire;
|
|
227
|
+
sessionId: RouterAbEd25519YaoBytes32V1;
|
|
228
|
+
};
|
|
219
229
|
type StoredWalletRegistrationCeremonyBase = {
|
|
220
230
|
registrationCeremonyId: string;
|
|
221
231
|
foundingWalletAuthorityId: WalletAuthorityId;
|
|
@@ -231,6 +241,8 @@ type StoredWalletRegistrationCeremonyBase = {
|
|
|
231
241
|
expectedOrigin?: string;
|
|
232
242
|
expiresAtMs: number;
|
|
233
243
|
authorityState: StoredWalletRegistrationCeremonyAuthorityState;
|
|
244
|
+
/** `null` exactly when the signer plan has no NEAR branch. */
|
|
245
|
+
ed25519YaoMint: StoredWalletRegistrationEd25519YaoMint | null;
|
|
234
246
|
};
|
|
235
247
|
export type StoredWalletRegistrationCeremony = StoredWalletRegistrationCeremonyBase & {
|
|
236
248
|
signerState: StoredWalletRegistrationSignerState;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { WalletId } from '../../../shared-ts/src/utils/domainIds';
|
|
2
2
|
import { type RouterAbMpcMaterialActivationRefWire } from '../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
|
|
3
3
|
import type { WalletEd25519SignerRecord } from './WalletStore';
|
|
4
|
-
import { type RouterAbEd25519YaoActiveCapabilityLookupV1 } from '../router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery';
|
|
5
4
|
/** Signer rows read with a Wallet Session; a failure surfaces after session validation. */
|
|
6
5
|
export declare class Ed25519SignerRead {
|
|
7
6
|
#private;
|
|
8
7
|
private readonly walletId;
|
|
9
8
|
private readonly activation;
|
|
10
|
-
private readonly capabilities;
|
|
11
9
|
private constructor();
|
|
12
|
-
static fromRows(walletId: WalletId, activation: RouterAbMpcMaterialActivationRefWire, rows: unknown
|
|
13
|
-
resolveActiveCapability(input: RouterAbEd25519YaoActiveCapabilityLookupV1): import("../router/domains/ed25519Yao/recovery/routerAbEd25519YaoRecovery").RouterAbEd25519YaoActiveCapabilityLookupResultV1 | null;
|
|
10
|
+
static fromRows(walletId: WalletId, activation: RouterAbMpcMaterialActivationRefWire, rows: unknown): Ed25519SignerRead;
|
|
14
11
|
/** The session wallet's signer for the activation this read selected, or null. */
|
|
15
12
|
resolve(walletId: WalletId, activation: RouterAbMpcMaterialActivationRefWire): WalletEd25519SignerRecord | null;
|
|
16
13
|
}
|
|
@@ -11,7 +11,7 @@ import type { RegistrationAuthority } from '../../../shared-ts/src/utils/registr
|
|
|
11
11
|
import type { WalletAuthAuthority } from '../../../shared-ts/src/utils/walletAuthAuthority';
|
|
12
12
|
import type { WalletCustodyRegistrationOutcome } from '../../../shared-ts/src/passkey-custody';
|
|
13
13
|
import type { DigestB64u } from '../../../shared-ts/src/utils/canonicalPrimitives';
|
|
14
|
-
import type { RouterAbEd25519YaoActivationAdmissionReceiptV1 } from '../../../shared-ts/src/utils/routerAbEd25519Yao';
|
|
14
|
+
import type { RouterAbEd25519YaoActivationAdmissionReceiptV1, RouterAbEd25519YaoActivationResultV1 } from '../../../shared-ts/src/utils/routerAbEd25519Yao';
|
|
15
15
|
import type { ThresholdEd25519AuthorityScope, EcdsaDerivationServerBootstrapResponse } from './types';
|
|
16
16
|
import type { StoredWalletRegistrationNearEd25519YaoAuthorizedBranch, StoredWalletRegistrationPreparedContext } from './RegistrationCeremonyStore';
|
|
17
17
|
/**
|
|
@@ -151,6 +151,14 @@ export type WalletRegistrationRouteErrorV2 = {
|
|
|
151
151
|
* defers is simpler and strictly safer, so Ed25519 work does not appear in the
|
|
152
152
|
* setup request or response at all. Respond derives it, authority-bound, for
|
|
153
153
|
* both methods.
|
|
154
|
+
*
|
|
155
|
+
* Setup does mint the Yao identity of a NEAR branch, its material identity
|
|
156
|
+
* and its session, and stores it with the ceremony. That identity binds no
|
|
157
|
+
* authority and admits nothing: respond issues the admission over it.
|
|
158
|
+
*
|
|
159
|
+
* For an Ed25519-only passkey plan, setup also describes that admission (see
|
|
160
|
+
* `WalletRegistrationSetupEd25519AdmissionV2`). The description is not work
|
|
161
|
+
* and not an admission. It lets the client prepare during the prompt.
|
|
154
162
|
*/
|
|
155
163
|
type WalletRegistrationSetupSuccessBase = {
|
|
156
164
|
readonly home: WalletSessionHome;
|
|
@@ -164,6 +172,27 @@ type WalletRegistrationSetupSuccessBase = {
|
|
|
164
172
|
/** Opaque; echoed verbatim on routes 2 and 3. */
|
|
165
173
|
signedSetup: SignedSetupPayloadB64u;
|
|
166
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* What setup says about the Yao admission of an Ed25519-only plan.
|
|
177
|
+
*
|
|
178
|
+
* A passkey's authority scope is its relying party, which the intent fixes.
|
|
179
|
+
* So setup can describe the admission that respond will issue: the request,
|
|
180
|
+
* and the receipt over the session that setup minted. The client prepares
|
|
181
|
+
* its protocol inputs from it during the prompt and sends them with the
|
|
182
|
+
* proof. Nothing is admitted until respond has verified that proof.
|
|
183
|
+
*
|
|
184
|
+
* An Email OTP scope holds the verified provider subject, so its admission
|
|
185
|
+
* is known after the proof only.
|
|
186
|
+
*/
|
|
187
|
+
export type WalletRegistrationSetupEd25519AdmissionV2 = {
|
|
188
|
+
readonly status: 'described';
|
|
189
|
+
readonly admissionRequest: RespondEd25519DeferredWorkV2['admissionRequest'];
|
|
190
|
+
readonly admissionReceipt: RouterAbEd25519YaoActivationAdmissionReceiptV1<'registration'>;
|
|
191
|
+
} | {
|
|
192
|
+
readonly status: 'after_proof';
|
|
193
|
+
readonly admissionRequest?: never;
|
|
194
|
+
readonly admissionReceipt?: never;
|
|
195
|
+
};
|
|
167
196
|
/**
|
|
168
197
|
* Setup's shape follows the signer plan, exhaustively.
|
|
169
198
|
*
|
|
@@ -178,6 +207,7 @@ export type WalletRegistrationSetupResponseV2 = (WalletRegistrationSetupSuccessB
|
|
|
178
207
|
}) | (WalletRegistrationSetupSuccessBase & {
|
|
179
208
|
kind: 'near_ed25519';
|
|
180
209
|
ecdsa?: never;
|
|
210
|
+
ed25519: WalletRegistrationSetupEd25519AdmissionV2;
|
|
181
211
|
}) | WalletRegistrationRouteErrorV2;
|
|
182
212
|
/**
|
|
183
213
|
* What respond returns for the ceremony's signer plan.
|
|
@@ -205,11 +235,25 @@ type WalletRegistrationRespondSignerPlanV2 = {
|
|
|
205
235
|
/** The client completes Yao and recovery backup before committing this wallet. */
|
|
206
236
|
kind: 'near_ed25519';
|
|
207
237
|
ecdsa?: never;
|
|
208
|
-
ed25519:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
238
|
+
ed25519: WalletRegistrationRespondEd25519AdmissionV2;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* `executed` answers a respond that carried the execute request: the Gateway
|
|
242
|
+
* admitted and then ran it, and `activationResult` is what the execute route
|
|
243
|
+
* returns. `admitted` answers every other respond, and a respond whose
|
|
244
|
+
* execution did not complete: the admission is stored, and the client runs
|
|
245
|
+
* or repeats the execution through the execute route.
|
|
246
|
+
*/
|
|
247
|
+
export type WalletRegistrationRespondEd25519AdmissionV2 = {
|
|
248
|
+
readonly status: 'admitted';
|
|
249
|
+
readonly admissionRequest: RespondEd25519DeferredWorkV2['admissionRequest'];
|
|
250
|
+
readonly admissionReceipt: RouterAbEd25519YaoActivationAdmissionReceiptV1<'registration'>;
|
|
251
|
+
readonly activationResult?: never;
|
|
252
|
+
} | {
|
|
253
|
+
readonly status: 'executed';
|
|
254
|
+
readonly admissionRequest: RespondEd25519DeferredWorkV2['admissionRequest'];
|
|
255
|
+
readonly admissionReceipt: RouterAbEd25519YaoActivationAdmissionReceiptV1<'registration'>;
|
|
256
|
+
readonly activationResult: RouterAbEd25519YaoActivationResultV1<'registration'>;
|
|
213
257
|
};
|
|
214
258
|
/** Exact A/B role bundles, unchanged from the derivation respond leg. */
|
|
215
259
|
type RespondEcdsaProofBundles = {
|
|
@@ -95,7 +95,7 @@ export interface HostedWalletGatewayDependenciesV1 {
|
|
|
95
95
|
/** Host loader for the signer WASM; defaults to the Workers module import. */
|
|
96
96
|
readonly signerWasm?: CloudflareD1RouterApiAuthServiceOptions['signerWasmModuleOrPath'];
|
|
97
97
|
}
|
|
98
|
-
export declare function createStagingEd25519YaoBackend(env: CloudflareD1GatewayBaseEnv, resolveTenantRoot: RouterAbEd25519YaoTenantRootResolverV1): import("./cloud-host").
|
|
98
|
+
export declare function createStagingEd25519YaoBackend(env: CloudflareD1GatewayBaseEnv, resolveTenantRoot: RouterAbEd25519YaoTenantRootResolverV1): import("./cloud-host").RouterAbEd25519YaoHttpRegistrationBackend;
|
|
99
99
|
/**
|
|
100
100
|
* The split Wallet Gateway: serves the Wallet runtime only, holds no Console
|
|
101
101
|
* database binding, and reaches the Wallet Console deployment exclusively
|
|
@@ -22,7 +22,13 @@ export declare class CloudflareD1RegistrationCeremonyIntentStore {
|
|
|
22
22
|
private readonly storage;
|
|
23
23
|
constructor(input: RegistrationCeremonyIntentStoreConfig);
|
|
24
24
|
getSetupCeremony(ceremonyId: string): Promise<StoredWalletRegistrationCeremony | null>;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* One batch stores the setup snapshot, ceremony, and authenticated execution identity.
|
|
27
|
+
*
|
|
28
|
+
* The batch is safe to repeat after a transient fault. Its inserts ignore an
|
|
29
|
+
* existing row, its reads return the stored winner, and the home reservation
|
|
30
|
+
* accepts its own earlier row. A repeat after a lost commit is an exact retry.
|
|
31
|
+
*/
|
|
26
32
|
reserveSetupCeremony(proposed: StoredWalletRegistrationCeremony, ownershipGeneration: number): Promise<StoredWalletRegistrationCeremony>;
|
|
27
33
|
getCeremony(registrationCeremonyId: string): Promise<StoredWalletRegistrationCeremony | null>;
|
|
28
34
|
prepareCeremonyRead(registrationCeremonyId: string): D1PreparedStatementLike;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { D1DatabaseLike } from '../../../../storage/tenantRoute';
|
|
2
|
+
import type { RegistrationSetupRateLimitInput } from '../../../framework/registrationSetupRateLimit';
|
|
3
|
+
/** Regional counters bound the work that runs before a passkey is verified. */
|
|
4
|
+
export declare function consumeRegistrationSetupRateLimit(database: D1DatabaseLike, namespace: string, input: RegistrationSetupRateLimitInput): Promise<{
|
|
5
|
+
readonly allowed: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=d1RegistrationSetupRateLimit.d.ts.map
|
|
@@ -8,7 +8,7 @@ import { type WalletId } from '../../../../../../shared-ts/src/utils/registratio
|
|
|
8
8
|
import { type RouterAbEcdsaDerivationActivationRefreshForwardedResponseV1, type RouterAbEcdsaDerivationActivationRefreshRequestV1, type RouterAbEcdsaDerivationNormalSigningStateV1, type RouterAbEcdsaPostRegistrationSessionActivationRequestV1, type RouterAbEcdsaRegistrationActivationReceiptV1, type RouterAbEcdsaRegistrationRequestFactsV1, type RouterAbEcdsaVerifiedClientActivationFactsV1 } from '../../../../../../shared-ts/src/utils/routerAbEcdsaDerivation';
|
|
9
9
|
import { type RouterAbEd25519YaoExportAuthorizationIdentityV1 } from '../../../../../../shared-ts/src/utils/routerAbEd25519Yao';
|
|
10
10
|
import { type RouterAbMpcMaterialActivationRefWire } from '../../../../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
|
|
11
|
-
import type
|
|
11
|
+
import { type RouterAbTraceContextV1 } from '../../../../../../shared-ts/src/utils/routerAbTraceContext';
|
|
12
12
|
import type { AuthorizationService } from '../../../../authorization/service';
|
|
13
13
|
import { type ThresholdEcdsaKeyInventoryDiagnostics, type ThresholdEcdsaKeyInventoryRecord } from '../../../../core/authService/thresholdEcdsaKeyInventory';
|
|
14
14
|
import type { EcdsaMaterialActivationReadInput } from '../../../../core/d1EcdsaSignerRead';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { WalletSessionHome } from '../../../../../../shared-ts/src/device-linking/contracts';
|
|
2
2
|
import type { WalletRegistrationSetupResponseV2 } from '../../../../core/threeRouteRegistrationContracts';
|
|
3
3
|
import { type RouterAbEcdsaStrictRegistrationPort } from '../../../domains/ecdsa/routerAbEcdsaStrictRegistration';
|
|
4
|
+
import { type RouterAbEd25519YaoProductRegistrationRuntimeV1 } from '../../../domains/ed25519Yao/capabilityLifecycle/routerAbEd25519YaoProductRegistration';
|
|
4
5
|
import type { WalletRegistrationSetupInput } from '../../../domains/walletRegistration/walletRegistrationInputs';
|
|
5
6
|
import type { RegistrationWalletStarter, WalletRegistrationReservationAuthority } from '../../../domains/walletRegistration/walletRegistrationReservation';
|
|
6
7
|
import { CloudflareD1RegistrationCeremonyIntentStore } from './d1RegistrationCeremonyStore';
|
|
@@ -9,6 +10,8 @@ type WalletRegistrationSetupDependencies = {
|
|
|
9
10
|
readonly reservation: Pick<WalletRegistrationReservationAuthority, 'reserve'> | null;
|
|
10
11
|
readonly store: CloudflareD1RegistrationCeremonyIntentStore;
|
|
11
12
|
readonly ecdsaStrictRegistration: RouterAbEcdsaStrictRegistrationPort;
|
|
13
|
+
/** The runtime of Ed25519 Yao registrations, or `null` when none is configured. */
|
|
14
|
+
readonly ed25519Yao: Pick<RouterAbEd25519YaoProductRegistrationRuntimeV1, 'signingWorkerId' | 'describeRegistrationAdmission'> | null;
|
|
12
15
|
readonly startRegistrationWallets: RegistrationWalletStarter | null;
|
|
13
16
|
};
|
|
14
17
|
export declare function executeD1WalletRegistrationSetup(input: WalletRegistrationSetupInput, dependencies: WalletRegistrationSetupDependencies): Promise<WalletRegistrationSetupResponseV2>;
|
|
@@ -18,7 +18,7 @@ export declare function walletConsoleSignedDelegateRouteDefinitionV1(routePath:
|
|
|
18
18
|
export declare function walletConsoleSponsoredEvmCallRouteDefinitionV1(routePath?: string): RouteDefinition;
|
|
19
19
|
export declare function walletConsoleRelayRouteDefinitionsV1(): readonly RouteDefinition[];
|
|
20
20
|
export declare function createWalletConsoleRelayProxyExtensionV1(binding: WalletConsoleServiceBinding): RouterApiRouteExtension;
|
|
21
|
-
type WalletGatewayManagedRouterOption = 'apiKeyAuth' | 'publishableKeyAuth' | 'registrationContext' | 'apiKeyUsageMeter' | 'orgProjectEnv' | 'routerAbNormalSigningAdmission' | 'routeExtensions';
|
|
21
|
+
type WalletGatewayManagedRouterOption = 'apiKeyAuth' | 'publishableKeyAuth' | 'registrationContext' | 'registrationSetupRateLimit' | 'apiKeyUsageMeter' | 'orgProjectEnv' | 'routerAbNormalSigningAdmission' | 'routeExtensions';
|
|
22
22
|
export interface CloudflareWalletGatewayRouterOptionsV1 {
|
|
23
23
|
readonly service: Parameters<typeof createCloudflareRouter>[0];
|
|
24
24
|
readonly walletConsole: WalletConsoleServiceBinding;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { WalletEd25519YaoActiveCapabilityRecord } from '../../../../core/WalletStore';
|
|
2
|
-
import { type RouterAbEd25519YaoRegistrationFinalizeCapabilityInstallationV1, type RouterAbEd25519YaoRegistrationFinalizeCapabilityInstallResultV1 } from '../recovery/routerAbEd25519YaoRecovery';
|
|
3
|
-
import type {
|
|
4
|
-
/**
|
|
5
|
-
|
|
2
|
+
import { type RouterAbEd25519YaoActiveCapabilityLookupResultV1, type RouterAbEd25519YaoActiveCapabilityLookupV1, type RouterAbEd25519YaoRegistrationFinalizeCapabilityInstallationV1, type RouterAbEd25519YaoRegistrationFinalizeCapabilityInstallResultV1 } from '../recovery/routerAbEd25519YaoRecovery';
|
|
3
|
+
import type { RouterAbEd25519YaoCapabilitySnapshotV1, RouterAbEd25519YaoProductRegistrationPartitionedStateStoreV1 } from './routerAbEd25519YaoProductRegistrationPartitionedStateStore';
|
|
4
|
+
/**
|
|
5
|
+
* Checks a registration's capability against its admission and its result.
|
|
6
|
+
* The signer row of the wallet commit holds the capability, so a registration
|
|
7
|
+
* reads and writes no recovery state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateRouterAbEd25519YaoRegistrationCapability(installation: RouterAbEd25519YaoRegistrationFinalizeCapabilityInstallationV1): RouterAbEd25519YaoRegistrationFinalizeCapabilityInstallResultV1;
|
|
10
|
+
/**
|
|
11
|
+
* Stores a signer row's capability in the recovery state, where a recovery
|
|
12
|
+
* admission suspends it.
|
|
13
|
+
*/
|
|
6
14
|
export declare function rehydrateRouterAbEd25519YaoCapability(store: RouterAbEd25519YaoProductRegistrationPartitionedStateStoreV1, capability: WalletEd25519YaoActiveCapabilityRecord): Promise<RouterAbEd25519YaoRegistrationFinalizeCapabilityInstallResultV1>;
|
|
15
|
+
/**
|
|
16
|
+
* The active capability of a signer row, as the recovery state allows it: a
|
|
17
|
+
* capability that a recovery suspended is not active, and one that a recovery
|
|
18
|
+
* retired conflicts. Nothing is written.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveRouterAbEd25519YaoPersistedActiveCapability(snapshot: RouterAbEd25519YaoCapabilitySnapshotV1, persisted: WalletEd25519YaoActiveCapabilityRecord, lookup: RouterAbEd25519YaoActiveCapabilityLookupV1): RouterAbEd25519YaoActiveCapabilityLookupResultV1;
|
|
7
21
|
//# sourceMappingURL=routerAbEd25519YaoCapabilityCommit.d.ts.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type AddSignerIntentV1, type WalletId } from '../../../../../../shared-ts/src/utils/registrationIntent';
|
|
2
2
|
import { type RegistrationEd25519AuthorityScope } from '../../../../../../shared-ts/src/utils/registrationIds';
|
|
3
3
|
import { type RegistrationNearEd25519SignerPlan } from '../../../../../../shared-ts/src/utils/registrationSignerPlan';
|
|
4
|
-
import { type RouterAbEd25519YaoActivationAdmissionReceiptV1, type RouterAbEd25519YaoRegistrationAdmissionRequestV1 } from '../../../../../../shared-ts/src/utils/routerAbEd25519Yao';
|
|
4
|
+
import { type RouterAbEd25519YaoActivationAdmissionReceiptV1, type RouterAbEd25519YaoActivationExecuteRequestV1, type RouterAbEd25519YaoBytes32V1, type RouterAbEd25519YaoRegistrationAdmissionRequestV1 } from '../../../../../../shared-ts/src/utils/routerAbEd25519Yao';
|
|
5
|
+
import type { RouterAbTraceContextV1 } from '../../../../../../shared-ts/src/utils/routerAbTraceContext';
|
|
6
|
+
import type { RouterAbEd25519YaoTimedRegistrationExecutionResultV1 } from '../registration/routerAbEd25519YaoRegistrationRequestScopedCloudflare';
|
|
5
7
|
import { type RouterAbMpcMaterialActivationRefWire } from '../../../../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
|
|
6
8
|
import type { RouterAbEd25519YaoActivationConsumerV1, RouterAbEd25519YaoActivationConsumptionRequestV1, RouterAbEd25519YaoActivationConsumptionResultV1, RouterAbEd25519YaoRegistrationServiceResult } from '../registration/routerAbEd25519YaoRegistration';
|
|
7
9
|
import { InMemoryRouterAbEd25519YaoRegistrationStateV1, type RouterAbEd25519YaoRegistrationAuthorizationAdapter, type RouterAbEd25519YaoRegistrationAuthorizationResult, type RouterAbEd25519YaoRegistrationAuthorizationFailure, type RouterAbEd25519YaoRegistrationService } from '../registration/routerAbEd25519YaoRegistration';
|
|
@@ -13,7 +15,7 @@ import { type RuntimePolicyScope } from '../../../../../../shared-ts/src/thresho
|
|
|
13
15
|
import type { WalletAuthAuthority } from '../../../../../../shared-ts/src/utils/walletAuthAuthority';
|
|
14
16
|
import type { WalletSessionOperationCredentialV1 } from '../../../../../../shared-ts/src/device-linking';
|
|
15
17
|
import type { WalletRegistrationEd25519YaoBootstrapSession } from '../../../../../../shared-ts/src/utils/registrationContracts';
|
|
16
|
-
import { InMemoryRouterAbEd25519YaoRecoveryStateV1, type RouterAbEd25519YaoActiveCapabilityLookupV1, type RouterAbEd25519YaoActiveCapabilityResolverV1, type RouterAbEd25519YaoPersistedActiveCapabilityInstallerV1, type RouterAbEd25519YaoRecoveryAuthorizationAdapter, type RouterAbEd25519YaoRecoveryService, type WarmBootstrapLinkedEd25519AuthorityReaderV1 } from '../recovery/routerAbEd25519YaoRecovery';
|
|
18
|
+
import { InMemoryRouterAbEd25519YaoRecoveryStateV1, type RouterAbEd25519YaoActiveCapabilityLookupV1, type RouterAbEd25519YaoActiveCapabilityRehydratorV1, type RouterAbEd25519YaoActiveCapabilityResolverV1, type RouterAbEd25519YaoPersistedActiveCapabilityInstallerV1, type RouterAbEd25519YaoRecoveryAuthorizationAdapter, type RouterAbEd25519YaoRecoveryService, type WarmBootstrapLinkedEd25519AuthorityReaderV1 } from '../recovery/routerAbEd25519YaoRecovery';
|
|
17
19
|
import type { WalletEd25519YaoActiveCapabilityRecord } from '../../../../core/WalletStore';
|
|
18
20
|
import { InMemoryRouterAbEd25519YaoExportStateV1, type RouterAbEd25519YaoExportAuthorizationAdapter, type RouterAbEd25519YaoExportService } from '../export/routerAbEd25519YaoExport';
|
|
19
21
|
import { type RouterAbEd25519YaoRegistrationSigningRootIdV1, type RouterAbEd25519YaoTenantRootWireV1 } from '../routerAbEd25519YaoGatewayEnvelope';
|
|
@@ -56,7 +58,7 @@ export type RouterAbEd25519YaoWalletSessionMintInputV1 = (RouterAbEd25519YaoWall
|
|
|
56
58
|
readonly expiresAtMs: number;
|
|
57
59
|
readonly remainingUses: number;
|
|
58
60
|
});
|
|
59
|
-
export type RouterAbEd25519YaoProductRegistrationRuntimeV1 = RouterAbEd25519YaoPersistedActiveCapabilityInstallerV1 & RouterAbEd25519YaoActiveCapabilityResolverV1 & {
|
|
61
|
+
export type RouterAbEd25519YaoProductRegistrationRuntimeV1 = RouterAbEd25519YaoPersistedActiveCapabilityInstallerV1 & RouterAbEd25519YaoActiveCapabilityResolverV1 & RouterAbEd25519YaoActiveCapabilityRehydratorV1 & {
|
|
60
62
|
readonly kind: 'router_ab_ed25519_yao_product_registration_runtime_v1';
|
|
61
63
|
readonly signingWorkerId: string;
|
|
62
64
|
/**
|
|
@@ -66,7 +68,24 @@ export type RouterAbEd25519YaoProductRegistrationRuntimeV1 = RouterAbEd25519YaoP
|
|
|
66
68
|
* starts nothing.
|
|
67
69
|
*/
|
|
68
70
|
startRegistrationDispatchRoot(signingRootId: RouterAbEd25519YaoRegistrationSigningRootIdV1): RouterAbEd25519YaoStartedDispatchRootV1 | null;
|
|
69
|
-
|
|
71
|
+
/** `mintedSessionId` is the session that the registration's setup minted. */
|
|
72
|
+
bindAndAdmitVerifiedRegistration(input: RouterAbEd25519YaoVerifiedActivationIntentV1, companionWrite: RouterAbEd25519YaoAdmissionCompanionWriteV1 | null, startedDispatchRoot: RouterAbEd25519YaoStartedDispatchRootV1 | null, mintedSessionId: RouterAbEd25519YaoBytes32V1): Promise<RouterAbEd25519YaoVerifiedRegistrationAdmissionResultV1>;
|
|
73
|
+
/**
|
|
74
|
+
* The receipt of the admission that a registration gets for `request`
|
|
75
|
+
* over the session that its setup minted. Nothing is stored and nothing
|
|
76
|
+
* is admitted: the client may prepare its inputs before the proof, and
|
|
77
|
+
* the admission still follows the proof.
|
|
78
|
+
*/
|
|
79
|
+
describeRegistrationAdmission(request: RouterAbEd25519YaoRegistrationAdmissionRequestV1, mintedSessionId: RouterAbEd25519YaoBytes32V1): Promise<RouterAbEd25519YaoRegistrationServiceResult<RouterAbEd25519YaoActivationAdmissionReceiptV1<'registration'>>>;
|
|
80
|
+
/**
|
|
81
|
+
* Runs an admitted registration for the holder of `credential`, as the
|
|
82
|
+
* execute route does for its bearer.
|
|
83
|
+
*/
|
|
84
|
+
executeAdmittedRegistration(input: {
|
|
85
|
+
readonly request: RouterAbEd25519YaoActivationExecuteRequestV1<'registration'>;
|
|
86
|
+
readonly credential: string;
|
|
87
|
+
readonly trace: RouterAbTraceContextV1;
|
|
88
|
+
}): Promise<RouterAbEd25519YaoTimedRegistrationExecutionResultV1>;
|
|
70
89
|
bindVerifiedIntent(input: RouterAbEd25519YaoVerifiedActivationIntentV1): Promise<RouterAbEd25519YaoRegistrationIntentBindingResult>;
|
|
71
90
|
consumeActivated(request: RouterAbEd25519YaoActivationConsumptionRequestV1): Promise<RouterAbEd25519YaoActivationConsumptionResultV1>;
|
|
72
91
|
};
|
|
@@ -176,6 +195,18 @@ export declare function createRouterAbEd25519YaoMaterialActivationRefV1(input: {
|
|
|
176
195
|
readonly walletId: WalletId;
|
|
177
196
|
readonly signingWorkerId: string;
|
|
178
197
|
}): RouterAbMpcMaterialActivationRefWire;
|
|
198
|
+
/**
|
|
199
|
+
* Mints the Yao identity of a registration's NEAR branch: its material
|
|
200
|
+
* identity and the session of its admission. Setup stores it, and the
|
|
201
|
+
* admission that follows the proof is issued over it.
|
|
202
|
+
*/
|
|
203
|
+
export declare function mintRouterAbEd25519YaoRegistrationIdentityV1(input: {
|
|
204
|
+
readonly walletId: WalletId;
|
|
205
|
+
readonly signingWorkerId: string;
|
|
206
|
+
}): {
|
|
207
|
+
readonly materialActivation: RouterAbMpcMaterialActivationRefWire;
|
|
208
|
+
readonly sessionId: RouterAbEd25519YaoBytes32V1;
|
|
209
|
+
};
|
|
179
210
|
/**
|
|
180
211
|
* Takes the authority *scope* rather than the authority because setup admits
|
|
181
212
|
* before the proof exists. Callers holding a verified authority
|