Skip to content

Commit 86f4bcf

Browse files
authored
chore: remove api docs from readme (#36)
* chore: remove api docs from readme * chore: update docs link
1 parent 2940056 commit 86f4bcf

File tree

1 file changed

+1
-151
lines changed

1 file changed

+1
-151
lines changed

README.md

Lines changed: 1 addition & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -55,157 +55,7 @@ let passage_flex = PassageFlex::new(
5555

5656
### Go Passwordless
5757

58-
Find more details about Passkey Flex on our [Passkey Flex Documentation](https://docs.passage.id/flex) and [Docs.rs](https://docs.rs/passage_flex/latest/passage_flex/) pages.
59-
60-
## API Reference
61-
62-
### Create a Registration Transaction
63-
64-
To create a transaction to start a user passkey registration, use the `create_register_transaction` 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 external_id = "a unique immutable string that represents your user".to_string();
75-
let passkey_display_name =
76-
"the label for the user's passkey that they will see when logging in".to_string();
77-
78-
let transaction = passage_flex
79-
.auth
80-
.create_register_transaction(external_id, passkey_display_name)
81-
.await
82-
.unwrap();
83-
```
84-
85-
### Create an Authentication Transaction
86-
87-
To create a transaction to start a user passkey authentication, use the `create_authenticate_transaction` method.
88-
89-
```rust
90-
use passage_flex::PassageFlex;
91-
92-
let passage_flex = PassageFlex::new(
93-
std::env::var("PASSAGE_APP_ID").unwrap(),
94-
std::env::var("PASSAGE_API_KEY").unwrap(),
95-
);
96-
97-
let external_id = "a unique immutable string that represents your user".to_string();
98-
99-
let transaction = passage_flex
100-
.auth
101-
.create_authenticate_transaction(external_id)
102-
.await
103-
.unwrap();
104-
```
105-
106-
## Verify a Nonce
107-
108-
To verify a nonce that you received from the end of of passkey registration or authentication ceremony, use the `verify_nonce` method.
109-
110-
```rust
111-
use passage_flex::PassageFlex;
112-
113-
let passage_flex = PassageFlex::new(
114-
std::env::var("PASSAGE_APP_ID").unwrap(),
115-
std::env::var("PASSAGE_API_KEY").unwrap(),
116-
);
117-
118-
let nonce =
119-
"a unique single-use value received from the client after a passkey ceremony".to_string();
120-
121-
match passage_flex.auth.verify_nonce(nonce).await {
122-
Ok(external_id) => {
123-
// use external_id to do things like generate and send your own auth token
124-
}
125-
Err(err) => {
126-
// nonce was invalid or unable to be verified
127-
}
128-
}
129-
```
130-
131-
## Retrieve User Info
132-
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.
134-
135-
```rust
136-
use passage_flex::PassageFlex;
137-
138-
let passage_flex = PassageFlex::new(
139-
std::env::var("PASSAGE_APP_ID").unwrap(),
140-
std::env::var("PASSAGE_API_KEY").unwrap(),
141-
);
142-
143-
// this is the same value used when creating a transaction
144-
let external_id = your_user.id;
145-
146-
// get user info
147-
let passage_user = passage_flex.user.get(external_id).await.unwrap();
148-
println!("{:?}", passage_user.webauthn_devices);
149-
```
150-
151-
## Retrieve a user's passkey devices
152-
153-
To retrieve information about a user's passkey devices, use the `list_devices` method.
154-
155-
```rust
156-
use passage_flex::PassageFlex;
157-
158-
let passage_flex = PassageFlex::new(
159-
std::env::var("PASSAGE_APP_ID").unwrap(),
160-
std::env::var("PASSAGE_API_KEY").unwrap(),
161-
);
162-
163-
// this is the same value used when creating a transaction
164-
let external_id = your_user.id;
165-
166-
// list devices
167-
let passkey_devices = passage_flex.user.list_devices(external_id).await.unwrap();
168-
for device in passkey_devices {
169-
println!("{}", device.usage_count);
170-
}
171-
```
172-
173-
## Revoke a User's Passkey Device
174-
175-
To revoke a user's passkey device, use the `revoke_device` method.
176-
177-
```rust
178-
use passage_flex::PassageFlex;
179-
use chrono::{Duration, NaiveDate, Utc};
180-
181-
let passage_flex = PassageFlex::new(
182-
std::env::var("PASSAGE_APP_ID").unwrap(),
183-
std::env::var("PASSAGE_API_KEY").unwrap(),
184-
);
185-
186-
// this is the same value used when creating a transaction
187-
let external_id = your_user.id;
188-
let last_year = Utc::now().naive_utc().date() - Duration::days(365);
189-
190-
// list devices
191-
let passkey_devices = passage_flex.user.list_devices(external_id.clone()).await.unwrap();
192-
193-
for device in passkey_devices {
194-
// revoke old devices that haven't been used in the last year
195-
let last_login_at_parsed =
196-
NaiveDate::parse_from_str(&device.last_login_at, "%Y-%m-%dT%H:%M:%S%z").unwrap();
197-
198-
if last_login_at_parsed < last_year {
199-
if let Err(err) = passage_flex
200-
.user
201-
.revoke_device(external_id.clone(), device.id)
202-
.await
203-
{
204-
// device couldn't be revoked
205-
}
206-
}
207-
}
208-
```
58+
Find all core functions and more implementation guidance on our [Passkey Flex Rust Documentation](https://docs.passage.id/flex/rust) page.
20959

21060
## Support & Feedback
21161

0 commit comments

Comments
 (0)