Skip to content

Commit d663223

Browse files
committed
Database model changes
1 parent f05916f commit d663223

30 files changed

+1760
-15
lines changed

Cargo.lock

Lines changed: 130 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ features = ["serde"]
462462
version = "=1.1.4" # Pinned to the latest version which used rand 0.8
463463
features = ["serde"]
464464

465+
[workspace.dependencies.webauthn_rp]
466+
version = "0.3.0"
467+
features = ["bin", "serde_relaxed", "custom", "serializable_server_state"]
468+
465469
# HTTP mock server
466470
[workspace.dependencies.wiremock]
467471
version = "0.6.3"

crates/data-model/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ rand.workspace = true
2424
regex = "1.11.1"
2525
woothee = "0.13.0"
2626
ruma-common.workspace = true
27+
webauthn_rp.workspace = true
2728

2829
mas-iana.workspace = true
2930
mas-jose.workspace = true

crates/data-model/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub use self::{
4949
user_agent::{DeviceType, UserAgent},
5050
users::{
5151
Authentication, AuthenticationMethod, BrowserSession, Password, User, UserEmail,
52-
UserEmailAuthentication, UserEmailAuthenticationCode, UserRecoverySession,
53-
UserRecoveryTicket, UserRegistration, UserRegistrationPassword,
52+
UserEmailAuthentication, UserEmailAuthenticationCode, UserPasskey, UserPasskeyChallenge,
53+
UserRecoverySession, UserRecoveryTicket, UserRegistration, UserRegistrationPassword,
5454
},
5555
};

crates/data-model/src/users.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rand::Rng;
1111
use serde::Serialize;
1212
use ulid::Ulid;
1313
use url::Url;
14+
use webauthn_rp::response::{AuthTransports, CredentialId};
1415

1516
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
1617
pub struct User {
@@ -67,6 +68,7 @@ pub struct Authentication {
6768
pub enum AuthenticationMethod {
6869
Password { user_password_id: Ulid },
6970
UpstreamOAuth2 { upstream_oauth2_session_id: Ulid },
71+
Passkey { user_passkey_id: Ulid },
7072
Unknown,
7173
}
7274

@@ -215,3 +217,26 @@ pub struct UserRegistration {
215217
pub created_at: DateTime<Utc>,
216218
pub completed_at: Option<DateTime<Utc>>,
217219
}
220+
221+
#[derive(Debug, Clone, Serialize)]
222+
pub struct UserPasskey {
223+
pub id: Ulid,
224+
pub user_id: Ulid,
225+
pub credential_id: CredentialId<Vec<u8>>,
226+
pub name: String,
227+
pub transports: AuthTransports,
228+
pub static_state: Vec<u8>,
229+
pub dynamic_state: Vec<u8>,
230+
pub metadata: Vec<u8>,
231+
pub last_used_at: Option<DateTime<Utc>>,
232+
pub created_at: DateTime<Utc>,
233+
}
234+
235+
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
236+
pub struct UserPasskeyChallenge {
237+
pub id: Ulid,
238+
pub user_session_id: Option<Ulid>,
239+
pub state: Vec<u8>,
240+
pub created_at: DateTime<Utc>,
241+
pub completed_at: Option<DateTime<Utc>>,
242+
}

crates/storage-pg/.sqlx/query-182ff71d6007b3607761a48971e43b6bdf6a41896d787a13be3399022fe5e43d.json

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-74e377397d05062d15b8b7a674390af5ecca2f977b8d74311b4cad401e2650e5.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/storage-pg/.sqlx/query-74f98b0965300fbd37c29e7d4fa02ffb44631d77b14796db971064ef27abb739.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)