@fluent.xyz/connect 0.4.2 → 0.5.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/INTEGRATION.md +255 -96
- package/README.md +82 -22
- package/dist/fluent-connect.css +1 -1
- package/dist/index.d.ts +316 -62
- package/dist/index.js +1444 -1091
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,6 @@ export function App() {
|
|
|
51
51
|
privyClientId: "client-<issued by Fluent>",
|
|
52
52
|
network: resolveFluentWidgetNetworkFromEnv() ?? "testnet",
|
|
53
53
|
appName: "My App",
|
|
54
|
-
authMode: "direct",
|
|
55
54
|
}}
|
|
56
55
|
mode="page"
|
|
57
56
|
renderPage={({ session, openConnect, widget }) => (
|
|
@@ -69,7 +68,7 @@ App's identity — sponsorship, auth and analytics speak it — and must be the
|
|
|
69
68
|
value the Fluent Dashboard shows; the widget throws on any other shape. `privyClientId` is
|
|
70
69
|
login configuration: the Privy app client carrying your allowed origins.
|
|
71
70
|
|
|
72
|
-
For Capacitor social login,
|
|
71
|
+
For Capacitor social login, pass
|
|
73
72
|
`customOAuthRedirectUrl: "https://app.example.com/auth/ios/callback"` in `config`.
|
|
74
73
|
This forwards an HTTPS Universal Link callback to Privy; the host must configure
|
|
75
74
|
the dashboard allowlists, iOS Associated Domains, and callback handling.
|
|
@@ -79,36 +78,36 @@ See [Capacitor OAuth setup](https://github.com/fluentlabs-xyz/fluent-connect-sdk
|
|
|
79
78
|
> from `partner_…` to `app_…`; passing `partnerId` throws with the same hint. Migrating from
|
|
80
79
|
> `clientId`? That option is gone: the value it held is now `privyClientId`.
|
|
81
80
|
|
|
82
|
-
###
|
|
81
|
+
### Logging in
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
`
|
|
90
|
-
|
|
91
|
-
(deprecated) opens the Fluent authorize popup and needs no origin allow-listing; a Fluent ID
|
|
92
|
-
signed in that way has its Privy session on the authorize page rather than in yours, so
|
|
93
|
-
`signMessage`, `signTypedData` and `linkX()` reject there with `hosted_not_supported`, and so
|
|
94
|
-
does `getAuthToken()` for a Fluent ID.
|
|
83
|
+
Clicking Connect opens Fluent's own sign-in dialog inside your page — Direct login, the one
|
|
84
|
+
way to log in to a Fluent ID. It mounts Privy on your origin, so that origin has to be
|
|
85
|
+
registered on the Privy app client behind your `privyClientId`; Privy answers an unregistered
|
|
86
|
+
origin with a silent no-op on the login button. Fluent registers the origins you give it when
|
|
87
|
+
it issues the client. The user's Privy session then lives in your page, which is what lets
|
|
88
|
+
`signMessage`, `signTypedData`, `getAuthToken()` and `linkX()` answer for a Fluent ID without
|
|
89
|
+
leaving it. External wallets connect through Reown AppKit beside it.
|
|
95
90
|
|
|
96
91
|
### Authenticating your backend
|
|
97
92
|
|
|
98
93
|
`getAuthToken()` (render context / `useFluentWidget()`) returns a 5-minute ES256 JWT signed by
|
|
99
94
|
Fluent Connect. Send it to your backend once and issue your own session; verify it with the keys
|
|
100
|
-
at `<iss>/.well-known/jwks.json`
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
at `<iss>/.well-known/jwks.json` and check `iss`, `aud` (your `appId`) and `exp`. The issuer is
|
|
96
|
+
per network, and no single rule derives it from the API host: on `testnet` it is
|
|
97
|
+
`https://api.fluent-connect.dev.gblend.xyz`, on `mainnet` `https://api.fluent.xyz/connect`, whose
|
|
98
|
+
key set is `https://api.fluent.xyz/connect/.well-known/jwks.json`. Pin the issuer of the network
|
|
99
|
+
your widget runs on — [`INTEGRATION.md` §8b](INTEGRATION.md#8b-verify-the-token-on-your-backend).
|
|
100
|
+
`sub` is stable per user per app. `addresses` is present only when your app has the `addresses`
|
|
101
|
+
scope. A Fluent ID and an external wallet both get a token —
|
|
102
|
+
for a wallet, an EOA or a deployed contract wallet signs in; a counterfactual smart account
|
|
105
103
|
cannot (no ERC-6492).
|
|
106
104
|
The token renews itself silently for both account types — against a service that issues the
|
|
107
105
|
refresh credential this release expects, an external wallet signs once, when the session opens,
|
|
108
106
|
not once per token; against a deployment that answers without one there is nothing to renew from,
|
|
109
107
|
and every expired token costs another signature. The session and what holding it costs are in
|
|
110
|
-
[`INTEGRATION.md` §8](INTEGRATION.md#8-auth-
|
|
111
|
-
|
|
108
|
+
[`INTEGRATION.md` §8](INTEGRATION.md#8-auth-and-the-fluent-token). See
|
|
109
|
+
[`apps/auth-demo`](https://github.com/fluentlabs-xyz/fluent-connect-sdk/tree/main/apps/auth-demo)
|
|
110
|
+
for a browser-side verifier.
|
|
112
111
|
|
|
113
112
|
Brand images (logo, wallet icons) ship inside the package as bundled data URLs — you do not need a `/fluent-assets` folder.
|
|
114
113
|
|
|
@@ -125,7 +124,6 @@ By default the connect control floats top-right (`connectButton="fixed"`). To pl
|
|
|
125
124
|
privyClientId: "client-…",
|
|
126
125
|
network: "testnet",
|
|
127
126
|
appName: "My App",
|
|
128
|
-
authMode: "direct",
|
|
129
127
|
}}
|
|
130
128
|
mode="page"
|
|
131
129
|
renderPage={({ openConnect, openAccount, hasConnectedAccount }) => (
|
|
@@ -237,6 +235,29 @@ Headroom increases the maximum gas budget and does not guarantee execution if
|
|
|
237
235
|
state changes. An included outer transaction can still contain a failed
|
|
238
236
|
UserOperation; the widget continues to reject that failed execution.
|
|
239
237
|
|
|
238
|
+
For a batch with known gas budgets, opt out of SDK gas estimation explicitly:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
await widget.createBatchOp({ calls }).execute({
|
|
242
|
+
userOperationGas: {
|
|
243
|
+
skipEstimation: true,
|
|
244
|
+
callGasLimit: 600_000n,
|
|
245
|
+
verificationGasLimit: 500_000n,
|
|
246
|
+
preVerificationGas: 100_000n,
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
This skips the account gas hook and `eth_estimateUserOperationGas`. Supply budgets
|
|
252
|
+
for the complete batch and account deployment; the example values are
|
|
253
|
+
illustrative. Omit both paymaster limits to use the provider's authorized limits
|
|
254
|
+
and calldata overhead up to `preVerificationGas`, without SDK gas estimation.
|
|
255
|
+
Supply both limits to require an exact match for every gas field, as in 0.5.0.
|
|
256
|
+
The default is `skipEstimation: false`; a fixed `callGasLimit` alone
|
|
257
|
+
still allows other gas fields to be estimated. See
|
|
258
|
+
[`INTEGRATION.md` §7](INTEGRATION.md#skipping-useroperation-gas-estimation) for validation,
|
|
259
|
+
authorization and remaining network requests.
|
|
260
|
+
|
|
240
261
|
## Styles
|
|
241
262
|
|
|
242
263
|
Import the package CSS once in your app entry:
|
|
@@ -245,6 +266,45 @@ Import the package CSS once in your app entry:
|
|
|
245
266
|
import "@fluent.xyz/connect/styles.css";
|
|
246
267
|
```
|
|
247
268
|
|
|
269
|
+
## Upgrading from 0.4
|
|
270
|
+
|
|
271
|
+
0.5.0 removes hosted mode. Direct login — Fluent's sign-in dialog inside your page — is the one
|
|
272
|
+
way to log in to a Fluent ID.
|
|
273
|
+
|
|
274
|
+
- **`authMode` is removed from `FluentWidgetConfig`.** Delete the key. A config that passed
|
|
275
|
+
`authMode: "direct"` keeps exactly the behaviour it had; the widget accepts the key one last
|
|
276
|
+
time, ignores it and warns once. `authMode: "hosted"` throws at startup with this note's
|
|
277
|
+
instructions.
|
|
278
|
+
- **A config that omitted `authMode` was on hosted mode** — it was the 0.4.x default — and is
|
|
279
|
+
now on Direct login. Direct login mounts Privy on your page, so your App's origin has to be
|
|
280
|
+
registered on the Privy app client behind your `privyClientId`. Ask Fluent to add it before
|
|
281
|
+
you upgrade, or your users meet a login button that silently does nothing.
|
|
282
|
+
- **`fluent.initialize().connect()` and `.buildAuthorizeUrl()` are removed**, together with
|
|
283
|
+
`authorizeUrl` and `redirectUri` on `fluent.initialize()`. There is no authorize popup to
|
|
284
|
+
open. `initialize`, `status()`, `setSession()` and `disconnect()` are unchanged.
|
|
285
|
+
- **The `hosted_not_supported` error code is gone** from `FluentAuthError` and from `linkX()`:
|
|
286
|
+
nothing refuses a signature, a token or a link for want of an in-page Privy session any more.
|
|
287
|
+
- **A user signed in through hosted mode on 0.4.x signs in again** after your App upgrades.
|
|
288
|
+
Their stored session still shows them as connected and the first signature finds no signer;
|
|
289
|
+
Disconnect, then sign in again, clears it.
|
|
290
|
+
- `FluentWidgetAuthMode` is no longer exported, and `FluentWidgetRenderContext` and
|
|
291
|
+
`FluentIframeRpcExecutor` no longer carry `authMode`.
|
|
292
|
+
|
|
293
|
+
## Native Privy SDK adapter
|
|
294
|
+
|
|
295
|
+
Hosts that use a native Privy SDK can supply `privyAdapter` to `FluentWidget`.
|
|
296
|
+
The adapter implements `FluentPrivyAdapter`: a provider and
|
|
297
|
+
Privy-compatible hooks for authentication, user/identity tokens, embedded wallet
|
|
298
|
+
RPC and the enabled login methods. Fluent Connect continues to derive the same
|
|
299
|
+
ZeroDev account, exchange verified Privy tokens, review operations and apply
|
|
300
|
+
sponsorship policy. Web hosts omit this prop and retain the React SDK.
|
|
301
|
+
|
|
302
|
+
Keep one stable adapter and Provider per SDK runtime. The native provider must
|
|
303
|
+
restore its own session before reporting ready, publish logout and token changes,
|
|
304
|
+
and bind every signature to the connected native wallet. It must keep wallet keys
|
|
305
|
+
in the SDK and implement or disable the login methods exposed by the UI. Passing
|
|
306
|
+
mobile client IDs to the web provider alone does not provide native authentication.
|
|
307
|
+
|
|
248
308
|
## License
|
|
249
309
|
|
|
250
310
|
Apache-2.0
|