Skip to content

Commit 943b1e9

Browse files
committed
fix: updates example server to use nested classes
1 parent bcdc226 commit 943b1e9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/poem-openapi/src/main.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ impl Api {
119119
let transaction_id = self
120120
.state
121121
.passage_client
122+
.auth
122123
.create_register_transaction(user_id.clone(), req.0.email.clone())
123124
.await
124125
.map_err(|e| {
@@ -155,6 +156,7 @@ impl Api {
155156
let transaction_id = self
156157
.state
157158
.passage_client
159+
.auth
158160
.create_authenticate_transaction(user_id)
159161
.await
160162
.map_err(|e| match e {
@@ -180,7 +182,7 @@ impl Api {
180182
#[oai(path = "/auth/verify", method = "post")]
181183
async fn verify_nonce(&self, req: Json<VerifyRequest>) -> poem::Result<Json<VerifyResponse>> {
182184
// Verify the nonce using the Passage SDK
183-
match self.state.passage_client.verify_nonce(req.0.nonce).await {
185+
match self.state.passage_client.auth.verify_nonce(req.0.nonce).await {
184186
Ok(user_id) => {
185187
// Find the user in the database and set the auth token
186188
let mut users = self.state.users.lock().await;
@@ -225,6 +227,7 @@ impl Api {
225227
let transaction_id = self
226228
.state
227229
.passage_client
230+
.auth
228231
.create_register_transaction(user.id.clone(), user.email.clone())
229232
.await
230233
.map_err(|e| {
@@ -261,7 +264,8 @@ impl Api {
261264
let passkeys = self
262265
.state
263266
.passage_client
264-
.get_devices(user.id.clone())
267+
.user
268+
.list_devices(user.id.clone())
265269
.await
266270
.map(|devices| {
267271
devices
@@ -306,6 +310,7 @@ impl Api {
306310
// Revoke the passkey device using the Passage SDK
307311
self.state
308312
.passage_client
313+
.user
309314
.revoke_device(user.id.clone(), req.0.passkey_id.clone())
310315
.await
311316
.map_err(|e| {

0 commit comments

Comments
 (0)