@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
|
@@ -1,36 +1,55 @@
|
|
|
1
|
-
import type { ExternalAuthResult, ExternalWalletAuthentication, ExternalWalletSettings } from '../../../shared-ts/src/auth/externalAuth';
|
|
1
|
+
import type { ExternalAuthResult, ExternalWalletAuthentication, ExternalWalletSettings, ExternalIdentity, ExternalIdentityProof, ExternalAuthPurpose, ExternalAuthAttempt } from '../../../shared-ts/src/auth/externalAuth';
|
|
2
2
|
import type { WalletId } from '../../../shared-ts/src/utils/domainIds';
|
|
3
3
|
import type { D1WalletStore } from '../core/d1WalletStore';
|
|
4
4
|
import type { WalletAuthMethodV2Store } from '../core/d1WalletAuthMethodStore';
|
|
5
5
|
import { ExternalAuthStore, type ExternalAuthTrust } from './externalAuthStore';
|
|
6
|
+
import type { Variant } from '../../../shared-ts/src/utils/variant';
|
|
6
7
|
export declare class ExternalAuthService {
|
|
7
8
|
readonly store: ExternalAuthStore;
|
|
8
9
|
private readonly wallets;
|
|
9
10
|
private readonly methods;
|
|
10
11
|
constructor(store: ExternalAuthStore, wallets: D1WalletStore, methods: WalletAuthMethodV2Store);
|
|
11
|
-
verifyGoogle(trust: ExternalAuthTrust, idToken: string): Promise<ExternalAuthResult<{
|
|
12
|
-
|
|
12
|
+
verifyGoogle(trust: Variant<ExternalAuthTrust, 'kind', 'google'>, idToken: string): Promise<ExternalAuthResult<{
|
|
13
|
+
identity: ExternalIdentity;
|
|
13
14
|
expiresAtMs: number;
|
|
14
|
-
trust: ExternalAuthTrust;
|
|
15
15
|
}>>;
|
|
16
16
|
prepare(input: {
|
|
17
|
+
purpose: ExternalAuthPurpose;
|
|
17
18
|
walletId: WalletId;
|
|
18
19
|
originBinding: string;
|
|
19
20
|
binding: string;
|
|
20
21
|
sessionToken: string;
|
|
21
|
-
}): Promise<ExternalAuthResult<
|
|
22
|
-
attemptId: string;
|
|
23
|
-
walletId: WalletId;
|
|
24
|
-
expiresAtMs: number;
|
|
25
|
-
}>>;
|
|
22
|
+
}): Promise<ExternalAuthResult<ExternalAuthAttempt<ExternalAuthPurpose>>>;
|
|
26
23
|
exchange(input: {
|
|
27
24
|
walletId: WalletId;
|
|
28
25
|
attemptId: string;
|
|
29
|
-
|
|
26
|
+
proof: ExternalIdentityProof;
|
|
30
27
|
trust: ExternalAuthTrust;
|
|
31
28
|
}): Promise<ExternalAuthResult<{
|
|
32
29
|
code: string;
|
|
33
30
|
}>>;
|
|
31
|
+
prepareUnlink(input: {
|
|
32
|
+
walletId: WalletId;
|
|
33
|
+
associationId: string;
|
|
34
|
+
originBinding: string;
|
|
35
|
+
binding: string;
|
|
36
|
+
sessionToken: string;
|
|
37
|
+
trustRevision: number;
|
|
38
|
+
}): Promise<ExternalAuthResult<{
|
|
39
|
+
attemptId: string;
|
|
40
|
+
code: string;
|
|
41
|
+
expiresAtMs: number;
|
|
42
|
+
}>>;
|
|
43
|
+
verifyIdentity(input: {
|
|
44
|
+
readonly trust: ExternalAuthTrust;
|
|
45
|
+
readonly proof: ExternalIdentityProof;
|
|
46
|
+
readonly walletId: WalletId;
|
|
47
|
+
readonly attemptId: string;
|
|
48
|
+
readonly purpose: ExternalAuthPurpose;
|
|
49
|
+
}): Promise<ExternalAuthResult<{
|
|
50
|
+
identity: ExternalIdentity;
|
|
51
|
+
expiresAtMs: number;
|
|
52
|
+
}>>;
|
|
34
53
|
settings(authentication: ExternalWalletAuthentication): Promise<ExternalWalletSettings>;
|
|
35
54
|
}
|
|
36
55
|
//# sourceMappingURL=externalAuthService.d.ts.map
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { ExternalWalletAuthentication, ExternalAuthConfiguration } from '../../../shared-ts/src/auth/externalAuth';
|
|
2
|
-
import type { Variant } from '../../../shared-ts/src/utils/variant';
|
|
1
|
+
import type { ExternalWalletAuthentication, ExternalAuthConfiguration, ExternalIdentity, ExternalAuthPurpose } from '../../../shared-ts/src/auth/externalAuth';
|
|
3
2
|
import type { WalletId, WalletAuthorityId } from '../../../shared-ts/src/utils/domainIds';
|
|
4
3
|
import { type D1TenantScope } from '../core/d1TenantStore';
|
|
5
4
|
import type { D1DatabaseLike } from '../storage/tenantRoute';
|
|
6
|
-
|
|
5
|
+
import type { ReadonlyExclusiveUnion } from '../../../shared-ts/src/utils/variant';
|
|
6
|
+
import type { ActiveWalletAuthorityV1 } from '../../../shared-ts/src/authorization/walletAuthority';
|
|
7
|
+
export type ExternalAuthTrust = Exclude<ExternalAuthConfiguration, {
|
|
8
|
+
kind: 'disabled';
|
|
9
|
+
}>;
|
|
7
10
|
type ExternalAuthPreparedAttempt = Readonly<{
|
|
11
|
+
purpose: ExternalAuthPurpose;
|
|
8
12
|
attemptId: string;
|
|
9
13
|
walletId: WalletId;
|
|
10
14
|
originBinding: string;
|
|
@@ -12,6 +16,36 @@ type ExternalAuthPreparedAttempt = Readonly<{
|
|
|
12
16
|
sessionTokenHash: string;
|
|
13
17
|
expiresAtMs: number;
|
|
14
18
|
}>;
|
|
19
|
+
export type ExternalOwnerAttemptBinding = Readonly<{
|
|
20
|
+
walletId: WalletId;
|
|
21
|
+
attemptId: string;
|
|
22
|
+
originBinding: string;
|
|
23
|
+
bindingHash: string;
|
|
24
|
+
sessionTokenHash: string;
|
|
25
|
+
codeHash: string;
|
|
26
|
+
trustRevision: number;
|
|
27
|
+
nowMs: number;
|
|
28
|
+
}>;
|
|
29
|
+
export type ExternalOwnerAttempt = Readonly<{
|
|
30
|
+
walletId: WalletId;
|
|
31
|
+
attemptId: string;
|
|
32
|
+
identity: ExternalIdentity;
|
|
33
|
+
originBinding: string;
|
|
34
|
+
trustRevision: number;
|
|
35
|
+
expiresAtMs: number;
|
|
36
|
+
status: 'verified' | 'consumed';
|
|
37
|
+
challenge: {
|
|
38
|
+
kind: 'unprepared';
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'ready';
|
|
41
|
+
expiresAtMs: number;
|
|
42
|
+
};
|
|
43
|
+
}> & ReadonlyExclusiveUnion<{
|
|
44
|
+
purpose: 'associate';
|
|
45
|
+
} | {
|
|
46
|
+
purpose: 'unlink';
|
|
47
|
+
associationId: string;
|
|
48
|
+
}>;
|
|
15
49
|
export declare class ExternalAuthStore {
|
|
16
50
|
private readonly database;
|
|
17
51
|
readonly scope: D1TenantScope;
|
|
@@ -20,20 +54,40 @@ export declare class ExternalAuthStore {
|
|
|
20
54
|
consumeAuthenticationAllowance(rateKey: string, nowMs: number): Promise<boolean>;
|
|
21
55
|
associate(input: {
|
|
22
56
|
walletId: WalletId;
|
|
23
|
-
|
|
57
|
+
identity: ExternalIdentity;
|
|
24
58
|
authorityId: WalletAuthorityId;
|
|
25
59
|
authorityEpoch: number;
|
|
26
60
|
}): Promise<boolean>;
|
|
27
|
-
revokeAssociation(
|
|
61
|
+
revokeAssociation(input: {
|
|
62
|
+
walletId: WalletId;
|
|
63
|
+
associationId: string;
|
|
64
|
+
owner: ActiveWalletAuthorityV1;
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
prepareUnlink(input: {
|
|
67
|
+
walletId: WalletId;
|
|
68
|
+
associationId: string;
|
|
69
|
+
attemptId: string;
|
|
70
|
+
originBinding: string;
|
|
71
|
+
bindingHash: string;
|
|
72
|
+
sessionTokenHash: string;
|
|
73
|
+
codeHash: string;
|
|
74
|
+
expiresAtMs: number;
|
|
75
|
+
trustRevision: number;
|
|
76
|
+
}): Promise<boolean>;
|
|
77
|
+
readOwnerAttempt(input: ExternalOwnerAttemptBinding): Promise<ExternalOwnerAttempt | null>;
|
|
78
|
+
prepareOwnerChallenge(input: ExternalOwnerAttemptBinding): Promise<ExternalOwnerAttempt | null>;
|
|
79
|
+
consumeOwnerAttempt(input: ExternalOwnerAttemptBinding, owner: ActiveWalletAuthorityV1): Promise<boolean>;
|
|
28
80
|
prepareAttempt(input: ExternalAuthPreparedAttempt): Promise<void>;
|
|
81
|
+
readPreparedPurpose(walletId: WalletId, attemptId: string, nowMs: number): Promise<ExternalAuthPurpose | null>;
|
|
29
82
|
verifyAttempt(input: {
|
|
30
83
|
attemptId: string;
|
|
31
84
|
walletId: WalletId;
|
|
32
|
-
|
|
85
|
+
identity: ExternalIdentity;
|
|
33
86
|
trust: ExternalAuthTrust;
|
|
34
87
|
codeHash: string;
|
|
35
88
|
nowMs: number;
|
|
36
89
|
sessionExpiresAtMs: number;
|
|
90
|
+
purpose: ExternalAuthPurpose;
|
|
37
91
|
}): Promise<boolean>;
|
|
38
92
|
redeem(input: {
|
|
39
93
|
attemptId: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ExternalAuthResult, type ExternalOwnerChallenge } from '../../../shared-ts/src/auth/externalAuth';
|
|
2
|
+
import { type WalletOwnerAdminOperation } from '../../../shared-ts/src/authorization/walletOwnerOperation';
|
|
3
|
+
import type { DigestB64u } from '../../../shared-ts/src/utils/canonicalPrimitives';
|
|
4
|
+
import { ExternalAuthStore, type ExternalOwnerAttempt, type ExternalOwnerAttemptBinding } from './externalAuthStore';
|
|
5
|
+
export type ExternalOwnerOperation = Readonly<{
|
|
6
|
+
attempt: ExternalOwnerAttempt;
|
|
7
|
+
operation: Extract<WalletOwnerAdminOperation, 'external_identity_associate' | 'external_identity_unlink'>;
|
|
8
|
+
payload: Readonly<Record<string, unknown>>;
|
|
9
|
+
challengeB64u: DigestB64u;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function readExternalOwnerOperation(input: {
|
|
12
|
+
readonly store: ExternalAuthStore;
|
|
13
|
+
readonly binding: ExternalOwnerAttemptBinding;
|
|
14
|
+
readonly requestOrigin: string;
|
|
15
|
+
readonly phase: 'prepare' | 'complete';
|
|
16
|
+
}): Promise<ExternalAuthResult<ExternalOwnerOperation>>;
|
|
17
|
+
export declare function externalOwnerChallenge(operation: ExternalOwnerOperation): ExternalOwnerChallenge;
|
|
18
|
+
//# sourceMappingURL=externalOwnerOperations.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { parseExternalAuthConfiguration, type ExternalAuthConfiguration, } from '../../shared-ts/src/auth/externalAuth';
|
|
1
|
+
export { parseExternalAuthConfiguration, parseExternalAuthProvider, type ExternalAuthConfiguration, type ExternalAuthProvider, } from '../../shared-ts/src/auth/externalAuth';
|
|
2
2
|
export * from './core/SessionService';
|
|
3
3
|
export * from './core/ThresholdService/evmCryptoWasm';
|
|
4
4
|
export * from './core/d1WalletStore';
|
|
@@ -94,6 +94,18 @@ type WalletRegistrationSessionCommitReadyBaseV2 = WalletRegistrationSessionCommi
|
|
|
94
94
|
readonly walletCustody?: WalletCustodyRegistrationOutcome;
|
|
95
95
|
};
|
|
96
96
|
export type WalletRegistrationSessionCommitReceiptV2 = {
|
|
97
|
+
readonly kind: 'wallet_registration_session_commit_receipt_v2';
|
|
98
|
+
readonly operation: 'near_provisioning';
|
|
99
|
+
readonly operationFingerprint: string;
|
|
100
|
+
readonly registrationCeremonyId: string;
|
|
101
|
+
readonly committed: {
|
|
102
|
+
readonly kind: 'near_owner_ready';
|
|
103
|
+
readonly expectedOrigin: string;
|
|
104
|
+
readonly response: Extract<WalletRegistrationFinalizeSuccess, {
|
|
105
|
+
kind: 'near_ed25519';
|
|
106
|
+
}>;
|
|
107
|
+
};
|
|
108
|
+
} | {
|
|
97
109
|
readonly kind: 'wallet_registration_session_commit_receipt_v2';
|
|
98
110
|
readonly operation: 'registration_activate' | 'near_provisioning';
|
|
99
111
|
readonly operationFingerprint: string;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { AuthorizationService } from '../../../../authorization/service';
|
|
2
|
+
import type { D1WalletAuthMethodStore } from '../../../../core/d1WalletAuthMethodStore';
|
|
2
3
|
import type { RouterApiServiceBag } from '../../../framework/authServicePort';
|
|
3
4
|
import type { CloudflareD1AuthorizationStore } from '../authorization/d1AuthorizationStore';
|
|
5
|
+
import type { CloudflareD1WalletAuthMethodService } from '../wallet/d1WalletAuthMethodService';
|
|
4
6
|
import type { NormalizedCloudflareD1RouterApiAuthServiceOptions } from './d1RouterApiAuthConfig';
|
|
5
7
|
type D1AuthorizedOperationRouteServiceAssembly = {
|
|
6
8
|
readonly authorizationService: AuthorizationService;
|
|
7
9
|
readonly authorizationStore: CloudflareD1AuthorizationStore;
|
|
8
|
-
readonly options: Pick<NormalizedCloudflareD1RouterApiAuthServiceOptions, 'orgId'>;
|
|
10
|
+
readonly options: Pick<NormalizedCloudflareD1RouterApiAuthServiceOptions, 'database' | 'namespace' | 'orgId' | 'projectId' | 'envId'>;
|
|
11
|
+
readonly walletAuthMethodStore: D1WalletAuthMethodStore;
|
|
12
|
+
readonly walletAuthMethods: CloudflareD1WalletAuthMethodService;
|
|
9
13
|
};
|
|
10
14
|
export declare function createD1AuthorizedOperationRouteService(assembly: D1AuthorizedOperationRouteServiceAssembly): RouterApiServiceBag['authorizedOperations'];
|
|
11
15
|
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type TenantId } from '../../../../../../shared-ts/src/authorization/capabilityKinds';
|
|
2
|
+
import type { AuthorizationService } from '../../../../authorization/service';
|
|
3
|
+
import type { D1WalletAuthMethodStore } from '../../../../core/d1WalletAuthMethodStore';
|
|
4
|
+
import type { RouterApiAuthorizedOperationService } from '../../../framework/authServicePort';
|
|
5
|
+
import type { CloudflareD1WalletAuthMethodService } from '../wallet/d1WalletAuthMethodService';
|
|
6
|
+
import type { NormalizedCloudflareD1RouterApiAuthServiceOptions } from './d1RouterApiAuthConfig';
|
|
7
|
+
type RecordedOwnerOperationSource = {
|
|
8
|
+
readonly options: Pick<NormalizedCloudflareD1RouterApiAuthServiceOptions, 'database' | 'namespace' | 'orgId' | 'projectId' | 'envId'>;
|
|
9
|
+
readonly authorizationService: AuthorizationService;
|
|
10
|
+
readonly walletAuthMethodStore: D1WalletAuthMethodStore;
|
|
11
|
+
readonly walletAuthMethods: CloudflareD1WalletAuthMethodService;
|
|
12
|
+
};
|
|
13
|
+
/** A continuation uses only the factor digest and exact operation recorded after owner verification. */
|
|
14
|
+
export declare function resolveRecordedPasskeyOwnerOperation(source: RecordedOwnerOperationSource, tenantId: TenantId, input: Parameters<RouterApiAuthorizedOperationService['resolveRecordedPasskeyOwnerOperation']>[0]): ReturnType<RouterApiAuthorizedOperationService['resolveRecordedPasskeyOwnerOperation']>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=d1RecordedOwnerOperation.d.ts.map
|
|
@@ -20,6 +20,7 @@ export declare function inferRuntimePolicyScopeFromSigningRoot(input: {
|
|
|
20
20
|
readonly signingRootVersion?: string;
|
|
21
21
|
}): RuntimePolicyScope | undefined;
|
|
22
22
|
export declare function buildRegistrationIntent(input: {
|
|
23
|
+
readonly completion: RegistrationIntentV1['completion'];
|
|
23
24
|
readonly nonceB64u: string;
|
|
24
25
|
readonly walletId: WalletId;
|
|
25
26
|
readonly authMethod: RegistrationAuthMethodInput;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RegistrationIntentV1 } from '../../../../../../shared-ts/src/utils/registrationIntent';
|
|
1
2
|
/**
|
|
2
3
|
* `/wallets/register/setup` — one request replacing the bootstrap grant, the
|
|
3
4
|
* registration intent, and registration start.
|
|
@@ -39,6 +40,7 @@ import type { WalletRegistrationSetupRequest } from '../../../domains/walletRegi
|
|
|
39
40
|
import { mintSignedWalletRegistrationSetup, type WalletRegistrationSetupMinter } from '../../../domains/walletRegistration/walletRegistrationSetupPayload';
|
|
40
41
|
export declare function normalizeWalletRegistrationSetupRequest(request: WalletRegistrationSetupRequest): {
|
|
41
42
|
readonly ok: true;
|
|
43
|
+
readonly completion: RegistrationIntentV1['completion'];
|
|
42
44
|
readonly signerSelection: RegistrationSignerSetSelection;
|
|
43
45
|
readonly authMethod: RegistrationAuthMethodInput;
|
|
44
46
|
} | {
|
|
@@ -11,6 +11,12 @@ export type WalletRegistrationNearProvisioningFinalizeResponse = WalletRegistrat
|
|
|
11
11
|
readonly registrationEstablishedSession: RegistrationEstablishedSessionResultV2;
|
|
12
12
|
});
|
|
13
13
|
export type RegistrationCommitExecution<T> = {
|
|
14
|
+
readonly kind: 'owner_registered';
|
|
15
|
+
readonly response: T;
|
|
16
|
+
readonly expectedOrigin: string;
|
|
17
|
+
readonly activation: RegistrationActivationWrite | null;
|
|
18
|
+
readonly custodyWrite: RouterAbEd25519YaoPreparedWriteV1 | null;
|
|
19
|
+
} | {
|
|
14
20
|
readonly kind: 'unissued';
|
|
15
21
|
readonly response: T;
|
|
16
22
|
readonly custodyWrite?: never;
|
|
@@ -47,7 +53,7 @@ export declare function projectWalletRegistrationSessionCommitReceiptV2(input: {
|
|
|
47
53
|
}): WalletRegistrationSessionCommitReceiptV2;
|
|
48
54
|
type WalletRegistrationIdentityCommitReceiptV2 = Exclude<WalletRegistrationSessionCommitReceiptV2, {
|
|
49
55
|
readonly committed: {
|
|
50
|
-
readonly kind: 'error';
|
|
56
|
+
readonly kind: 'error' | 'near_owner_ready';
|
|
51
57
|
};
|
|
52
58
|
}>;
|
|
53
59
|
type RegistrationReplayAuthMethodFields = {
|
package/dist/types/wallet-server/src/router/cloudflare/d1/wallet/d1WalletAuthMethodService.d.ts
CHANGED
|
@@ -311,6 +311,7 @@ export declare class CloudflareD1WalletAuthMethodService {
|
|
|
311
311
|
}): Promise<{
|
|
312
312
|
readonly ok: true;
|
|
313
313
|
readonly authority: EmailOtpWalletAuthAuthority;
|
|
314
|
+
readonly walletAuthority: ActiveWalletAuthorityV1;
|
|
314
315
|
} | WalletAuthMethodError>;
|
|
315
316
|
/**
|
|
316
317
|
* The exact active Email OTP authority a caller names. Several methods can
|
|
@@ -7,7 +7,7 @@ import type { AuthorizedOperation, OwnerOperationAuthorizationDecision } from '.
|
|
|
7
7
|
import { type RouterAbEd25519OperationStepUpPreparationV1Wire } from '../../../../../shared-ts/src/utils/routerAbNormalSigningIdentity';
|
|
8
8
|
import { type Ed25519OperationKind } from './ed25519AuthorizedOperationReceipt';
|
|
9
9
|
import { type RouterAbEcdsaOperationAdmissionKind, type RouterAbJsonRouteResult, type RouterAbNormalSigningAdmissionAdapter, type RouterAbNormalSigningRouteAdmission } from './routerAbNormalSigningAdmission';
|
|
10
|
-
import { type ActiveEd25519MaterialActivation, type RouterAbExactOperationStepUpAuthenticationResult, type RouterAbOperationStepUpWalletSession } from './routerAbOperationStepUp';
|
|
10
|
+
import { type ActiveEd25519MaterialActivation, type RouterAbExactOperationStepUpAuthenticationResult, type RouterAbVerifiedOwnerOperationStepUpAuthenticationResult, type RouterAbOperationStepUpWalletSession } from './routerAbOperationStepUp';
|
|
11
11
|
import { type RouterAbEd25519NormalSigningScopeV2 } from './routerAbPrivateSigningWorker';
|
|
12
12
|
export type RouterAbEd25519NormalSigningRoutePhase = 'prepare' | 'finalize';
|
|
13
13
|
export declare function buildRouterAbEd25519OwnerOperationStepUpPreparation(input: {
|
|
@@ -81,7 +81,7 @@ export declare function authenticateRouterAbWalletOperationStepUp(input: {
|
|
|
81
81
|
readonly authorizedOperations: RouterApiAuthorizedOperationService | null | undefined;
|
|
82
82
|
readonly authorizationSessions: RouterApiAuthorizationSessionService | null | undefined;
|
|
83
83
|
readonly resolveEd25519MaterialActivation: RouterApiWalletRegistrationService['resolveEd25519MaterialActivation'];
|
|
84
|
-
}): Promise<RouterAbExactOperationStepUpAuthenticationResult>;
|
|
84
|
+
}): Promise<RouterAbExactOperationStepUpAuthenticationResult | RouterAbVerifiedOwnerOperationStepUpAuthenticationResult>;
|
|
85
85
|
export declare function parseRouterAbEd25519OperationStepUpScope(value: unknown): RouterAbEd25519NormalSigningScopeV2;
|
|
86
86
|
export declare function parseRouterAbOperationStepUpOperation(value: unknown): {
|
|
87
87
|
readonly ok: true;
|
package/dist/types/wallet-server/src/router/domains/signingOperations/routerAbOperationStepUp.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ type RouterAbOperationStepUpAuthenticationSuccess<TSession extends RouterAbOpera
|
|
|
104
104
|
readonly expiresAtMs: number;
|
|
105
105
|
};
|
|
106
106
|
export type RouterAbExactOperationStepUpAuthenticationResult = RouterAbOperationStepUpAuthenticationSuccess<RouterAbExactOperationStepUpWalletSession> | RouterAbOperationStepUpAuthenticationFailure;
|
|
107
|
-
type RouterAbVerifiedOwnerOperationStepUpAuthenticationResult = (RouterAbOperationStepUpAuthenticationSuccess<RouterAbVerifiedOwnerOperationStepUpWalletSession> & {
|
|
107
|
+
export type RouterAbVerifiedOwnerOperationStepUpAuthenticationResult = (RouterAbOperationStepUpAuthenticationSuccess<RouterAbVerifiedOwnerOperationStepUpWalletSession> & {
|
|
108
108
|
readonly authorityRef: WalletAuthAuthorityRef;
|
|
109
109
|
}) | RouterAbOperationStepUpAuthenticationFailure;
|
|
110
110
|
export declare function walletSessionUnavailableFailure(): RouterAbOperationStepUpAuthenticationFailure;
|
package/dist/types/wallet-server/src/router/domains/walletRegistration/walletRegistrationInputs.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { WalletRegistrationAuthorityInput, WalletRegistrationFinalizeSigner
|
|
|
8
8
|
import type { ThresholdRuntimePolicyScope } from '../../../core/types';
|
|
9
9
|
import type { WalletRegistrationSetupMinter, WalletRegistrationSetupVerifier } from './walletRegistrationSetupPayload';
|
|
10
10
|
export type WalletRegistrationSetupRequest = {
|
|
11
|
+
readonly completion: import('../../../../../shared-ts/src/utils/registrationIntent').RegistrationCompletion;
|
|
11
12
|
readonly registrationOperationId: string;
|
|
12
13
|
readonly wallet?: RegisterWalletInput;
|
|
13
14
|
readonly signerSelection: RegistrationSignerSetSelection;
|
|
@@ -48,6 +48,14 @@ export type RegistrationWalletStartup = {
|
|
|
48
48
|
});
|
|
49
49
|
export type RegistrationPairStartup = Variant<RegistrationWalletStartup, 'kind', 'pair'>;
|
|
50
50
|
export type RegistrationWalletStarter = (registration: RegistrationWalletStartup) => Promise<void>;
|
|
51
|
+
export type RegistrationSessionPublication = {
|
|
52
|
+
readonly kind: 'none';
|
|
53
|
+
readonly walletId?: never;
|
|
54
|
+
readonly digest?: never;
|
|
55
|
+
readonly expiresAtMs?: never;
|
|
56
|
+
} | (WalletSessionLocatorPublication & {
|
|
57
|
+
readonly kind: 'credential';
|
|
58
|
+
});
|
|
51
59
|
type ReservationOutcome = {
|
|
52
60
|
readonly ok: true;
|
|
53
61
|
} | {
|
|
@@ -84,9 +92,7 @@ export interface WalletRegistrationReservationAuthority {
|
|
|
84
92
|
readonly walletId: WalletId;
|
|
85
93
|
} & ({
|
|
86
94
|
readonly outcome: 'established';
|
|
87
|
-
readonly session:
|
|
88
|
-
readonly kind: 'credential';
|
|
89
|
-
};
|
|
95
|
+
readonly session: RegistrationSessionPublication;
|
|
90
96
|
} | {
|
|
91
97
|
readonly outcome: 'cancelled';
|
|
92
98
|
readonly session?: never;
|
|
@@ -115,9 +121,7 @@ export interface WalletRegistrationHomeAuthority extends Pick<WalletRegistration
|
|
|
115
121
|
*/
|
|
116
122
|
prepareEstablished(input: {
|
|
117
123
|
readonly registration: CommittedWalletRegistration;
|
|
118
|
-
readonly session:
|
|
119
|
-
readonly kind: 'credential';
|
|
120
|
-
};
|
|
124
|
+
readonly session: RegistrationSessionPublication;
|
|
121
125
|
}): RegistrationActivationWrite | null;
|
|
122
126
|
/** Fixes a definitive cancellation, publishes it, and retires the local home. */
|
|
123
127
|
cancel(input: {
|
|
@@ -130,5 +134,6 @@ export declare function proposeWalletRegistrationSetup(input: Pick<WalletRegistr
|
|
|
130
134
|
export declare function walletRegistrationSetupRequestDigest(namespace: string, input: Pick<WalletRegistrationSetupInput, 'request' | 'orgId' | 'expectedOrigin' | 'runtimePolicyScope'>): Promise<string>;
|
|
131
135
|
export declare function cancelRegistrationHome(authority: Pick<WalletRegistrationHomeAuthority, 'cancel'> | null, input: Parameters<WalletRegistrationHomeAuthority['cancel']>[0]): Promise<ReservationOutcome>;
|
|
132
136
|
export declare function admitRegistrationReservationHome(authority: Pick<WalletRegistrationReservationAuthority, 'admitHome'> | null, input: Parameters<WalletRegistrationReservationAuthority['admitHome']>[0]): Promise<RegistrationHomeAdmission>;
|
|
137
|
+
export declare function parseRegistrationSessionPublication(raw: unknown, walletId: WalletId): RegistrationSessionPublication;
|
|
133
138
|
export {};
|
|
134
139
|
//# sourceMappingURL=walletRegistrationReservation.d.ts.map
|
|
@@ -1120,6 +1120,7 @@ export interface RouterApiWalletAuthMethodService {
|
|
|
1120
1120
|
}): Promise<{
|
|
1121
1121
|
readonly ok: true;
|
|
1122
1122
|
readonly authority: EmailOtpWalletAuthAuthority;
|
|
1123
|
+
readonly walletAuthority: ActiveWalletAuthorityV1;
|
|
1123
1124
|
} | {
|
|
1124
1125
|
readonly ok: false;
|
|
1125
1126
|
readonly code: string;
|
|
@@ -1331,6 +1332,16 @@ export interface RouterApiAuthorizedOperationService {
|
|
|
1331
1332
|
admitEd25519WalletSessionOperation(input: import('../../authorization/ed25519WalletSessionAdmission').Ed25519WalletSessionAdmissionInput): Promise<import('../../authorization/ed25519WalletSessionAdmission').Ed25519WalletSessionAdmissionResult>;
|
|
1332
1333
|
resolveEd25519WalletSessionOperation(input: import('../../authorization/ed25519WalletSessionAdmission').Ed25519WalletSessionResolutionInput): Promise<import('../../authorization/ed25519WalletSessionAdmission').Ed25519WalletSessionResolutionResult>;
|
|
1333
1334
|
readonly tenantId: TenantId;
|
|
1335
|
+
resolveRecordedPasskeyOwnerOperation(input: {
|
|
1336
|
+
readonly authorizedOperationId: import('../../../../shared-ts/src/authorization/capabilityKinds').AuthorizedOperationId;
|
|
1337
|
+
readonly walletId: WalletId;
|
|
1338
|
+
readonly requestOrigin: import('../../authorization/domain').SessionOrigin;
|
|
1339
|
+
readonly nowMs: number;
|
|
1340
|
+
}): Promise<{
|
|
1341
|
+
readonly operation: AuthorizedOperation;
|
|
1342
|
+
readonly authority: import('../../../../shared-ts/src/utils/walletAuthAuthority').PasskeyWalletAuthAuthority;
|
|
1343
|
+
readonly expiresAtMs: number;
|
|
1344
|
+
} | null>;
|
|
1334
1345
|
readPinnedOwnerWalletScope(input: {
|
|
1335
1346
|
readonly operation: AuthorizedOperation;
|
|
1336
1347
|
readonly walletId: WalletId;
|
package/dist/types/wallet-server/src/router/transport/fetch/walletOwnerOperationAuthorization.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ActiveWalletAuthorityV1 } from '../../../../../shared-ts/src/authorization/walletAuthority';
|
|
2
|
+
import { type WalletOwnerAdminOperation } from '../../../../../shared-ts/src/authorization/walletOwnerOperation';
|
|
3
|
+
import { type DigestB64u } from '../../../../../shared-ts/src/utils/canonicalPrimitives';
|
|
4
|
+
import { type AuthorizedOperation } from '../../../authorization/domain';
|
|
5
|
+
import type { FetchRouterApiContext } from './fetchRouter.types';
|
|
6
|
+
export type WalletOwnerAuthorizationResult = {
|
|
7
|
+
readonly ok: true;
|
|
8
|
+
readonly operation: AuthorizedOperation;
|
|
9
|
+
readonly ownerAuthority: ActiveWalletAuthorityV1;
|
|
10
|
+
} | {
|
|
11
|
+
readonly ok: false;
|
|
12
|
+
readonly response: Response;
|
|
13
|
+
};
|
|
14
|
+
export declare function walletOwnerOperationAuthorizationId(operation: WalletOwnerAdminOperation, challenge: DigestB64u): import("../../../../../shared-ts/src/authorization/capabilityKinds").AuthorizedOperationId;
|
|
15
|
+
export declare function authorizeWalletOwnerOperation(input: {
|
|
16
|
+
readonly ctx: FetchRouterApiContext;
|
|
17
|
+
readonly walletId: string;
|
|
18
|
+
readonly operation: WalletOwnerAdminOperation;
|
|
19
|
+
readonly payload: Record<string, unknown>;
|
|
20
|
+
readonly factorProof: unknown;
|
|
21
|
+
}): Promise<WalletOwnerAuthorizationResult>;
|
|
22
|
+
export declare function completeWalletOwnerOperation(ctx: FetchRouterApiContext, operation: AuthorizedOperation, status: number, body: Record<string, unknown>, result?: 'succeeded' | 'failed_before_side_effect'): Promise<Response>;
|
|
23
|
+
//# sourceMappingURL=walletOwnerOperationAuthorization.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
-- Reject unfinished transfers. Completed receipts remain immutable.
|
|
2
|
+
CREATE TABLE external_auth_relocation_upgrade_guard (count INTEGER NOT NULL CHECK (count = 0));
|
|
3
|
+
INSERT INTO external_auth_relocation_upgrade_guard
|
|
4
|
+
SELECT (SELECT COUNT(*) FROM wallet_relocation_authorization_snapshots AS snapshot
|
|
5
|
+
WHERE NOT EXISTS (
|
|
6
|
+
SELECT 1 FROM wallet_relocation_authorization_cleanups AS cleanup
|
|
7
|
+
WHERE cleanup.namespace = snapshot.namespace AND cleanup.org_id = snapshot.org_id
|
|
8
|
+
AND cleanup.project_id = snapshot.project_id AND cleanup.env_id = snapshot.env_id
|
|
9
|
+
AND cleanup.wallet_id = snapshot.wallet_id AND cleanup.move_id = snapshot.move_id
|
|
10
|
+
AND cleanup.request_digest_hex = snapshot.request_digest_hex
|
|
11
|
+
AND cleanup.source_generation = snapshot.source_generation
|
|
12
|
+
AND cleanup.state = 'cleaned'))
|
|
13
|
+
+ (SELECT COUNT(*) FROM wallet_relocation_authorization_imports WHERE state != 'activated');
|
|
14
|
+
DROP TABLE external_auth_relocation_upgrade_guard;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
-- Identity domains remain distinct across Google and application-issued subjects.
|
|
18
|
+
UPDATE external_auth_associations
|
|
19
|
+
SET provider_subject = json_array('google', 'https://accounts.google.com', provider_subject);
|
|
20
|
+
|
|
21
|
+
ALTER TABLE external_auth_attempts RENAME TO external_auth_attempts_before_application;
|
|
22
|
+
CREATE TABLE external_auth_attempts (
|
|
23
|
+
namespace TEXT NOT NULL, org_id TEXT NOT NULL, project_id TEXT NOT NULL, env_id TEXT NOT NULL,
|
|
24
|
+
attempt_id TEXT NOT NULL, wallet_id TEXT NOT NULL, origin TEXT NOT NULL,
|
|
25
|
+
binding_hash TEXT NOT NULL, session_token_hash TEXT NOT NULL, expires_at_ms INTEGER NOT NULL,
|
|
26
|
+
status TEXT NOT NULL CHECK (status IN ('prepared', 'verified', 'consumed', 'revoked')),
|
|
27
|
+
purpose TEXT NOT NULL CHECK (purpose IN ('authenticate', 'associate', 'unlink')),
|
|
28
|
+
association_id TEXT, trust_revision INTEGER, code_hash TEXT, session_expires_at_ms INTEGER,
|
|
29
|
+
identity_subject TEXT, owner_challenge_expires_at_ms INTEGER,
|
|
30
|
+
PRIMARY KEY (namespace, org_id, project_id, env_id, attempt_id),
|
|
31
|
+
CHECK (
|
|
32
|
+
status = 'revoked' OR
|
|
33
|
+
(status = 'prepared' AND purpose IN ('authenticate', 'associate')
|
|
34
|
+
AND association_id IS NULL AND trust_revision IS NULL AND code_hash IS NULL
|
|
35
|
+
AND session_expires_at_ms IS NULL AND identity_subject IS NULL
|
|
36
|
+
AND owner_challenge_expires_at_ms IS NULL) OR
|
|
37
|
+
(status IN ('verified', 'consumed') AND trust_revision IS NOT NULL AND code_hash IS NOT NULL
|
|
38
|
+
AND identity_subject IS NOT NULL AND (
|
|
39
|
+
(purpose = 'authenticate' AND association_id IS NOT NULL
|
|
40
|
+
AND session_expires_at_ms IS NOT NULL AND owner_challenge_expires_at_ms IS NULL) OR
|
|
41
|
+
(purpose = 'associate' AND session_expires_at_ms IS NOT NULL
|
|
42
|
+
AND (status = 'verified' OR owner_challenge_expires_at_ms IS NOT NULL)) OR
|
|
43
|
+
(purpose = 'unlink' AND association_id IS NOT NULL AND session_expires_at_ms IS NULL
|
|
44
|
+
AND (status = 'verified' OR owner_challenge_expires_at_ms IS NOT NULL))
|
|
45
|
+
))
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
INSERT INTO external_auth_attempts
|
|
49
|
+
(namespace, org_id, project_id, env_id, attempt_id, wallet_id, origin, binding_hash,
|
|
50
|
+
session_token_hash, expires_at_ms, status, purpose, association_id, trust_revision,
|
|
51
|
+
code_hash, session_expires_at_ms, identity_subject)
|
|
52
|
+
SELECT attempt.namespace, attempt.org_id, attempt.project_id, attempt.env_id, attempt.attempt_id,
|
|
53
|
+
attempt.wallet_id, attempt.origin, attempt.binding_hash, attempt.session_token_hash,
|
|
54
|
+
attempt.expires_at_ms,
|
|
55
|
+
CASE WHEN attempt.status IN ('verified', 'consumed') AND association.association_id IS NULL
|
|
56
|
+
THEN 'revoked' ELSE attempt.status END,
|
|
57
|
+
'authenticate', attempt.association_id, attempt.trust_revision, attempt.code_hash,
|
|
58
|
+
attempt.session_expires_at_ms, association.provider_subject
|
|
59
|
+
FROM external_auth_attempts_before_application attempt
|
|
60
|
+
LEFT JOIN external_auth_associations association
|
|
61
|
+
ON association.namespace = attempt.namespace AND association.org_id = attempt.org_id
|
|
62
|
+
AND association.project_id = attempt.project_id AND association.env_id = attempt.env_id
|
|
63
|
+
AND association.association_id = attempt.association_id;
|
|
64
|
+
DROP TABLE external_auth_attempts_before_application;
|
|
65
|
+
CREATE UNIQUE INDEX external_auth_session_token
|
|
66
|
+
ON external_auth_attempts(namespace, org_id, project_id, env_id, session_token_hash);
|
|
67
|
+
CREATE INDEX external_auth_attempt_expiry ON external_auth_attempts(expires_at_ms);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
-- Reject unfinished transfers. Completed receipts remain immutable.
|
|
2
|
+
CREATE TABLE registration_publication_relocation_upgrade_guard (count INTEGER NOT NULL CHECK (count = 0));
|
|
3
|
+
INSERT INTO registration_publication_relocation_upgrade_guard
|
|
4
|
+
SELECT (SELECT COUNT(*) FROM wallet_relocation_authorization_snapshots AS snapshot
|
|
5
|
+
WHERE NOT EXISTS (
|
|
6
|
+
SELECT 1 FROM wallet_relocation_authorization_cleanups AS cleanup
|
|
7
|
+
WHERE cleanup.namespace = snapshot.namespace AND cleanup.org_id = snapshot.org_id
|
|
8
|
+
AND cleanup.project_id = snapshot.project_id AND cleanup.env_id = snapshot.env_id
|
|
9
|
+
AND cleanup.wallet_id = snapshot.wallet_id AND cleanup.move_id = snapshot.move_id
|
|
10
|
+
AND cleanup.request_digest_hex = snapshot.request_digest_hex
|
|
11
|
+
AND cleanup.source_generation = snapshot.source_generation
|
|
12
|
+
AND cleanup.state = 'cleaned'))
|
|
13
|
+
+ (SELECT COUNT(*) FROM wallet_relocation_authorization_imports WHERE state != 'activated');
|
|
14
|
+
DROP TABLE registration_publication_relocation_upgrade_guard;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
-- Keep the retryable registration publication independent of session issuance.
|
|
18
|
+
DROP TRIGGER wallet_registration_directory_publication_identity;
|
|
19
|
+
ALTER TABLE wallet_registration_directory_publications RENAME TO registration_publications_with_session;
|
|
20
|
+
CREATE TABLE wallet_registration_directory_publications (
|
|
21
|
+
namespace TEXT NOT NULL, org_id TEXT NOT NULL, project_id TEXT NOT NULL, env_id TEXT NOT NULL,
|
|
22
|
+
wallet_id TEXT NOT NULL,
|
|
23
|
+
ceremony_id TEXT NOT NULL CHECK(length(ceremony_id) > 0),
|
|
24
|
+
session_json TEXT NOT NULL CHECK(json_valid(session_json) AND json_extract(session_json, '$.kind') IN ('none', 'credential')),
|
|
25
|
+
state TEXT NOT NULL DEFAULT 'pending' CHECK(state IN ('pending', 'refused')),
|
|
26
|
+
attempts INTEGER NOT NULL DEFAULT 0 CHECK(attempts >= 0),
|
|
27
|
+
next_attempt_at_ms INTEGER NOT NULL CHECK(next_attempt_at_ms > 0),
|
|
28
|
+
PRIMARY KEY(namespace, org_id, project_id, env_id, wallet_id)
|
|
29
|
+
);
|
|
30
|
+
INSERT INTO wallet_registration_directory_publications
|
|
31
|
+
SELECT namespace, org_id, project_id, env_id, wallet_id, ceremony_id,
|
|
32
|
+
json_object('kind', 'credential', 'walletId', wallet_id, 'digest', session_digest, 'expiresAtMs', session_expires_at_ms),
|
|
33
|
+
state, attempts, next_attempt_at_ms
|
|
34
|
+
FROM registration_publications_with_session;
|
|
35
|
+
DROP TABLE registration_publications_with_session;
|
|
36
|
+
CREATE INDEX wallet_registration_directory_publications_due
|
|
37
|
+
ON wallet_registration_directory_publications(namespace, org_id, project_id, env_id, state, next_attempt_at_ms);
|
|
38
|
+
CREATE TRIGGER wallet_registration_directory_publication_identity
|
|
39
|
+
BEFORE UPDATE ON wallet_registration_directory_publications
|
|
40
|
+
WHEN NEW.wallet_id IS NOT OLD.wallet_id OR NEW.ceremony_id IS NOT OLD.ceremony_id
|
|
41
|
+
OR NEW.session_json IS NOT OLD.session_json
|
|
42
|
+
OR (OLD.state = 'refused' AND NEW.state != 'refused')
|
|
43
|
+
BEGIN SELECT RAISE(ABORT, 'wallet_registration_directory_publication_conflicts'); END;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seams/wallet-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Seams server TypeScript SDK for NEAR and EVM-family wallets",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -67,7 +67,12 @@
|
|
|
67
67
|
"default": "./dist/esm/tenant-root.js"
|
|
68
68
|
},
|
|
69
69
|
"./local-runtime": "./cloudflare-router-ab/scripts/prepare-local-runtime-config.mjs",
|
|
70
|
-
"./local-runtime/*": "./cloudflare-router-ab/scripts/*"
|
|
70
|
+
"./local-runtime/*": "./cloudflare-router-ab/scripts/*",
|
|
71
|
+
"./application-auth": {
|
|
72
|
+
"types": "./dist/types/wallet-server/src/application-auth.d.ts",
|
|
73
|
+
"import": "./dist/esm/application-auth.js",
|
|
74
|
+
"default": "./dist/esm/application-auth.js"
|
|
75
|
+
}
|
|
71
76
|
},
|
|
72
77
|
"files": [
|
|
73
78
|
"LICENSE.md",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type DigestB64u } from '../utils/canonicalPrimitives';
|
|
2
|
-
export type WalletCustodyAdminOperation = 'credentials_list' | 'credential_label' | 'recovery_rotate' | 'recovery_read' | 'recovery_status' | 'recovery_backup_acknowledge';
|
|
3
|
-
/** Public challenge digest for a single wallet-administration factor proof. */
|
|
4
|
-
export declare function computeWalletCustodyAdminChallengeDigest(input: {
|
|
5
|
-
readonly walletId: string;
|
|
6
|
-
readonly operation: WalletCustodyAdminOperation;
|
|
7
|
-
readonly payload: Record<string, unknown>;
|
|
8
|
-
readonly requestOrigin: string;
|
|
9
|
-
}): Promise<DigestB64u>;
|
|
10
|
-
//# sourceMappingURL=walletCustodyOperation.d.ts.map
|