File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ < page title ="Auth State " layout ="/_layout.html ">
2+
3+ < template type ="docs-page ">
4+
5+ ## Auth State
6+
7+ Snowball provides a state object to observe and interact with the current auth state of the user.
8+ This allows your application to easily determine whether or not the user is authenticated, as well as indications of loading and error states.
9+
10+ ```js
11+ import { Snowball, SnowballChain } from '@snowballtools/js-sdk';
12+
13+ const snowball = Snowball
14+ .withAuth({
15+ google: ...,
16+ })
17+ .create({
18+ apiKey: 'your-snowball-api-key',
19+ initialChain: SnowballChain.sepolia,
20+ })
21+
22+
23+ ```
24+
25+ Once you have this instance, you have access to several functions that will be useful for integrating Snowball into your application.
26+
27+ ## `snowball.chain`
28+
29+ Gets an instance of a SnowballChain, which represents the current chain that the user is interacting with.
30+
31+ ```js
32+ const chain = snowball.chain
33+ ```
34+
35+ ## `snowball.auth`
36+
37+ Gets a mapping of the auth providers that are currently enabled.
38+
39+ For example, if you defined `google: ...` in the `withAuth` function, you can access the Google auth provider like so:
40+
41+ ```js
42+ const google = snowball.auth.google
43+ ```
44+
45+ This value will be typed to the specific auth provider that you defined in the `withAuth` function.
46+
47+ </ template >
Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ export const outline = [
3737 breadcrumbs : [ 'General Usage' ] ,
3838 meta : { title : 'Using the Snowball JS SDK' } ,
3939 } ,
40+ {
41+ id : 'core/auth-state' ,
42+ href : '/docs/core/auth-state' ,
43+ title : 'General Auth State' ,
44+ breadcrumbs : [ 'General Auth State' ] ,
45+ meta : { title : 'General Auth State in the Snowball JS SDK' } ,
46+ } ,
4047 {
4148 id : 'core/react' ,
4249 href : '/docs/core/react' ,
@@ -110,6 +117,13 @@ export const outline = [
110117 breadcrumbs : [ 'Google Auth' ] ,
111118 meta : { title : 'Using Google with Snowball\'s Lit Wallet Auth' } ,
112119 } ,
120+ {
121+ id : 'auth-lit/passkeys' ,
122+ href : '/docs/auth-lit/passkeys' ,
123+ title : 'Passkey Auth' ,
124+ breadcrumbs : [ 'Passkey Auth' ] ,
125+ meta : { title : 'Using Passkeys with Snowball\'s Lit Wallet Auth' } ,
126+ } ,
113127 ] ,
114128 } ,
115129 {
You can’t perform that action at this time.
0 commit comments