@misofm/privy-auth 0.0.0-stage → 0.2.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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -2
  3. package/dist/account.d.ts +22 -0
  4. package/dist/account.js +27 -0
  5. package/dist/address.d.ts +6 -0
  6. package/dist/address.js +9 -0
  7. package/dist/config.d.ts +16 -0
  8. package/dist/config.js +18 -0
  9. package/dist/failure.d.ts +92 -0
  10. package/dist/failure.js +98 -0
  11. package/dist/index.d.ts +10 -0
  12. package/dist/index.js +10 -0
  13. package/dist/oauth.d.ts +15 -0
  14. package/dist/oauth.js +22 -0
  15. package/dist/privy-actions.d.ts +58 -0
  16. package/dist/privy-actions.js +54 -0
  17. package/dist/react.d.ts +9 -0
  18. package/dist/react.js +9 -0
  19. package/dist/server.d.ts +94 -0
  20. package/dist/server.js +196 -0
  21. package/dist/sign-in-flow.d.ts +77 -0
  22. package/dist/sign-in-flow.js +96 -0
  23. package/dist/sign-in.d.ts +66 -0
  24. package/dist/sign-in.js +91 -0
  25. package/dist/signer.d.ts +69 -0
  26. package/dist/signer.js +105 -0
  27. package/dist/token.d.ts +13 -0
  28. package/dist/token.js +29 -0
  29. package/dist/ui/class-name.d.ts +4 -0
  30. package/dist/ui/class-name.js +2 -0
  31. package/dist/ui/code-field.d.ts +31 -0
  32. package/dist/ui/code-field.js +17 -0
  33. package/dist/ui/consent-line.d.ts +24 -0
  34. package/dist/ui/consent-line.js +15 -0
  35. package/dist/ui/email-field.d.ts +39 -0
  36. package/dist/ui/email-field.js +18 -0
  37. package/dist/ui/marks.d.ts +5 -0
  38. package/dist/ui/marks.js +9 -0
  39. package/dist/ui/oauth-button.d.ts +28 -0
  40. package/dist/ui/oauth-button.js +17 -0
  41. package/dist/ui/or-separator.d.ts +12 -0
  42. package/dist/ui/or-separator.js +10 -0
  43. package/dist/ui.d.ts +12 -0
  44. package/dist/ui.js +12 -0
  45. package/package.json +85 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Miso Labs, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,350 @@
1
- # Temporary Holding Version
1
+ # @misofm/privy-auth
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Privy sign-in shared by every Miso product: the account's Privy embedded Sui wallet, identity
4
+ tokens, how to read Privy's failures, Privy's config, identity tokens verified on a server, and
5
+ the sign-in screen's flow (Privy's hooks as Effects, the screen's state machine, unstyled parts).
6
+ Each app keeps its own screen layout, look, flows around sign-in, errors and copy. This package
7
+ holds only what every app does the same way.
8
+
9
+ MIT licensed (`LICENSE`).
10
+
11
+ ## Privy apps
12
+
13
+ Every Miso product (the fan app, Studio and any later one) signs in through
14
+ **one production Privy app**. A person then has one Privy account and one Sui address across all
15
+ products. **"Miso (Testnet)" is for development only.** Each app keeps the two IDs in its own
16
+ build config; this package names neither.
17
+
18
+ - A new product adds its domains to the production app's allowed domains (Privy dashboard) and
19
+ uses this package. Don't create a Privy app per product.
20
+ - The app ID is a parameter the consuming app passes (`PrivyProvider appId`, `verifyIdentityToken`
21
+ `appId`), usually from its build config (`VITE_PRIVY_APP_ID`). The package never hard-codes it.
22
+ - Every origin an app runs on has to be listed in the Privy app's allowed origins, local dev
23
+ servers included. Otherwise Privy answers 403 and its iframe's `frame-ancestors` refuses the page.
24
+
25
+ ## Entries
26
+
27
+ | Import | Loads | For |
28
+ | --- | --- | --- |
29
+ | `@misofm/privy-auth` | `effect` (`Schema`, `Option`); no React, no `@mysten/sui`; Privy as types only | the browser, at boot |
30
+ | `@misofm/privy-auth/signer` | `@mysten/sui` (Ed25519, BLAKE2b, base58) | the browser, lazily on first signature |
31
+ | `@misofm/privy-auth/server` | `effect`, WebCrypto, `fetch` | Cloudflare Workers, Bun, Node 20+ |
32
+ | `@misofm/privy-auth/react` | `effect`, React; `@privy-io/react-auth` for `usePrivyActions` only | the browser, with the sign-in screen (and inside `PrivyProvider`) |
33
+ | `@misofm/privy-auth/ui` | React, ui-sdk (`@ui-sdk/react` 0.1.0-beta.17) for the fields; `OAuthButton`, the marks and `ConsentLine` import no ui-sdk | the browser, the sign-in screen |
34
+
35
+ The package is written in Effect 4 (`effect` is a peer, `>=4.1.2 <4.2`):
36
+
37
+ - Every failure is a `Schema.TaggedError`.
38
+ - Untrusted input is decoded with `Schema`: Privy's errors, linked accounts, identity tokens and
39
+ the JWKS.
40
+ - Absence is `Option`. A check that can fail synchronously is a `Result`.
41
+ - The server is an `Effect` over a `PrivyKeys` service.
42
+ - The sign-in screen's state machine is Effects (state in a `Ref`, actions forked into its scope,
43
+ time from `Clock`); React only renders it. The app runs it with its own runtime (`run`).
44
+
45
+ Plain functions remain only where nothing can fail: `namesWallet`, `oauthReturnPending`,
46
+ `privyConfig`, `isSignedOutRefresh` and `isEmailAddress`.
47
+
48
+ ### `@misofm/privy-auth`
49
+
50
+ | Export | What |
51
+ | --- | --- |
52
+ | `suiWalletAccount(linkedAccounts)` | `Option<{ address, publicKey: Option<string> }>`: the account's Privy embedded Sui wallet in Privy's `user.linkedAccounts`. Matches `type` `wallet`, `chainType` `sui`, and a `walletClientType` that is absent or starts with `privy`. The key stays encoded. |
53
+ | `emailOf(user)` | `Option<string>`: the email Privy verified, from the email login, else Google, else Apple. |
54
+ | `jwtEnd(token)` | `Option<number>`: when a JWT ends (`exp`, ms since the epoch). Unverified. |
55
+ | `namesWallet(token, address)` | Whether an identity token's `linked_accounts` names the Sui wallet at `address` (compared normalized). The API reads the address there, so a token made before the wallet existed is useless. Unverified. |
56
+ | `privyFailure(cause, step)` | Why a sign-in step failed, as one of the errors below. A pure function: nothing is thrown. |
57
+ | `WrongCode`, `CodeNotSent`, `TooManyTries`, `Cancelled`, `MethodDisabled`, `NotAllowed`, `Unreachable`, `Refused` | The failures, each a `Schema.TaggedError` with `code` (Privy's error code, if any) and `cause` (what the step rejected with). |
58
+ | `PrivyFailure` | Their union, as a schema and a type (`Schema.is(PrivyFailure)`). |
59
+ | `PrivyStep` | `'sendCode'`, `'loginWithCode'` or `'login'` (OAuth, an OAuth return, or the `login` event's `onError`). |
60
+ | `isSignedOutRefresh(cause)` | Whether a failed `getIdentityToken` means the sign-in is over: 401, 403, `missing_or_invalid_token` or `must_be_authenticated`. Anything else means Privy is unreachable, and the sign-in may still hold. |
61
+ | `OAuthProvider` | `'google' \| 'apple'`: the providers Miso's apps sign in with. |
62
+ | `PRIVY_OAUTH_PARAMS` | `['privy_oauth_state', 'privy_oauth_code', 'privy_oauth_provider']`: what Privy's OAuth return carries. A router that drops unknown search parameters must keep these. |
63
+ | `oauthReturnPending(url)` | Whether `url` (a URL, an href or a search string) carries all of `PRIVY_OAUTH_PARAMS`, meaning Privy has a Google or Apple return to finish. It loads nothing, so a first screen can show that it's busy. Not a URL: `false`. |
64
+ | `privyConfig({ theme?, accentColor? })` | `PrivyProvider`'s `config`. Login methods: email, Google and Apple. No wallet list, wallet login never first, no external wallets (no WalletConnect, Base or Coinbase), no automatic Ethereum or Solana wallets, no wallet UIs. |
65
+ | `SuiWalletAccount`, `UserEmails`, `PrivyConfigOptions` | Types. |
66
+
67
+ `privyFailure` reads Privy's code first, then HTTP 429, then the step:
68
+
69
+ | Error | When |
70
+ | --- | --- |
71
+ | `WrongCode` | `invalid_credentials` during `loginWithCode`: the code was mistyped, expired or out of tries |
72
+ | `Cancelled` | `oauth_user_denied`: the person declined at Google or Apple |
73
+ | `TooManyTries` | `too_many_requests`, or HTTP 429 |
74
+ | `MethodDisabled` | `disallowed_login_method` |
75
+ | `NotAllowed` | `allowlist_rejected` |
76
+ | `Unreachable` | `client_request_timeout` |
77
+ | `CodeNotSent` | anything else during `sendCode` |
78
+ | `Refused` | anything else |
79
+
80
+ `cause` is what the step's promise rejected with (a Privy error carrying `privyErrorCode` and
81
+ maybe `status`), or the bare code string that `onError` receives. Each app maps these errors onto
82
+ its own (the fan app onto `AuthFailed` reasons, Studio onto `StudioError`s), or uses them directly.
83
+ Errors an app has no word for fall back to the step's own failure.
84
+
85
+ ### `@misofm/privy-auth/signer`
86
+
87
+ | Export | What |
88
+ | --- | --- |
89
+ | `suiWallet(linkedAccounts)` | `Result<Option<SuiWallet>, InvalidSuiWallet>`: the same wallet as `suiWalletAccount`, its key decoded and checked against the address. `None` means no Privy Sui wallet; `Some({ address, publicKey })` means one that can sign (address normalized); `InvalidSuiWallet` means one that can't. It reads synchronously in render. In an Effect, use `yield* Effect.fromResult(suiWallet(accounts))`. |
90
+ | `InvalidSuiWallet` | `Schema.TaggedError`; `reason` is `NoAddress`, `NoPublicKey`, `UnreadablePublicKey` or `NotTheAddressKey`. |
91
+ | `walletPublicKey(encoded)` | `Option<Ed25519PublicKey>`: the key as Privy encodes it, as hex of 32 bytes (with or without `0x`), hex of 33 bytes led by flag `00`, or base58 of 32 bytes. |
92
+ | `PrivySigner` | A `@mysten/sui` `Signer` (the SDK calls it with Promises). Build it with `PrivySigner.of(wallet, signHash)` or `new PrivySigner(publicKey, signHash)`. `sign(digest)` hands `0x`-hex to `signHash` (Privy's `signRawHash`), and rejects with `InvalidSignature` if anything but 64 bytes comes back. `signTransaction` and `signPersonalMessage` work unchanged. |
93
+ | `InvalidSignature` | `Schema.TaggedError` with the `length` Privy answered. |
94
+ | `SuiWallet`, `SignHash` | Types. |
95
+
96
+ ### `@misofm/privy-auth/server`
97
+
98
+ | Export | What |
99
+ | --- | --- |
100
+ | `verifyIdentityToken(token, { appId })` | `Effect<VerifiedIdentity, InvalidIdentityToken \| PrivyKeysUnavailable, PrivyKeys>` (`Effect.fn`, span `verifyIdentityToken`). The time comes from `Clock`. |
101
+ | `VerifiedIdentity` | `{ userId, address, email: Option<string>, expiresAt }` (`expiresAt` in ms since the epoch). |
102
+ | `PrivyKeys` | `Context.Service` with `get(kid: Option<string>) → Effect<Option<CryptoKey>, PrivyKeysUnavailable>` (span `PrivyKeys.get`). Its constructors are below. |
103
+ | `PrivyKeys.makeJwks(appId, { fetch? })` | `Effect<PrivyKeys["Service"]>`: the service itself, for apps that build services as values. Keys from `auth.privy.io/api/v1/apps/<appId>/jwks.json` through `fetch` (the global one by default; any function with its shape). Fetched on first use and kept (`Effect.cachedInvalidateWithTTL`). Fetched again, at most once a minute by `Clock`, when a token names an unknown `kid`. A failed fetch isn't kept. Times out after 5 s (the request aborted). Make it once per isolate and keep it. |
104
+ | `PrivyKeys.layerJwks(appId, { fetch? })` | `Layer<PrivyKeys>`: `makeJwks` as a layer. |
105
+ | `PrivyKeys.fromKey(key)` | `PrivyKeys["Service"]`, synchronously: one imported key (ECDSA P-256, `verify`) for every `kid` (tests, a key the app imported). |
106
+ | `PrivyKeys.makeVerificationKey(key)` | `Effect<PrivyKeys["Service"], PrivyKeysUnavailable>`: one key for every `kid`. `key` is the dashboard's verification key (PEM SPKI, or its bare base64) or an imported `CryptoKey`. A PEM that won't import fails. |
107
+ | `PrivyKeys.layerVerificationKey(key)` | `Layer<PrivyKeys, PrivyKeysUnavailable>`: `makeVerificationKey` as a layer. |
108
+ | `withWallTime(now)` | `(effect) => effect` with `Clock`'s wall time (`currentTimeMillis`, `currentTimeNanos`) read from `now: () => number`, and its monotonic time and `sleep` the ambient `Clock`'s. For an app that keeps its own clock function. Effect builds a `Clock` from a plain object (it has no constructor), and this is that object. |
109
+ | `Fetch`, `JwksOptions` | Types: `(url, { signal }) => Promise<Response>`, and `{ fetch? }`. |
110
+ | `InvalidIdentityToken` | `Schema.TaggedError`; `reason` (`IdentityTokenProblem`, a `Schema.Literals`) is `Malformed`, `WrongIssuer`, `WrongAudience`, `Expired`, `UnknownKey`, `BadSignature` or `NoSuiWallet`. |
111
+ | `PrivyKeysUnavailable` | `Schema.TaggedError` with `cause`: the keys couldn't be read. Try again; the token isn't at fault. |
112
+ | `IdentityTokenProblem` | Schema and type. |
113
+
114
+ The server entry doesn't import `effect/http`: the JWKS comes through a plain `fetch` (wrapped in
115
+ Effect, with typed failures), so a Worker that serves with `HttpServer` alone doesn't carry
116
+ `HttpClient`. A layer built with `FetchHttpClient.layer` provided still works: it no longer needs it.
117
+
118
+ A token is accepted only if all of these hold:
119
+
120
+ - It is a compact JWS with `alg` ES256.
121
+ - Its header and claims decode with `Schema`.
122
+ - It is signed by the key `PrivyKeys` gives for its `kid`.
123
+ - `iss` is `privy.io`.
124
+ - `aud` is `appId`.
125
+ - `exp` hasn't passed by `Clock` (30 s of skew allowed).
126
+ - It has a `sub` (Privy's user ID).
127
+ - Its `linked_accounts` (a JSON string) name a Privy embedded Sui wallet (`wallet_client_type`
128
+ absent, null, or `privy…`).
129
+
130
+ `address` is normalized. `email` is the email login's address, else the Google or Apple login's
131
+ email, and only when it contains `@`.
132
+
133
+ ```ts
134
+ import { Effect } from 'effect';
135
+ import { PrivyKeys, verifyIdentityToken, withWallTime } from '@misofm/privy-auth/server';
136
+
137
+ // Once per isolate (keep the value, so its JWKS cache lasts):
138
+ const keys = yield* PrivyKeys.makeJwks(appId);
139
+ // Per request:
140
+ const who = verifyIdentityToken(bearer, { appId }).pipe(
141
+ Effect.provideService(PrivyKeys, keys),
142
+ withWallTime(Date.now), // only if the app keeps its own clock function; else Clock is Effect's
143
+ Effect.catchTags({ InvalidIdentityToken: () => notSignedIn, PrivyKeysUnavailable: () => tryAgain }),
144
+ );
145
+ // Or as a layer: PrivyKeys.layerJwks(appId). In tests: PrivyKeys.fromKey(publicKey).
146
+ ```
147
+
148
+ ### `@misofm/privy-auth/react`
149
+
150
+ React `>=19` is a peer; `@privy-io/react-auth` `3.52.0` too, for `usePrivyActions` only (a bundler
151
+ that tree-shakes leaves Privy out of a chunk that uses `useSignIn` alone).
152
+
153
+ | Export | What |
154
+ | --- | --- |
155
+ | `usePrivyActions(callbacks?)` | `PrivyActions`: Privy's hooks as one value. Call it once, inside `PrivyProvider`, mounted where Google or Apple return. `callbacks.onComplete(user)` hears every sign-in Privy finishes (an emailed code's, a Google or Apple return, a kept one found on load); `callbacks.onError(failure)` hears Privy's `login` event failing, as a `PrivyFailure`. One sign-in may be reported twice (the email hook and the `login` event): make `onComplete` idempotent. The callbacks are subscribed once and call the latest given. |
156
+ | `PrivyActions` | `{ ready, authenticated, user: Option<User>, identityToken: Option<string> }` and the functions below. One value while nothing in it changes; the functions keep their identity while Privy's do. |
157
+ | `.sendCode(email)` | `Effect<void, PrivyFailure>`: done once Privy has sent the code. |
158
+ | `.loginWithCode(code)` | `Effect<void, PrivyFailure>` (`WrongCode` when Privy refuses the code). The user arrives through `onComplete`, before this succeeds. |
159
+ | `.initOAuth(provider)` | `Effect<void, PrivyFailure>`: done as the page is sent to Google or Apple (same tab). Privy finishes the sign-in where the page comes back. |
160
+ | `.createSuiWallet` | `Effect<User, PrivyCallFailed>`: makes the account's Privy embedded Sui wallet (`createWallet({ chainType: 'sui' })`). |
161
+ | `.refreshIdentityToken` | `Effect<Option<string>, PrivyCallFailed>`: a fresh token (`getIdentityToken`); `None` when no one is signed in. `isSignedOutRefresh(failure.cause)` tells a sign-in that is over. |
162
+ | `.signRawHash(address, hash)` | `Promise<0x…>`: Ed25519 over a 32-byte digest by the wallet at `address`. A Promise, because `PrivySigner` calls it as one: `PrivySigner.of(wallet, (hash) => actions.signRawHash(wallet.address, hash))`. |
163
+ | `.logout` | `Effect<void, PrivyCallFailed>`. |
164
+ | `PrivyCallFailed` | `Schema.TaggedError`: `call` (`createSuiWallet`, `identityToken` or `logout`) and `cause`. |
165
+ | `PrivyActionsCallbacks` | Type of `callbacks`. |
166
+ | `useSignIn(actions, options)` | `SignIn<E>`: the sign-in screen's state machine (below). |
167
+ | `SignInActions<E, R>` | The app's own operations: `{ sendCode(email), signInWithCode(code), signInWith(provider) }`, each an `Effect<void, E, R>`. Route them however the app does (a service, a context). `E` is tagged (`_tag`): the package's `PrivyFailure`s or the app's own errors. A failure tagged `WrongCode` is the code field's. `signInWith` succeeds as the page leaves. |
168
+ | `UseSignInOptions<R>` | `{ run, returning?, isEmail?, onWrongCode? }`. `run` runs the screen's programs and must start them at once (`Effect.runFork`, or the app runtime's `runFork`). `returning`: the provider Privy is finishing a return from (its button busy, every command ignored). `isEmail`: the app's check of an address (by default `isEmailAddress`). `onWrongCode`: Privy refused the code, and the field has been emptied (focus it). |
169
+ | `RunSignIn<R>` | Type of `run`: `(effect: Effect<void, never, R>) => Fiber`. |
170
+ | `CODE_LENGTH`, `RESEND_SECONDS` | `6`, `30`. |
171
+ | `isEmailAddress(email)` | Whether `email` is an address as `<input type="email">` accepts one (the HTML standard's check). |
172
+ | `EmailProblem`, `SignInStep`, `SignInRunning`, `TaggedFailure`, `WrongCodeOf<E>` | Types: `'Missing' \| 'Malformed'`, `'email' \| 'code'`, `'send' \| 'code' \| OAuthProvider`, `{ _tag }`, the `WrongCode` members of `E`. |
173
+
174
+ `SignIn<E>`, for one render:
175
+
176
+ | Field | What |
177
+ | --- | --- |
178
+ | `step` | `'email'` (the email, Google, Apple) or `'code'` (the code sent to it). |
179
+ | `email`, `setEmail(email)` | The email as typed. Typing clears `emailProblem` and a send's failure. |
180
+ | `emailProblem` | `Option<EmailProblem>`: the trimmed email was missing or not an address on `submitEmail`; nothing was sent. Shown until the email changes. |
181
+ | `submitEmail()` | Sends a code to the trimmed email, once it is an address. Then `step` is `'code'` and the resend countdown starts. |
182
+ | `code`, `setCode(code)` | The code as typed. Typing clears a send's or the code's failure. |
183
+ | `submitCode(code?)` | Signs in with `code` (by default the one typed) once it has `codeLength` digits. A `WrongCode` failure empties the code and calls `onWrongCode`. |
184
+ | `codeLength` | `6`. |
185
+ | `resendIn`, `resend()` | Seconds until another code can be sent (`30` after each send, down by `Clock` each second; `0`: now), and sending it. |
186
+ | `differentEmail()` | Back to the email step, the code and the failure cleared, the email kept. |
187
+ | `continueWith(provider)` | Leaves for Google or Apple. Its button stays busy once `signInWith` succeeds, until the page leaves, or comes back from the back/forward cache. |
188
+ | `sending`, `checking` | A code is being sent; the code is being checked. |
189
+ | `provider` | `Option<OAuthProvider>`: the provider whose button is busy (leaving for it, or `returning`). |
190
+ | `busy` | Anything runs, or Privy is finishing a return: every command waits (is ignored). |
191
+ | `codeFailure` | `Option<WrongCodeOf<E>>`: shown by the code field, as its error. |
192
+ | `alert` | `Option<Exclude<E, WrongCode>>`: any other failure, for the screen's alert line. Starting anything clears it. Add the app's own outside failure after it (e.g. an OAuth return that failed: `Option.getOrUndefined(signIn.alert) ?? returnError`). |
193
+
194
+ ### `@misofm/privy-auth/ui`
195
+
196
+ Unstyled parts (ui-sdk `@ui-sdk/react` and `@ui-sdk/core` `0.1.0-beta.17` are peers, exact). Each
197
+ takes `className`, and `classNames` for its inner elements; words are props with defaults. Each app
198
+ lays them out and styles them.
199
+
200
+ | Export | What |
201
+ | --- | --- |
202
+ | `EmailField` | ui-sdk `Field` + `FieldLabel` + `Input` + `FieldError`: an email input (`type`, `name` and `autocomplete` `email`, the email keyboard, no capitals, no spell check). `value`, `onValueChange`; `label` ("Email"); `labelPlacement` `'above'` (default) or `'inside'` (the label after the input inside `classNames.box`, `placeholder=" "`: float it with `peer-[:placeholder-shown]`); `validation` `'flow'` (default: `problem` is `useSignIn`'s `emailProblem`, the form `noValidate`) or `'native'` (`required`; the browser checks, and ui-sdk shows its errors in place of its bubble); `messages` (`missing`: "Enter your email address.", `malformed`: "Enter an email address like name@example.com."); `classNames` `{ root, box, label, input, error }`. Other props go to the input (`disabled`, `readOnly`, `enterKeyHint`…). |
203
+ | `CodeField` | ui-sdk `Field` + `OTPInput`: one native input (`autocomplete="one-time-code"`, numeric, digits only) drawn as `length` (6) slots. `value`, `onValueChange`, `onValueCommit` (every slot filled: pass `submitCode`); `label` ("Code"; hide it with its class); `description` (read with the field); `error` (the field invalid, this its `FieldError`); `controller`; `classNames` `{ root, label, description, input, group, slot, error }`. Other props go to `OTPInput` (`autoFocus`, `readOnly`, `textAlign`…). Slots carry ui-sdk's `data-active`, `data-fake-caret`, `data-disabled`. |
204
+ | `createCodeFieldController()` | A handle to focus a `CodeField` (`onWrongCode: () => controller.focus()`). |
205
+ | `OAuthButton` | A native button: the provider's mark and "Continue with Google" / "Continue with Apple" (`label`). `busy` shows `spinner` in place of the mark (`busyLabel={false}`: in place of everything), sets `aria-busy` and `data-busy`, and disables it. `className` may be a function of `{ busy, disabled }`; `classNames.mark`. `data-provider` names it. Other props go to the button. |
206
+ | `GoogleMark`, `AppleMark` | The official marks, inline SVG (`aria-hidden`): Google's four-colour "G" (20 px), Apple's logo in `currentColor` (18 × 20 px). SVG props override. |
207
+ | `OrSeparator` | "or" (`label`) between two decorative ui-sdk `Separator`s. `className`, `classNames.line`. |
208
+ | `ConsentLine` | "By signing in, you agree to our Terms of Use and acknowledge our Privacy Policy.", each link to miso.fm in a new tab (`rel="noopener noreferrer"`). `className`, `classNames.link`, `copy` (`agree`, `terms`, `acknowledge`, `privacy`). |
209
+ | `TERMS_OF_USE_URL`, `PRIVACY_POLICY_URL` | `https://miso.fm/terms-of-use/`, `https://miso.fm/privacy-policy/`. |
210
+ | `EmailFieldProps`, `EmailMessages`, `CodeFieldProps`, `OAuthButtonProps`, `OAuthButtonState`, `ConsentCopy` | Types. |
211
+
212
+ ## Design: what lives where
213
+
214
+ - **In the package:** facts about Privy that hold for every app. That covers how it lists the Sui
215
+ wallet and encodes its key, the identity token's claims, its error codes, the OAuth return
216
+ parameters, the config that keeps Privy's UI and wallets out, signing a digest as a Sui `Signer`,
217
+ verifying tokens on a server, Privy's hooks and their quirks (`usePrivyActions`), and the
218
+ sign-in screen's behaviour: its steps, what is busy, where each failure shows, the resend wait
219
+ (`useSignIn`), and its unstyled parts (`/ui`).
220
+ - **In each app:** everything about how the app looks and what it does around sign-in. That
221
+ includes the screen's layout, styles and words, the `PrivyProvider` mount and when it loads, the
222
+ flows (wallet creation, refresh, retries, sign-out), how the screen's actions are routed and run,
223
+ the app's own error types and every sentence the person sees, and its API session.
224
+ `privyFailure` returns the package's errors, which each app maps onto its own.
225
+ - **Bundle:** the core never imports `@mysten/sui`, `effect/http` or Privy's runtime, so it can
226
+ sit in an entry chunk next to the app's own `effect`. The fan app keeps the Sui SDK out of its
227
+ entry by importing `@misofm/privy-auth/signer` lazily. `/react` and `/ui` are modules per part
228
+ (`sideEffects: false`): `useSignIn` alone brings no Privy, and `OAuthButton`, the marks and
229
+ `ConsentLine` alone bring no ui-sdk (the fan app's `SignInPending`, in its route tree, uses them).
230
+ - **Promises where the SDK wants them:** `PrivySigner` is a `@mysten/sui` `Signer` whose `sign`
231
+ returns a Promise, because the SDK calls it that way. Its typed failure (`InvalidSignature`) is
232
+ thrown as a tagged error.
233
+
234
+ ## Install
235
+
236
+ ```sh
237
+ npm install --save-exact @misofm/privy-auth
238
+ ```
239
+
240
+ Pin it exactly, as its peers are pinned.
241
+
242
+ Peer dependencies:
243
+
244
+ - `effect` `>=4.1.2 <4.2`, required. Use one copy: the app's own.
245
+ - `@mysten/sui` `2.38.0`, optional; needed for `/signer` only.
246
+ - `@privy-io/react-auth` `3.52.0`, optional; the core's `.d.ts` names `User` and
247
+ `PrivyClientConfig`, and `/react`'s `usePrivyActions` calls its hooks.
248
+ - `react` `>=19`, optional; needed for `/react` and `/ui`.
249
+ - `@ui-sdk/react` and `@ui-sdk/core` `0.1.0-beta.17` (exact), optional; needed for `/ui`'s fields.
250
+
251
+ No runtime dependencies.
252
+
253
+ ## Integrating a new product
254
+
255
+ 1. Add the product's origins (production and dev) to the production Privy app's allowed domains.
256
+ 2. Install `@misofm/privy-auth` (above), `effect` 4.1.x, `react` 19, `@privy-io/react-auth` `3.52.0`
257
+ and `@ui-sdk/react` + `@ui-sdk/core` `0.1.0-beta.17`, plus `@mysten/sui` `2.38.0` if the
258
+ product signs.
259
+ 3. Mount `PrivyProvider` with `appId` from the build config and
260
+ `config={privyConfig({ theme, accentColor })}`. Inside it, call `usePrivyActions` once, where
261
+ Google or Apple return (check with `oauthReturnPending(location.search)`). Never `useLogin`.
262
+ 4. In `onComplete(user)`, read the wallet with `suiWallet(user.linkedAccounts)`. If it succeeds
263
+ with `None`, make it: `actions.createSuiWallet`. Privy doesn't make it for a headless sign-in.
264
+ `InvalidSuiWallet` means the account can't sign: say so and sign out.
265
+ 5. Sign with `PrivySigner.of(wallet, (hash) => actions.signRawHash(wallet.address, hash))`.
266
+ 6. Map the `PrivyFailure`s onto the product's own errors and words, e.g. with
267
+ `Match.tagsExhaustive` or a `switch` on `_tag`. Keep a refused code as a `WrongCode` (the
268
+ package's, or one of the product's with that tag) so the screen puts it on the code field.
269
+ 7. Use `actions.refreshIdentityToken` only once `namesWallet(token, address)` holds, and refresh
270
+ before `jwtEnd(token)`. If it fails and `isSignedOutRefresh(failure.cause)`, the sign-in is over.
271
+ 8. On the server, make `PrivyKeys.makeJwks(appId)` once and run
272
+ `verifyIdentityToken(bearer, { appId })` with it. Map `InvalidIdentityToken` to "not signed
273
+ in" and `PrivyKeysUnavailable` to "try again".
274
+
275
+ ### Building the sign-in screen
276
+
277
+ The screen is the product's own component: its layout, its styles, its words. The flow and the
278
+ parts come from here.
279
+
280
+ ```tsx
281
+ import { Effect, Option } from 'effect';
282
+ import { useState } from 'react';
283
+ import type { WrongCode } from '@misofm/privy-auth';
284
+ import { type PrivyActions, type SignInActions, useSignIn } from '@misofm/privy-auth/react';
285
+ import { CodeField, ConsentLine, createCodeFieldController, EmailField, OAuthButton, OrSeparator } from '@misofm/privy-auth/ui';
286
+
287
+ // The product's own operations (here straight onto usePrivyActions, which a context hands over).
288
+ // Each fails with the product's errors (`MyError`, `toMyError`, `sentenceOf` are the product's),
289
+ // a refused code still the package's `WrongCode`.
290
+ const actionsOf = (privy: PrivyActions): SignInActions<MyError | WrongCode> => ({
291
+ sendCode: (email) => privy.sendCode(email).pipe(Effect.mapError(toMyError)),
292
+ signInWithCode: (code) => privy.loginWithCode(code).pipe(Effect.mapError((e) => (e._tag === 'WrongCode' ? e : toMyError(e)))),
293
+ signInWith: (provider) => privy.initOAuth(provider).pipe(Effect.mapError(toMyError)),
294
+ });
295
+
296
+ function SignIn({ actions }: { actions: SignInActions<MyError | WrongCode> }) {
297
+ const [codeField] = useState(createCodeFieldController);
298
+ const signIn = useSignIn(actions, { run: Effect.runFork, onWrongCode: () => codeField.focus() });
299
+ const alert = Option.getOrUndefined(signIn.alert);
300
+ return (
301
+ <section>
302
+ {alert && <p role="alert">{sentenceOf(alert)}</p>}
303
+ {signIn.step === 'email' ? (
304
+ <>
305
+ <form noValidate onSubmit={(e) => (e.preventDefault(), signIn.submitEmail())}>
306
+ <EmailField value={signIn.email} onValueChange={signIn.setEmail} problem={signIn.emailProblem} readOnly={signIn.sending} classNames={{ input: '…', error: '…' }} />
307
+ <button type="submit" disabled={signIn.busy}>Continue</button>
308
+ </form>
309
+ <OrSeparator className="…" classNames={{ line: '…' }} />
310
+ {(['google', 'apple'] as const).map((provider) => (
311
+ <OAuthButton key={provider} provider={provider} busy={Option.contains(signIn.provider, provider)} disabled={signIn.busy} onClick={() => signIn.continueWith(provider)} spinner={<Spinner />} className="…" />
312
+ ))}
313
+ </>
314
+ ) : (
315
+ <form noValidate onSubmit={(e) => (e.preventDefault(), signIn.submitCode())}>
316
+ <CodeField value={signIn.code} onValueChange={signIn.setCode} onValueCommit={signIn.submitCode} controller={codeField} autoFocus readOnly={signIn.checking}
317
+ description={`Enter the 6-digit code sent to ${signIn.email.trim()}`} error={Option.isSome(signIn.codeFailure) ? 'That code didn’t work.' : undefined} classNames={{ slot: '…' }} />
318
+ <button type="submit" disabled={signIn.busy || signIn.code.length !== signIn.codeLength}>Sign in</button>
319
+ <button type="button" disabled={signIn.busy || signIn.resendIn > 0} onClick={signIn.resend}>
320
+ {signIn.resendIn > 0 ? `Resend code (${signIn.resendIn} s)` : 'Resend code'}
321
+ </button>
322
+ <button type="button" disabled={signIn.busy} onClick={signIn.differentEmail}>Use a different email</button>
323
+ </form>
324
+ )}
325
+ <ConsentLine className="…" classNames={{ link: '…' }} />
326
+ </section>
327
+ );
328
+ }
329
+ ```
330
+
331
+ - `run` is how the product runs Effects: `Effect.runFork` when the actions need nothing, the app
332
+ runtime's `runFork` when they need its services (`SignInActions<E, R>`, `RunSignIn<R>`).
333
+ - Show `alert` in one line above the form and `codeFailure` only through `CodeField`'s `error`
334
+ (ui-sdk announces it; no `role="alert"` on it). A product's own outside failure (an OAuth
335
+ return that failed) goes after `alert`.
336
+ - Back from Google or Apple (`oauthReturnPending`), pass `returning: provider` to keep that
337
+ button busy while Privy finishes, or show a "Signing in…" state in place of the form.
338
+ - The fan app (app-v2, `src/components/auth/sign-in-panel.tsx`) and Studio (studio-v2,
339
+ `src/auth/SignIn.tsx`) are the two references: the label inside the box with the browser's own
340
+ validation, and the label above with the flow's.
341
+
342
+ ## Develop
343
+
344
+ ```sh
345
+ bun install
346
+ bun run test # bun test --coverage
347
+ bun run typecheck # tsc --noEmit, tests included
348
+ bun run build # tsc -p tsconfig.build.json → dist/ (ESM + .d.ts)
349
+ bun run pack # build + dist-pack/misofm-privy-auth.tgz
350
+ ```
@@ -0,0 +1,22 @@
1
+ import type { User } from '@privy-io/react-auth';
2
+ import { Option } from 'effect';
3
+ /** The account's Privy embedded Sui wallet, as Privy lists it (its public key still encoded). */
4
+ export type SuiWalletAccount = {
5
+ /** The wallet's Sui address, as Privy gives it. */
6
+ readonly address: string;
7
+ /** The wallet's Ed25519 public key as Privy encodes it (hex or base58); see `walletPublicKey`. */
8
+ readonly publicKey: Option.Option<string>;
9
+ };
10
+ export declare const findSuiWallet: (linkedAccounts: ReadonlyArray<unknown>) => Option.Option<unknown>;
11
+ export declare const walletFields: (wallet: unknown) => Option.Option<SuiWalletAccount>;
12
+ /**
13
+ * The account's Privy embedded Sui wallet among `linkedAccounts` (Privy's `user.linkedAccounts`),
14
+ * its public key not decoded: what an app needs at boot (the address) without loading
15
+ * `@mysten/sui`. `None` when it has none (or it names no address). To sign, or to check the key
16
+ * against the address, use `suiWallet` from `@misofm/privy-auth/signer`.
17
+ */
18
+ export declare const suiWalletAccount: (linkedAccounts: ReadonlyArray<unknown>) => Option.Option<SuiWalletAccount>;
19
+ /** What `emailOf` reads of a Privy user. */
20
+ export type UserEmails = Pick<User, 'email' | 'google' | 'apple'>;
21
+ /** The email Privy verified for `user`: its email login's, else its Google or Apple login's. */
22
+ export declare const emailOf: (user: UserEmails) => Option.Option<string>;
@@ -0,0 +1,27 @@
1
+ import { Array as Arr, Option, Schema } from 'effect';
2
+ /**
3
+ * A linked account that is a Privy embedded Sui wallet: `type` `wallet`, `chainType` `sui`, a
4
+ * `walletClientType` that is Privy's (`privy…`) or absent.
5
+ */
6
+ const PrivySuiWallet = Schema.Struct({
7
+ type: Schema.Literal('wallet'),
8
+ chainType: Schema.Literal('sui'),
9
+ walletClientType: Schema.optional(Schema.String.check(Schema.isStartingWith('privy'))),
10
+ });
11
+ /** What is read of the wallet: its address and its encoded public key. */
12
+ const WalletFields = Schema.Struct({ address: Schema.String, publicKey: Schema.optional(Schema.String) });
13
+ /** The first Privy embedded Sui wallet among `linkedAccounts`, undecoded (the signer's `suiWallet` reads it too). */
14
+ const isPrivySuiWallet = Schema.is(PrivySuiWallet);
15
+ export const findSuiWallet = (linkedAccounts) => Arr.findFirst(linkedAccounts, (account) => isPrivySuiWallet(account));
16
+ /** The wallet's address and encoded key, if it has an address. */
17
+ const decodeWalletFields = Schema.decodeUnknownOption(WalletFields);
18
+ export const walletFields = (wallet) => Option.map(decodeWalletFields(wallet), ({ address, publicKey }) => ({ address, publicKey: Option.fromUndefinedOr(publicKey) }));
19
+ /**
20
+ * The account's Privy embedded Sui wallet among `linkedAccounts` (Privy's `user.linkedAccounts`),
21
+ * its public key not decoded: what an app needs at boot (the address) without loading
22
+ * `@mysten/sui`. `None` when it has none (or it names no address). To sign, or to check the key
23
+ * against the address, use `suiWallet` from `@misofm/privy-auth/signer`.
24
+ */
25
+ export const suiWalletAccount = (linkedAccounts) => Option.flatMap(findSuiWallet(linkedAccounts), walletFields);
26
+ /** The email Privy verified for `user`: its email login's, else its Google or Apple login's. */
27
+ export const emailOf = (user) => Option.fromNullishOr(user.email?.address ?? user.google?.email ?? user.apple?.email);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A Sui address as the chain reads it (lowercase, `0x`, padded to 64 hex digits), written here so
3
+ * the core never loads `@mysten/sui` (its BCS, BLAKE2 and base58 stay out of an app's entry).
4
+ * The same result as `@mysten/sui/utils`' `normalizeSuiAddress`.
5
+ */
6
+ export declare const normalizeSuiAddress: (value: string) => string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A Sui address as the chain reads it (lowercase, `0x`, padded to 64 hex digits), written here so
3
+ * the core never loads `@mysten/sui` (its BCS, BLAKE2 and base58 stay out of an app's entry).
4
+ * The same result as `@mysten/sui/utils`' `normalizeSuiAddress`.
5
+ */
6
+ export const normalizeSuiAddress = (value) => {
7
+ const address = value.toLowerCase();
8
+ return `0x${(address.startsWith('0x') ? address.slice(2) : address).padStart(64, '0')}`;
9
+ };
@@ -0,0 +1,16 @@
1
+ import type { PrivyClientConfig } from '@privy-io/react-auth';
2
+ type Appearance = NonNullable<PrivyClientConfig['appearance']>;
3
+ /** What an app sets of `privyConfig`: Privy's theme (`light`, `dark` or a hex colour) and accent. */
4
+ export type PrivyConfigOptions = {
5
+ readonly theme?: Appearance['theme'];
6
+ readonly accentColor?: Appearance['accentColor'];
7
+ };
8
+ /**
9
+ * `PrivyProvider`'s `config` for a Miso app: email, Google or Apple only, on the app's own screen
10
+ * (no wallet list, wallet login never first); no external wallets (Privy starts no WalletConnect,
11
+ * Base or Coinbase); no automatic Ethereum or Solana wallets (the app makes the Sui wallet); no
12
+ * wallet UIs, so nothing of Privy's shows when it signs. The theme only matters for anything of
13
+ * Privy's that might still draw.
14
+ */
15
+ export declare const privyConfig: ({ theme, accentColor }?: PrivyConfigOptions) => PrivyClientConfig;
16
+ export {};
package/dist/config.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `PrivyProvider`'s `config` for a Miso app: email, Google or Apple only, on the app's own screen
3
+ * (no wallet list, wallet login never first); no external wallets (Privy starts no WalletConnect,
4
+ * Base or Coinbase); no automatic Ethereum or Solana wallets (the app makes the Sui wallet); no
5
+ * wallet UIs, so nothing of Privy's shows when it signs. The theme only matters for anything of
6
+ * Privy's that might still draw.
7
+ */
8
+ export const privyConfig = ({ theme, accentColor } = {}) => ({
9
+ loginMethods: ['email', 'google', 'apple'],
10
+ appearance: {
11
+ ...(theme === undefined ? {} : { theme }),
12
+ ...(accentColor === undefined ? {} : { accentColor }),
13
+ showWalletLoginFirst: false,
14
+ walletList: [],
15
+ },
16
+ externalWallets: { walletConnect: { enabled: false }, disableAllExternalWallets: true },
17
+ embeddedWallets: { ethereum: { createOnLogin: 'off' }, solana: { createOnLogin: 'off' }, showWalletUIs: false },
18
+ });
@@ -0,0 +1,92 @@
1
+ import { Schema } from 'effect';
2
+ /** The sign-in step that failed: it decides what a failure without a telling code is. */
3
+ export type PrivyStep =
4
+ /** `useLoginWithEmail`'s `sendCode`. */
5
+ 'sendCode'
6
+ /** `useLoginWithEmail`'s `loginWithCode`. */
7
+ | 'loginWithCode'
8
+ /** Any other sign-in: `initOAuth`, an OAuth return, or Privy's `login` event's `onError`. */
9
+ | 'login';
10
+ declare const WrongCode_base: Schema.Class<WrongCode, Schema.TaggedStruct<"WrongCode", {
11
+ code: Schema.optional<Schema.String>;
12
+ cause: Schema.Defect;
13
+ }>, import("effect/Cause").YieldableError>;
14
+ /** `loginWithCode` refused the code (`invalid_credentials`: mistyped, expired, or its tries used). */
15
+ export declare class WrongCode extends WrongCode_base {
16
+ get message(): string;
17
+ }
18
+ declare const CodeNotSent_base: Schema.Class<CodeNotSent, Schema.TaggedStruct<"CodeNotSent", {
19
+ code: Schema.optional<Schema.String>;
20
+ cause: Schema.Defect;
21
+ }>, import("effect/Cause").YieldableError>;
22
+ /** `sendCode` failed without a more telling reason. */
23
+ export declare class CodeNotSent extends CodeNotSent_base {
24
+ get message(): string;
25
+ }
26
+ declare const TooManyTries_base: Schema.Class<TooManyTries, Schema.TaggedStruct<"TooManyTries", {
27
+ code: Schema.optional<Schema.String>;
28
+ cause: Schema.Defect;
29
+ }>, import("effect/Cause").YieldableError>;
30
+ /** Privy asks to wait (`too_many_requests`, or HTTP 429). */
31
+ export declare class TooManyTries extends TooManyTries_base {
32
+ get message(): string;
33
+ }
34
+ declare const Cancelled_base: Schema.Class<Cancelled, Schema.TaggedStruct<"Cancelled", {
35
+ code: Schema.optional<Schema.String>;
36
+ cause: Schema.Defect;
37
+ }>, import("effect/Cause").YieldableError>;
38
+ /** The person declined at Google or Apple (`oauth_user_denied`). */
39
+ export declare class Cancelled extends Cancelled_base {
40
+ get message(): string;
41
+ }
42
+ declare const MethodDisabled_base: Schema.Class<MethodDisabled, Schema.TaggedStruct<"MethodDisabled", {
43
+ code: Schema.optional<Schema.String>;
44
+ cause: Schema.Defect;
45
+ }>, import("effect/Cause").YieldableError>;
46
+ /** The Privy app doesn't allow this login method (`disallowed_login_method`). */
47
+ export declare class MethodDisabled extends MethodDisabled_base {
48
+ get message(): string;
49
+ }
50
+ declare const NotAllowed_base: Schema.Class<NotAllowed, Schema.TaggedStruct<"NotAllowed", {
51
+ code: Schema.optional<Schema.String>;
52
+ cause: Schema.Defect;
53
+ }>, import("effect/Cause").YieldableError>;
54
+ /** The Privy app's allowlist refused the account (`allowlist_rejected`). */
55
+ export declare class NotAllowed extends NotAllowed_base {
56
+ get message(): string;
57
+ }
58
+ declare const Unreachable_base: Schema.Class<Unreachable, Schema.TaggedStruct<"Unreachable", {
59
+ code: Schema.optional<Schema.String>;
60
+ cause: Schema.Defect;
61
+ }>, import("effect/Cause").YieldableError>;
62
+ /** Privy's request timed out (`client_request_timeout`). */
63
+ export declare class Unreachable extends Unreachable_base {
64
+ get message(): string;
65
+ }
66
+ declare const Refused_base: Schema.Class<Refused, Schema.TaggedStruct<"Refused", {
67
+ code: Schema.optional<Schema.String>;
68
+ cause: Schema.Defect;
69
+ }>, import("effect/Cause").YieldableError>;
70
+ /** Privy refused for any other reason. */
71
+ export declare class Refused extends Refused_base {
72
+ get message(): string;
73
+ }
74
+ /** Why a Privy sign-in step failed: one of the errors above. */
75
+ export declare const PrivyFailure: Schema.Union<readonly [typeof WrongCode, typeof CodeNotSent, typeof TooManyTries, typeof Cancelled, typeof MethodDisabled, typeof NotAllowed, typeof Unreachable, typeof Refused]>;
76
+ export type PrivyFailure = typeof PrivyFailure.Type;
77
+ /**
78
+ * What a failed Privy sign-in step means, as one of the `PrivyFailure` errors (a pure function:
79
+ * nothing is thrown or logged). `cause` is what the step's promise rejected with (a Privy error
80
+ * with `privyErrorCode`, maybe `status`) or the code `onError` was given. Privy's code decides
81
+ * first (`invalid_credentials` only for `loginWithCode`), then HTTP 429, then the step: `sendCode`
82
+ * is `CodeNotSent`, the others `Refused`.
83
+ */
84
+ export declare const privyFailure: (cause: unknown, step: PrivyStep) => PrivyFailure;
85
+ /**
86
+ * Whether a failed identity-token refresh (`getIdentityToken`) means the sign-in is over: Privy's
87
+ * API answering 401 or 403, or naming the token invalid (`missing_or_invalid_token`,
88
+ * `must_be_authenticated`). Anything else (no answer, a timeout, a 5xx) is Privy unreachable, and
89
+ * the sign-in may well still hold.
90
+ */
91
+ export declare const isSignedOutRefresh: (cause: unknown) => boolean;
92
+ export {};