-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a9cc88
commit 212519a
Showing
28 changed files
with
1,122 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
apps/desktop/desktop_native/macos_provider/src/assertion.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use std::sync::Arc; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::{BitwardenError, Callback, UserVerification}; | ||
|
||
#[derive(uniffi::Record, Debug, Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct PasskeyAssertionRequest { | ||
relying_party_id: String, | ||
credential_id: Vec<u8>, | ||
user_name: String, | ||
user_handle: Vec<u8>, | ||
record_identifier: Option<String>, | ||
client_data_hash: Vec<u8>, | ||
user_verification: UserVerification, | ||
} | ||
|
||
#[derive(uniffi::Record, Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct PasskeyAssertionResponse { | ||
relying_party_id: String, | ||
user_handle: Vec<u8>, | ||
signature: Vec<u8>, | ||
client_data_hash: Vec<u8>, | ||
authenticator_data: Vec<u8>, | ||
credential_id: Vec<u8>, | ||
} | ||
|
||
#[uniffi::export(with_foreign)] | ||
pub trait PreparePasskeyAssertionCallback: Send + Sync { | ||
fn on_complete(&self, credential: PasskeyAssertionResponse); | ||
fn on_error(&self, error: BitwardenError); | ||
} | ||
|
||
impl Callback for Arc<dyn PreparePasskeyAssertionCallback> { | ||
fn complete(&self, credential: serde_json::Value) -> Result<(), serde_json::Error> { | ||
let credential = serde_json::from_value(credential)?; | ||
PreparePasskeyAssertionCallback::on_complete(self.as_ref(), credential); | ||
Ok(()) | ||
} | ||
|
||
fn error(&self, error: BitwardenError) { | ||
PreparePasskeyAssertionCallback::on_error(self.as_ref(), error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.