@@ -59,22 +59,6 @@ Find more details about Passkey Flex on our [Passkey Flex Documentation](https:/
59
59
60
60
## API Reference
61
61
62
- ### Retrieve App Info
63
-
64
- To retrieve information about the app, use the ` get_app ` method.
65
-
66
- ``` rust
67
- use passage_flex :: PassageFlex ;
68
-
69
- let passage_flex = PassageFlex :: new (
70
- std :: env :: var (" PASSAGE_APP_ID" ). unwrap (),
71
- std :: env :: var (" PASSAGE_API_KEY" ). unwrap (),
72
- );
73
-
74
- let app_info = passage_flex . get_app (). await . unwrap ();
75
- println! (" {}" , app_info . auth_origin);
76
- ```
77
-
78
62
### Create a Registration Transaction
79
63
80
64
To create a transaction to start a user passkey registration, use the ` create_register_transaction ` method.
@@ -92,6 +76,7 @@ let passkey_display_name =
92
76
" the label for the user's passkey that they will see when logging in" . to_string ();
93
77
94
78
let transaction = passage_flex
79
+ . auth
95
80
. create_register_transaction (external_id , passkey_display_name )
96
81
. await
97
82
. unwrap ();
@@ -112,6 +97,7 @@ let passage_flex = PassageFlex::new(
112
97
let external_id = " a unique immutable string that represents your user" . to_string ();
113
98
114
99
let transaction = passage_flex
100
+ . auth
115
101
. create_authenticate_transaction (external_id )
116
102
. await
117
103
. unwrap ();
@@ -132,7 +118,7 @@ let passage_flex = PassageFlex::new(
132
118
let nonce =
133
119
" a unique single-use value received from the client after a passkey ceremony" . to_string ();
134
120
135
- match passage_flex . verify_nonce (nonce ). await {
121
+ match passage_flex . auth . verify_nonce (nonce ). await {
136
122
Ok (external_id ) => {
137
123
// use external_id to do things like generate and send your own auth token
138
124
}
@@ -144,7 +130,7 @@ match passage_flex.verify_nonce(nonce).await {
144
130
145
131
## Retrieve User Info
146
132
147
- To retrieve information about a user by their external ID -- which is the unique, immutable ID you supply to associate the Passage user with your user -- use the ` get_user ` method.
133
+ To retrieve information about a user by their external ID -- which is the unique, immutable ID you supply to associate the Passage user with your user -- use the ` get ` method.
148
134
149
135
``` rust
150
136
use passage_flex :: PassageFlex ;
@@ -158,13 +144,13 @@ let passage_flex = PassageFlex::new(
158
144
let external_id = your_user . id;
159
145
160
146
// get user info
161
- let user_info = passage_flex . get_user (external_id ). await . unwrap ();
147
+ let user_info = passage_flex . user . get_user (external_id ). await . unwrap ();
162
148
println! (" {:?}" , user_info . webauthn_devices);
163
149
```
164
150
165
151
## Retrieve a user's passkey devices
166
152
167
- To retrieve information about a user's passkey devices, use the ` get_devices ` method.
153
+ To retrieve information about a user's passkey devices, use the ` list_devices ` method.
168
154
169
155
``` rust
170
156
use passage_flex :: PassageFlex ;
@@ -177,8 +163,8 @@ let passage_flex = PassageFlex::new(
177
163
// this is the same value used when creating a transaction
178
164
let external_id = your_user . id;
179
165
180
- // get devices
181
- let passkey_devices = passage_flex . get_devices (external_id ). await . unwrap ();
166
+ // list devices
167
+ let passkey_devices = passage_flex . user . list_devices (external_id ). await . unwrap ();
182
168
for device in passkey_devices {
183
169
println! (" {}" , device . usage_count);
184
170
}
@@ -201,8 +187,8 @@ let passage_flex = PassageFlex::new(
201
187
let external_id = your_user . id;
202
188
let last_year = Utc :: now (). naive_utc (). date () - Duration :: days (365 );
203
189
204
- // get devices
205
- let passkey_devices = passage_flex . get_devices (external_id . clone ()). await . unwrap ();
190
+ // list devices
191
+ let passkey_devices = passage_flex . user . list_devices (external_id . clone ()). await . unwrap ();
206
192
207
193
for device in passkey_devices {
208
194
// revoke old devices that haven't been used in the last year
@@ -211,6 +197,7 @@ for device in passkey_devices {
211
197
212
198
if last_login_at_parsed < last_year {
213
199
if let Err (err ) = passage_flex
200
+ . user
214
201
. revoke_device (external_id . clone (), device . id)
215
202
. await
216
203
{
0 commit comments