@dexterai/connect 0.33.0 → 0.35.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 CHANGED
@@ -62,7 +62,7 @@ returns only the ordinary identity result to the requesting app.
62
62
  These exports need the matching API identity profile and hosted page. Source
63
63
  checks do not establish package publication or production availability.
64
64
 
65
- ## Dexter Account operations (unreleased)
65
+ ## Dexter Account operations
66
66
 
67
67
  An Account session opens and uses a Dexter Account through one approval step.
68
68
  The API prepares one exact operation, the owner approves it with the passkey
@@ -89,6 +89,8 @@ await sendFromAccount({ identity, send: { mint, amount: '2500000', to } });
89
89
  - Once an approval has gone out, the step may land even if the reply never comes. Any failure of `complete` is checked against the API's record of the operation. A confirmed step carries on. A step the API records as failed, still prepared or expired throws its error, and only then has nothing been sent. Anything else throws `AccountOperationUnsettledError`, which carries `operationId`. Don't say nothing was sent, and don't offer the same send again. Read the outcome with `getAccountOperation({ identity, operationId })`. `getAccountOverview` returns `unsettled` after a reload or a new sign-in.
90
90
  - The caller's `signal` stops a flow up to the approval. After that the flow waits for the API's answer, so leaving the page can't turn an unknown outcome into a reported failure.
91
91
  - `statement` is the kit's own text for what the passkey signs, when the API sends it.
92
+ - With lazy opening, sign-up's approvals are checked and held, not sent. Each setup step can be confirmed with `signature: null`, and the Account's status is then `held`: its address takes money at once and it opens on the chain by itself on the first money or the first action. Show a `held` Account exactly like a `ready` one; `openAccount` returns it without prompting. A send is never taken as confirmed without the signature of what it sent.
93
+ - The first action on a held Account finishes the opening inside that request, so it can take a minute. Connect sets no timeout of its own on these requests.
92
94
 
93
95
  ## Interrupted wallet setup
94
96
 
@@ -265,14 +265,7 @@ interface CreateWalletResult {
265
265
  /** Dexter-signed proof used to restore this Wallet's account relationship. */
266
266
  walletIdentityProof: WalletIdentityProof;
267
267
  }
268
- /**
269
- * Mint a brand-new Dexter wallet (passkey + vault). Commit mode (the default)
270
- * makes it active immediately; provisional mode returns it without changing
271
- * the active-wallet store.
272
- *
273
- * One passkey approval. Throws ConnectError on any failed leg (the `code` is the
274
- * server's error string, or webauthn_failed / no_credential for the ceremony).
275
- */
268
+ /** Always rejects with `dexter_wallet_closed`. Use enrollAccountIdentity for new users. */
276
269
  declare function createWallet(config?: CreateWalletConfig): Promise<CreateWalletResult>;
277
270
 
278
271
  declare const ACCOUNT_IDENTITY_API_PATH = "/api/connect/account-identity";
@@ -10,7 +10,7 @@ import {
10
10
  subscribe,
11
11
  walletBindingCandidate,
12
12
  walletProofSessionStore
13
- } from "./chunk-Q7HTBUJF.js";
13
+ } from "./chunk-SGWYN67U.js";
14
14
 
15
15
  // src/relationController.ts
16
16
  function provisionalRelation(walletPresent, accountPresent) {
@@ -533,6 +533,24 @@ function createDexterControlModel(intent, relation) {
533
533
  });
534
534
  }
535
535
 
536
+ // src/policy.ts
537
+ var SESSION_TTL_30D = "2592000";
538
+ function usdToAtomic(input) {
539
+ const cleaned = input.trim().replace(/^\$/, "").replace(/,/g, "");
540
+ if (!/^\d+(\.\d{1,6})?$/.test(cleaned)) return null;
541
+ const [whole, frac = ""] = cleaned.split(".");
542
+ try {
543
+ return BigInt(whole) * 1000000n + BigInt((frac + "000000").slice(0, 6));
544
+ } catch {
545
+ return null;
546
+ }
547
+ }
548
+ function authoredPolicy(usdInput) {
549
+ const atomic = usdToAtomic(usdInput);
550
+ if (atomic === null || atomic <= 0n) return null;
551
+ return { spendLimitAtomic: atomic.toString(), sessionTtlSeconds: SESSION_TTL_30D };
552
+ }
553
+
536
554
  // src/phase.ts
537
555
  var PHASE_LABEL = {
538
556
  challenge: "Preparing\u2026",
@@ -610,6 +628,9 @@ export {
610
628
  connectDexterIdentity,
611
629
  disconnectDexterIdentity,
612
630
  createDexterControlModel,
631
+ SESSION_TTL_30D,
632
+ usdToAtomic,
633
+ authoredPolicy,
613
634
  ceremonyPhaseLabel,
614
635
  passkeySignalSupport,
615
636
  renamePasskey,