@accesly/react 0.7.0 → 1.0.0-pre.1
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/CHANGELOG.md +73 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.cjs +33 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -147
- package/dist/index.d.ts +80 -147
- package/dist/index.js +35 -55
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,60 +1,7 @@
|
|
|
1
|
-
import { Environment, CognitoConfig, AuthClient, SessionStorage,
|
|
1
|
+
import { Environment, CognitoConfig, AuthClient, SessionStorage, DeviceStore, TelemetrySink, TokenManager, AccesslyEndpoints, AuthStatus, CredentialRecord } from '@accesly/core';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Structural type for the optional ZK email prover. Defined here (not
|
|
7
|
-
* imported from `@accesly/zkemail`) so this package stays
|
|
8
|
-
* runtime-independent of zkemail. Apps that wire recovery pass an
|
|
9
|
-
* `@accesly/zkemail` `ZkEmailProver` instance — its public shape is a
|
|
10
|
-
* superset of this.
|
|
11
|
-
*/
|
|
12
|
-
interface ZkEmailProverHandle {
|
|
13
|
-
prove(args: {
|
|
14
|
-
readonly eml: string;
|
|
15
|
-
readonly recovery: {
|
|
16
|
-
readonly recipientEmail: string;
|
|
17
|
-
readonly walletAddress: string;
|
|
18
|
-
readonly newPasskeyPubkey: Uint8Array;
|
|
19
|
-
readonly domainSalt: Uint8Array;
|
|
20
|
-
};
|
|
21
|
-
readonly rsaModulus: bigint;
|
|
22
|
-
}): Promise<{
|
|
23
|
-
readonly bundle: {
|
|
24
|
-
readonly proof: {
|
|
25
|
-
readonly a: Uint8Array;
|
|
26
|
-
readonly b: Uint8Array;
|
|
27
|
-
readonly c: Uint8Array;
|
|
28
|
-
};
|
|
29
|
-
readonly publicSignals: readonly Uint8Array[];
|
|
30
|
-
};
|
|
31
|
-
readonly elapsedMs: number;
|
|
32
|
-
}>;
|
|
33
|
-
}
|
|
34
|
-
interface AcceslyContextValue {
|
|
35
|
-
readonly appId: string;
|
|
36
|
-
readonly env: Environment;
|
|
37
|
-
readonly apiUrl: string;
|
|
38
|
-
readonly cognitoConfig: CognitoConfig;
|
|
39
|
-
readonly authClient: AuthClient;
|
|
40
|
-
readonly sessionStorage: SessionStorage;
|
|
41
|
-
readonly tokenManager: TokenManager;
|
|
42
|
-
readonly endpoints: AccesslyEndpoints;
|
|
43
|
-
readonly deviceStore: DeviceStore;
|
|
44
|
-
/** Current auth status — re-rendered whenever it changes. */
|
|
45
|
-
readonly status: AuthStatus;
|
|
46
|
-
readonly username: string | null;
|
|
47
|
-
/** Force a re-read of `tokenManager.getStatus()`. */
|
|
48
|
-
readonly refreshStatus: () => Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Optional ZK email prover for SEP-30 recovery. When omitted,
|
|
51
|
-
* `auth.recover()` throws `RecoveryNotAvailableError`. Apps that need
|
|
52
|
-
* recovery wire it via `<AcceslyProvider zkEmailProver={...}>`.
|
|
53
|
-
*/
|
|
54
|
-
readonly zkEmailProver?: ZkEmailProverHandle;
|
|
55
|
-
}
|
|
56
|
-
declare const AcceslyContext: react.Context<AcceslyContextValue | null>;
|
|
57
|
-
|
|
58
5
|
/**
|
|
59
6
|
* `AcceslyProvider` — top-level React provider that creates the SDK instances
|
|
60
7
|
* once and exposes them through context. All hooks consume this.
|
|
@@ -84,15 +31,27 @@ interface AcceslyProviderProps {
|
|
|
84
31
|
};
|
|
85
32
|
/** Optional telemetry sink — surfaces every API request/response/retry. */
|
|
86
33
|
readonly telemetry?: TelemetrySink;
|
|
87
|
-
/**
|
|
88
|
-
* Optional ZK email prover for SEP-30 recovery. Pass an instance from
|
|
89
|
-
* `@accesly/zkemail` (`createZkEmailProver({ artifactsBaseUrl })`). When
|
|
90
|
-
* omitted, `auth.recover()` throws `RecoveryNotAvailableError`.
|
|
91
|
-
*/
|
|
92
|
-
readonly zkEmailProver?: ZkEmailProverHandle;
|
|
93
34
|
}
|
|
94
35
|
declare function AcceslyProvider(props: AcceslyProviderProps): JSX.Element;
|
|
95
36
|
|
|
37
|
+
interface AcceslyContextValue {
|
|
38
|
+
readonly appId: string;
|
|
39
|
+
readonly env: Environment;
|
|
40
|
+
readonly apiUrl: string;
|
|
41
|
+
readonly cognitoConfig: CognitoConfig;
|
|
42
|
+
readonly authClient: AuthClient;
|
|
43
|
+
readonly sessionStorage: SessionStorage;
|
|
44
|
+
readonly tokenManager: TokenManager;
|
|
45
|
+
readonly endpoints: AccesslyEndpoints;
|
|
46
|
+
readonly deviceStore: DeviceStore;
|
|
47
|
+
/** Current auth status — re-rendered whenever it changes. */
|
|
48
|
+
readonly status: AuthStatus;
|
|
49
|
+
readonly username: string | null;
|
|
50
|
+
/** Force a re-read of `tokenManager.getStatus()`. */
|
|
51
|
+
readonly refreshStatus: () => Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
declare const AcceslyContext: react.Context<AcceslyContextValue | null>;
|
|
54
|
+
|
|
96
55
|
/**
|
|
97
56
|
* Per-environment defaults — currently the only public stage is `dev`. The
|
|
98
57
|
* others are placeholders so the SDK API doesn't change when `staging`/`prod`
|
|
@@ -136,58 +95,6 @@ declare const ENVIRONMENT_DEFAULTS: Record<Environment, EnvironmentDefaults>;
|
|
|
136
95
|
* `auth` don't bring `wallet` into their render.
|
|
137
96
|
*/
|
|
138
97
|
|
|
139
|
-
/**
|
|
140
|
-
* Structural type of `@accesly/zkemail`'s `ZkEmailProver`. Defined here so
|
|
141
|
-
* `@accesly/react` does not take a hard runtime dep on `@accesly/zkemail`.
|
|
142
|
-
* Consumers who use recovery wire in a real prover via `<AcceslyProvider>`.
|
|
143
|
-
*/
|
|
144
|
-
interface ZkEmailProverLike {
|
|
145
|
-
prove(args: {
|
|
146
|
-
readonly eml: string;
|
|
147
|
-
readonly recovery: {
|
|
148
|
-
readonly recipientEmail: string;
|
|
149
|
-
readonly walletAddress: string;
|
|
150
|
-
readonly newPasskeyPubkey: Uint8Array;
|
|
151
|
-
readonly domainSalt: Uint8Array;
|
|
152
|
-
};
|
|
153
|
-
readonly rsaModulus: bigint;
|
|
154
|
-
}): Promise<{
|
|
155
|
-
readonly bundle: {
|
|
156
|
-
readonly proof: {
|
|
157
|
-
readonly a: Uint8Array;
|
|
158
|
-
readonly b: Uint8Array;
|
|
159
|
-
readonly c: Uint8Array;
|
|
160
|
-
};
|
|
161
|
-
readonly publicSignals: readonly Uint8Array[];
|
|
162
|
-
};
|
|
163
|
-
readonly elapsedMs: number;
|
|
164
|
-
}>;
|
|
165
|
-
}
|
|
166
|
-
/** Input to `auth.recover()` once a `ZkEmailProver` is configured. */
|
|
167
|
-
interface RecoverInput {
|
|
168
|
-
/** Raw .eml as downloaded by the user from Gmail's "Show original". */
|
|
169
|
-
readonly eml: string;
|
|
170
|
-
/** Lowercase, trimmed recipient address that received the DKIM-signed message. */
|
|
171
|
-
readonly recipientEmail: string;
|
|
172
|
-
/** Wallet address being recovered (G... strkey). */
|
|
173
|
-
readonly walletAddress: string;
|
|
174
|
-
/** New passkey public key (secp256r1, 64 bytes) that will replace the lost one. */
|
|
175
|
-
readonly newPasskeyPubkey: Uint8Array;
|
|
176
|
-
/** Domain salt from the deployed Smart Account, per D1.4. 32 bytes. */
|
|
177
|
-
readonly domainSalt: Uint8Array;
|
|
178
|
-
/** RSA-2048 modulus of the DKIM key that signed the .eml. */
|
|
179
|
-
readonly rsaModulus: bigint;
|
|
180
|
-
}
|
|
181
|
-
/** Output of a successful recovery proof build. The backend Lambda (Phase 6) submits this. */
|
|
182
|
-
interface RecoverResult {
|
|
183
|
-
readonly proof: {
|
|
184
|
-
readonly a: Uint8Array;
|
|
185
|
-
readonly b: Uint8Array;
|
|
186
|
-
readonly c: Uint8Array;
|
|
187
|
-
};
|
|
188
|
-
readonly publicSignals: readonly Uint8Array[];
|
|
189
|
-
readonly elapsedMs: number;
|
|
190
|
-
}
|
|
191
98
|
interface AuthNamespace {
|
|
192
99
|
readonly status: AuthStatus;
|
|
193
100
|
readonly username: string | null;
|
|
@@ -199,24 +106,6 @@ interface AuthNamespace {
|
|
|
199
106
|
resendConfirmation(email: string): Promise<void>;
|
|
200
107
|
signIn(email: string, password: string): Promise<void>;
|
|
201
108
|
signOut(): Promise<void>;
|
|
202
|
-
/**
|
|
203
|
-
* SEP-30 account recovery via ZK email proof. Generates a Groth16 proof
|
|
204
|
-
* client-side that the deployed Soroban verifier accepts. Throws
|
|
205
|
-
* `RecoveryNotAvailableError` if no `zkEmailProver` was configured on
|
|
206
|
-
* the `<AcceslyProvider>`.
|
|
207
|
-
*
|
|
208
|
-
* The returned `RecoverResult` is ready for the Phase 6 `sep30Handler`
|
|
209
|
-
* Lambda, which submits the rotation tx to Soroban on the user's behalf.
|
|
210
|
-
*/
|
|
211
|
-
recover(input: RecoverInput): Promise<RecoverResult>;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Thrown by `auth.recover()` when the app did not configure a `zkEmailProver`
|
|
215
|
-
* on the `<AcceslyProvider>`. To enable recovery, install `@accesly/zkemail`
|
|
216
|
-
* and pass `<AcceslyProvider zkEmailProver={prover}>`.
|
|
217
|
-
*/
|
|
218
|
-
declare class RecoveryNotAvailableError extends Error {
|
|
219
|
-
constructor();
|
|
220
109
|
}
|
|
221
110
|
interface CreateWalletInput {
|
|
222
111
|
readonly email: string;
|
|
@@ -238,6 +127,22 @@ interface CreateWalletInput {
|
|
|
238
127
|
readonly credentialId?: Uint8Array;
|
|
239
128
|
/** Optional. See `credentialId`. */
|
|
240
129
|
readonly prfSalt?: Uint8Array;
|
|
130
|
+
/**
|
|
131
|
+
* Password de Cognito en plano (`Uint8Array` codificado UTF-8).
|
|
132
|
+
*
|
|
133
|
+
* Recovery v2 (Fase 1, 2026-06-15): si se provee, el SDK deriva
|
|
134
|
+
* `recoveryKey = PBKDF2(password, recoverySalt, 600k)` y la usa para
|
|
135
|
+
* cifrar F3 antes de enviarlo al backend, en vez de usar
|
|
136
|
+
* `encryptionKeys[2]`. El backend almacena F3 cifrado con esa key —
|
|
137
|
+
* SOLO descifrable client-side con el mismo password.
|
|
138
|
+
*
|
|
139
|
+
* Sin esta prop el wallet se crea pero NO podrá recuperarse vía OTP
|
|
140
|
+
* (F3 quedará cifrado con `encryptionKeys[2]`, igual que en 0.x).
|
|
141
|
+
*
|
|
142
|
+
* El caller es responsable de zeroizar este buffer tras `createWallet`
|
|
143
|
+
* (el SDK no lo retiene en memoria).
|
|
144
|
+
*/
|
|
145
|
+
readonly cognitoPassword?: Uint8Array;
|
|
241
146
|
}
|
|
242
147
|
interface CreatedWalletInfo {
|
|
243
148
|
readonly walletAddress: string;
|
|
@@ -521,27 +426,55 @@ declare class NotImplementedYetError extends Error {
|
|
|
521
426
|
constructor(namespace: string, method: string);
|
|
522
427
|
}
|
|
523
428
|
/**
|
|
524
|
-
*
|
|
525
|
-
* endpoints exposed by the Phase 6 `sep30Handler` Lambda. These are SEP-30
|
|
526
|
-
* standard — interoperable with Freighter/Lobstr/etc. — and stateful from the
|
|
527
|
-
* backend's perspective (persists identities + signers in DynamoDB).
|
|
429
|
+
* Recovery v2 — OTP por email + password de Cognito (Fase 1, 2026-06-15).
|
|
528
430
|
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
431
|
+
* Flujo desde la UI:
|
|
432
|
+
* 1. `recovery.requestOtp({ email })` → manda el OTP por SES.
|
|
433
|
+
* 2. `recovery.verifyOtp({ email, code })` → devuelve `recoveryJwt`.
|
|
434
|
+
* 3. `recovery.finalize({ email, password, recoveryJwt })` orquesta todo:
|
|
435
|
+
* - GET /fragments/3 con el JWT
|
|
436
|
+
* - Deriva recoveryKey con el password + recoverySalt del backend
|
|
437
|
+
* - Decifra F3
|
|
438
|
+
* - Decifra F2 (vía session key ECDH)
|
|
439
|
+
* - Combina F2+F3 → seed ed25519 reconstruida
|
|
440
|
+
* - Genera new passkey + new Shamir split (F1', F2', F3')
|
|
441
|
+
* - Re-cifra F3' con la misma recoveryKey + nuevo salt
|
|
442
|
+
* - Firma la tx `rotate_signer` localmente
|
|
443
|
+
* - POST /recovery/finalize con todo
|
|
444
|
+
* - Persiste new CredentialRecord local
|
|
445
|
+
* - Zero-iza la seed
|
|
531
446
|
*/
|
|
532
447
|
interface RecoveryNamespace {
|
|
533
|
-
/**
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
448
|
+
/** Pide OTP. Backend rate-limita; el caller debe respetar `cooldownSeconds`. */
|
|
449
|
+
requestOtp(input: {
|
|
450
|
+
email: string;
|
|
451
|
+
}): Promise<{
|
|
452
|
+
cooldownSeconds: number;
|
|
453
|
+
expiresInSeconds: number;
|
|
454
|
+
}>;
|
|
455
|
+
/** Verifica OTP. Devuelve `recoveryJwt` con TTL 5min. */
|
|
456
|
+
verifyOtp(input: {
|
|
457
|
+
email: string;
|
|
458
|
+
code: string;
|
|
459
|
+
}): Promise<{
|
|
460
|
+
recoveryJwt: string;
|
|
461
|
+
expiresAt: number;
|
|
462
|
+
}>;
|
|
537
463
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
464
|
+
* Cierra el flujo de recovery. Tras éxito el `walletAddress` rotó sus
|
|
465
|
+
* signers on-chain y el dispositivo nuevo tiene los fragmentos
|
|
466
|
+
* persistidos. Pasar el password de Cognito en plano (UTF-8).
|
|
467
|
+
*
|
|
468
|
+
* El caller es responsable de zeroizar `cognitoPassword` después.
|
|
541
469
|
*/
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
470
|
+
finalize(input: {
|
|
471
|
+
email: string;
|
|
472
|
+
cognitoPassword: Uint8Array;
|
|
473
|
+
recoveryJwt: string;
|
|
474
|
+
}): Promise<{
|
|
475
|
+
walletAddress: string;
|
|
476
|
+
txHash: string;
|
|
477
|
+
}>;
|
|
545
478
|
}
|
|
546
479
|
interface AcceslyHook {
|
|
547
480
|
readonly auth: AuthNamespace;
|
|
@@ -581,4 +514,4 @@ declare function useAccesly(): AcceslyHook;
|
|
|
581
514
|
*/
|
|
582
515
|
declare const REACT_ADAPTER_VERSION = "0.0.0";
|
|
583
516
|
|
|
584
|
-
export { AcceslyContext, type AcceslyContextValue, type AcceslyHook, AcceslyProvider, type AcceslyProviderProps, type AuthNamespace, type CreateWalletInput, type CreatedWalletInfo, ENVIRONMENT_DEFAULTS, type EnsureWalletResult, type EnvironmentDefaults, type KycNamespace, NotImplementedYetError, REACT_ADAPTER_VERSION, type
|
|
517
|
+
export { AcceslyContext, type AcceslyContextValue, type AcceslyHook, AcceslyProvider, type AcceslyProviderProps, type AuthNamespace, type CreateWalletInput, type CreatedWalletInfo, ENVIRONMENT_DEFAULTS, type EnsureWalletResult, type EnvironmentDefaults, type KycNamespace, NotImplementedYetError, REACT_ADAPTER_VERSION, type RecoveryNamespace, type RemoteWalletInfo, type RetryDeployResult, type SendXlmInput, type SendXlmResult, type SessionNamespace, type SettingsNamespace, type TxNamespace, type WalletNamespace, type WalletStatus, type YieldNamespace, useAccesly };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,60 +1,7 @@
|
|
|
1
|
-
import { Environment, CognitoConfig, AuthClient, SessionStorage,
|
|
1
|
+
import { Environment, CognitoConfig, AuthClient, SessionStorage, DeviceStore, TelemetrySink, TokenManager, AccesslyEndpoints, AuthStatus, CredentialRecord } from '@accesly/core';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Structural type for the optional ZK email prover. Defined here (not
|
|
7
|
-
* imported from `@accesly/zkemail`) so this package stays
|
|
8
|
-
* runtime-independent of zkemail. Apps that wire recovery pass an
|
|
9
|
-
* `@accesly/zkemail` `ZkEmailProver` instance — its public shape is a
|
|
10
|
-
* superset of this.
|
|
11
|
-
*/
|
|
12
|
-
interface ZkEmailProverHandle {
|
|
13
|
-
prove(args: {
|
|
14
|
-
readonly eml: string;
|
|
15
|
-
readonly recovery: {
|
|
16
|
-
readonly recipientEmail: string;
|
|
17
|
-
readonly walletAddress: string;
|
|
18
|
-
readonly newPasskeyPubkey: Uint8Array;
|
|
19
|
-
readonly domainSalt: Uint8Array;
|
|
20
|
-
};
|
|
21
|
-
readonly rsaModulus: bigint;
|
|
22
|
-
}): Promise<{
|
|
23
|
-
readonly bundle: {
|
|
24
|
-
readonly proof: {
|
|
25
|
-
readonly a: Uint8Array;
|
|
26
|
-
readonly b: Uint8Array;
|
|
27
|
-
readonly c: Uint8Array;
|
|
28
|
-
};
|
|
29
|
-
readonly publicSignals: readonly Uint8Array[];
|
|
30
|
-
};
|
|
31
|
-
readonly elapsedMs: number;
|
|
32
|
-
}>;
|
|
33
|
-
}
|
|
34
|
-
interface AcceslyContextValue {
|
|
35
|
-
readonly appId: string;
|
|
36
|
-
readonly env: Environment;
|
|
37
|
-
readonly apiUrl: string;
|
|
38
|
-
readonly cognitoConfig: CognitoConfig;
|
|
39
|
-
readonly authClient: AuthClient;
|
|
40
|
-
readonly sessionStorage: SessionStorage;
|
|
41
|
-
readonly tokenManager: TokenManager;
|
|
42
|
-
readonly endpoints: AccesslyEndpoints;
|
|
43
|
-
readonly deviceStore: DeviceStore;
|
|
44
|
-
/** Current auth status — re-rendered whenever it changes. */
|
|
45
|
-
readonly status: AuthStatus;
|
|
46
|
-
readonly username: string | null;
|
|
47
|
-
/** Force a re-read of `tokenManager.getStatus()`. */
|
|
48
|
-
readonly refreshStatus: () => Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Optional ZK email prover for SEP-30 recovery. When omitted,
|
|
51
|
-
* `auth.recover()` throws `RecoveryNotAvailableError`. Apps that need
|
|
52
|
-
* recovery wire it via `<AcceslyProvider zkEmailProver={...}>`.
|
|
53
|
-
*/
|
|
54
|
-
readonly zkEmailProver?: ZkEmailProverHandle;
|
|
55
|
-
}
|
|
56
|
-
declare const AcceslyContext: react.Context<AcceslyContextValue | null>;
|
|
57
|
-
|
|
58
5
|
/**
|
|
59
6
|
* `AcceslyProvider` — top-level React provider that creates the SDK instances
|
|
60
7
|
* once and exposes them through context. All hooks consume this.
|
|
@@ -84,15 +31,27 @@ interface AcceslyProviderProps {
|
|
|
84
31
|
};
|
|
85
32
|
/** Optional telemetry sink — surfaces every API request/response/retry. */
|
|
86
33
|
readonly telemetry?: TelemetrySink;
|
|
87
|
-
/**
|
|
88
|
-
* Optional ZK email prover for SEP-30 recovery. Pass an instance from
|
|
89
|
-
* `@accesly/zkemail` (`createZkEmailProver({ artifactsBaseUrl })`). When
|
|
90
|
-
* omitted, `auth.recover()` throws `RecoveryNotAvailableError`.
|
|
91
|
-
*/
|
|
92
|
-
readonly zkEmailProver?: ZkEmailProverHandle;
|
|
93
34
|
}
|
|
94
35
|
declare function AcceslyProvider(props: AcceslyProviderProps): JSX.Element;
|
|
95
36
|
|
|
37
|
+
interface AcceslyContextValue {
|
|
38
|
+
readonly appId: string;
|
|
39
|
+
readonly env: Environment;
|
|
40
|
+
readonly apiUrl: string;
|
|
41
|
+
readonly cognitoConfig: CognitoConfig;
|
|
42
|
+
readonly authClient: AuthClient;
|
|
43
|
+
readonly sessionStorage: SessionStorage;
|
|
44
|
+
readonly tokenManager: TokenManager;
|
|
45
|
+
readonly endpoints: AccesslyEndpoints;
|
|
46
|
+
readonly deviceStore: DeviceStore;
|
|
47
|
+
/** Current auth status — re-rendered whenever it changes. */
|
|
48
|
+
readonly status: AuthStatus;
|
|
49
|
+
readonly username: string | null;
|
|
50
|
+
/** Force a re-read of `tokenManager.getStatus()`. */
|
|
51
|
+
readonly refreshStatus: () => Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
declare const AcceslyContext: react.Context<AcceslyContextValue | null>;
|
|
54
|
+
|
|
96
55
|
/**
|
|
97
56
|
* Per-environment defaults — currently the only public stage is `dev`. The
|
|
98
57
|
* others are placeholders so the SDK API doesn't change when `staging`/`prod`
|
|
@@ -136,58 +95,6 @@ declare const ENVIRONMENT_DEFAULTS: Record<Environment, EnvironmentDefaults>;
|
|
|
136
95
|
* `auth` don't bring `wallet` into their render.
|
|
137
96
|
*/
|
|
138
97
|
|
|
139
|
-
/**
|
|
140
|
-
* Structural type of `@accesly/zkemail`'s `ZkEmailProver`. Defined here so
|
|
141
|
-
* `@accesly/react` does not take a hard runtime dep on `@accesly/zkemail`.
|
|
142
|
-
* Consumers who use recovery wire in a real prover via `<AcceslyProvider>`.
|
|
143
|
-
*/
|
|
144
|
-
interface ZkEmailProverLike {
|
|
145
|
-
prove(args: {
|
|
146
|
-
readonly eml: string;
|
|
147
|
-
readonly recovery: {
|
|
148
|
-
readonly recipientEmail: string;
|
|
149
|
-
readonly walletAddress: string;
|
|
150
|
-
readonly newPasskeyPubkey: Uint8Array;
|
|
151
|
-
readonly domainSalt: Uint8Array;
|
|
152
|
-
};
|
|
153
|
-
readonly rsaModulus: bigint;
|
|
154
|
-
}): Promise<{
|
|
155
|
-
readonly bundle: {
|
|
156
|
-
readonly proof: {
|
|
157
|
-
readonly a: Uint8Array;
|
|
158
|
-
readonly b: Uint8Array;
|
|
159
|
-
readonly c: Uint8Array;
|
|
160
|
-
};
|
|
161
|
-
readonly publicSignals: readonly Uint8Array[];
|
|
162
|
-
};
|
|
163
|
-
readonly elapsedMs: number;
|
|
164
|
-
}>;
|
|
165
|
-
}
|
|
166
|
-
/** Input to `auth.recover()` once a `ZkEmailProver` is configured. */
|
|
167
|
-
interface RecoverInput {
|
|
168
|
-
/** Raw .eml as downloaded by the user from Gmail's "Show original". */
|
|
169
|
-
readonly eml: string;
|
|
170
|
-
/** Lowercase, trimmed recipient address that received the DKIM-signed message. */
|
|
171
|
-
readonly recipientEmail: string;
|
|
172
|
-
/** Wallet address being recovered (G... strkey). */
|
|
173
|
-
readonly walletAddress: string;
|
|
174
|
-
/** New passkey public key (secp256r1, 64 bytes) that will replace the lost one. */
|
|
175
|
-
readonly newPasskeyPubkey: Uint8Array;
|
|
176
|
-
/** Domain salt from the deployed Smart Account, per D1.4. 32 bytes. */
|
|
177
|
-
readonly domainSalt: Uint8Array;
|
|
178
|
-
/** RSA-2048 modulus of the DKIM key that signed the .eml. */
|
|
179
|
-
readonly rsaModulus: bigint;
|
|
180
|
-
}
|
|
181
|
-
/** Output of a successful recovery proof build. The backend Lambda (Phase 6) submits this. */
|
|
182
|
-
interface RecoverResult {
|
|
183
|
-
readonly proof: {
|
|
184
|
-
readonly a: Uint8Array;
|
|
185
|
-
readonly b: Uint8Array;
|
|
186
|
-
readonly c: Uint8Array;
|
|
187
|
-
};
|
|
188
|
-
readonly publicSignals: readonly Uint8Array[];
|
|
189
|
-
readonly elapsedMs: number;
|
|
190
|
-
}
|
|
191
98
|
interface AuthNamespace {
|
|
192
99
|
readonly status: AuthStatus;
|
|
193
100
|
readonly username: string | null;
|
|
@@ -199,24 +106,6 @@ interface AuthNamespace {
|
|
|
199
106
|
resendConfirmation(email: string): Promise<void>;
|
|
200
107
|
signIn(email: string, password: string): Promise<void>;
|
|
201
108
|
signOut(): Promise<void>;
|
|
202
|
-
/**
|
|
203
|
-
* SEP-30 account recovery via ZK email proof. Generates a Groth16 proof
|
|
204
|
-
* client-side that the deployed Soroban verifier accepts. Throws
|
|
205
|
-
* `RecoveryNotAvailableError` if no `zkEmailProver` was configured on
|
|
206
|
-
* the `<AcceslyProvider>`.
|
|
207
|
-
*
|
|
208
|
-
* The returned `RecoverResult` is ready for the Phase 6 `sep30Handler`
|
|
209
|
-
* Lambda, which submits the rotation tx to Soroban on the user's behalf.
|
|
210
|
-
*/
|
|
211
|
-
recover(input: RecoverInput): Promise<RecoverResult>;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Thrown by `auth.recover()` when the app did not configure a `zkEmailProver`
|
|
215
|
-
* on the `<AcceslyProvider>`. To enable recovery, install `@accesly/zkemail`
|
|
216
|
-
* and pass `<AcceslyProvider zkEmailProver={prover}>`.
|
|
217
|
-
*/
|
|
218
|
-
declare class RecoveryNotAvailableError extends Error {
|
|
219
|
-
constructor();
|
|
220
109
|
}
|
|
221
110
|
interface CreateWalletInput {
|
|
222
111
|
readonly email: string;
|
|
@@ -238,6 +127,22 @@ interface CreateWalletInput {
|
|
|
238
127
|
readonly credentialId?: Uint8Array;
|
|
239
128
|
/** Optional. See `credentialId`. */
|
|
240
129
|
readonly prfSalt?: Uint8Array;
|
|
130
|
+
/**
|
|
131
|
+
* Password de Cognito en plano (`Uint8Array` codificado UTF-8).
|
|
132
|
+
*
|
|
133
|
+
* Recovery v2 (Fase 1, 2026-06-15): si se provee, el SDK deriva
|
|
134
|
+
* `recoveryKey = PBKDF2(password, recoverySalt, 600k)` y la usa para
|
|
135
|
+
* cifrar F3 antes de enviarlo al backend, en vez de usar
|
|
136
|
+
* `encryptionKeys[2]`. El backend almacena F3 cifrado con esa key —
|
|
137
|
+
* SOLO descifrable client-side con el mismo password.
|
|
138
|
+
*
|
|
139
|
+
* Sin esta prop el wallet se crea pero NO podrá recuperarse vía OTP
|
|
140
|
+
* (F3 quedará cifrado con `encryptionKeys[2]`, igual que en 0.x).
|
|
141
|
+
*
|
|
142
|
+
* El caller es responsable de zeroizar este buffer tras `createWallet`
|
|
143
|
+
* (el SDK no lo retiene en memoria).
|
|
144
|
+
*/
|
|
145
|
+
readonly cognitoPassword?: Uint8Array;
|
|
241
146
|
}
|
|
242
147
|
interface CreatedWalletInfo {
|
|
243
148
|
readonly walletAddress: string;
|
|
@@ -521,27 +426,55 @@ declare class NotImplementedYetError extends Error {
|
|
|
521
426
|
constructor(namespace: string, method: string);
|
|
522
427
|
}
|
|
523
428
|
/**
|
|
524
|
-
*
|
|
525
|
-
* endpoints exposed by the Phase 6 `sep30Handler` Lambda. These are SEP-30
|
|
526
|
-
* standard — interoperable with Freighter/Lobstr/etc. — and stateful from the
|
|
527
|
-
* backend's perspective (persists identities + signers in DynamoDB).
|
|
429
|
+
* Recovery v2 — OTP por email + password de Cognito (Fase 1, 2026-06-15).
|
|
528
430
|
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
431
|
+
* Flujo desde la UI:
|
|
432
|
+
* 1. `recovery.requestOtp({ email })` → manda el OTP por SES.
|
|
433
|
+
* 2. `recovery.verifyOtp({ email, code })` → devuelve `recoveryJwt`.
|
|
434
|
+
* 3. `recovery.finalize({ email, password, recoveryJwt })` orquesta todo:
|
|
435
|
+
* - GET /fragments/3 con el JWT
|
|
436
|
+
* - Deriva recoveryKey con el password + recoverySalt del backend
|
|
437
|
+
* - Decifra F3
|
|
438
|
+
* - Decifra F2 (vía session key ECDH)
|
|
439
|
+
* - Combina F2+F3 → seed ed25519 reconstruida
|
|
440
|
+
* - Genera new passkey + new Shamir split (F1', F2', F3')
|
|
441
|
+
* - Re-cifra F3' con la misma recoveryKey + nuevo salt
|
|
442
|
+
* - Firma la tx `rotate_signer` localmente
|
|
443
|
+
* - POST /recovery/finalize con todo
|
|
444
|
+
* - Persiste new CredentialRecord local
|
|
445
|
+
* - Zero-iza la seed
|
|
531
446
|
*/
|
|
532
447
|
interface RecoveryNamespace {
|
|
533
|
-
/**
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
448
|
+
/** Pide OTP. Backend rate-limita; el caller debe respetar `cooldownSeconds`. */
|
|
449
|
+
requestOtp(input: {
|
|
450
|
+
email: string;
|
|
451
|
+
}): Promise<{
|
|
452
|
+
cooldownSeconds: number;
|
|
453
|
+
expiresInSeconds: number;
|
|
454
|
+
}>;
|
|
455
|
+
/** Verifica OTP. Devuelve `recoveryJwt` con TTL 5min. */
|
|
456
|
+
verifyOtp(input: {
|
|
457
|
+
email: string;
|
|
458
|
+
code: string;
|
|
459
|
+
}): Promise<{
|
|
460
|
+
recoveryJwt: string;
|
|
461
|
+
expiresAt: number;
|
|
462
|
+
}>;
|
|
537
463
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
464
|
+
* Cierra el flujo de recovery. Tras éxito el `walletAddress` rotó sus
|
|
465
|
+
* signers on-chain y el dispositivo nuevo tiene los fragmentos
|
|
466
|
+
* persistidos. Pasar el password de Cognito en plano (UTF-8).
|
|
467
|
+
*
|
|
468
|
+
* El caller es responsable de zeroizar `cognitoPassword` después.
|
|
541
469
|
*/
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
470
|
+
finalize(input: {
|
|
471
|
+
email: string;
|
|
472
|
+
cognitoPassword: Uint8Array;
|
|
473
|
+
recoveryJwt: string;
|
|
474
|
+
}): Promise<{
|
|
475
|
+
walletAddress: string;
|
|
476
|
+
txHash: string;
|
|
477
|
+
}>;
|
|
545
478
|
}
|
|
546
479
|
interface AcceslyHook {
|
|
547
480
|
readonly auth: AuthNamespace;
|
|
@@ -581,4 +514,4 @@ declare function useAccesly(): AcceslyHook;
|
|
|
581
514
|
*/
|
|
582
515
|
declare const REACT_ADAPTER_VERSION = "0.0.0";
|
|
583
516
|
|
|
584
|
-
export { AcceslyContext, type AcceslyContextValue, type AcceslyHook, AcceslyProvider, type AcceslyProviderProps, type AuthNamespace, type CreateWalletInput, type CreatedWalletInfo, ENVIRONMENT_DEFAULTS, type EnsureWalletResult, type EnvironmentDefaults, type KycNamespace, NotImplementedYetError, REACT_ADAPTER_VERSION, type
|
|
517
|
+
export { AcceslyContext, type AcceslyContextValue, type AcceslyHook, AcceslyProvider, type AcceslyProviderProps, type AuthNamespace, type CreateWalletInput, type CreatedWalletInfo, ENVIRONMENT_DEFAULTS, type EnsureWalletResult, type EnvironmentDefaults, type KycNamespace, NotImplementedYetError, REACT_ADAPTER_VERSION, type RecoveryNamespace, type RemoteWalletInfo, type RetryDeployResult, type SendXlmInput, type SendXlmResult, type SessionNamespace, type SettingsNamespace, type TxNamespace, type WalletNamespace, type WalletStatus, type YieldNamespace, useAccesly };
|