-
Notifications
You must be signed in to change notification settings - Fork 50
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
Showing
18 changed files
with
276 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# This is a configuration file for the bacon tool | ||
# | ||
# Bacon repository: https://github.com/Canop/bacon | ||
# Complete help on configuration: https://dystroy.org/bacon/config/ | ||
# You can also check bacon's own bacon.toml file | ||
# as an example: https://github.com/Canop/bacon/blob/main/bacon.toml | ||
|
||
default_job = "check" | ||
|
||
[jobs.check] | ||
command = ["cargo", "check", "--color", "always"] | ||
need_stdout = false | ||
|
||
[jobs.check-all] | ||
command = ["cargo", "check", "--all-targets", "--color", "always"] | ||
need_stdout = false | ||
|
||
[jobs.clippy] | ||
command = ["cargo", "clippy", "--all-targets", "--color", "always"] | ||
need_stdout = false | ||
|
||
[jobs.test] | ||
command = [ | ||
"cargo", | ||
"test", | ||
"--all-features", | ||
"--color", | ||
"always", | ||
"--", | ||
"--color", | ||
"always", # see https://github.com/Canop/bacon/issues/124 | ||
] | ||
need_stdout = true | ||
|
||
[jobs.doc] | ||
command = ["cargo", "doc", "--color", "always", "--no-deps"] | ||
need_stdout = false | ||
|
||
# If the doc compiles, then it opens in your browser and bacon switches | ||
# to the previous job | ||
[jobs.doc-open] | ||
command = ["cargo", "doc", "--color", "always", "--no-deps", "--open"] | ||
need_stdout = false | ||
on_success = "back" # so that we don't open the browser at each change | ||
|
||
[jobs.doc-internal] | ||
command = [ | ||
"cargo", | ||
"doc", | ||
"--color", | ||
"always", | ||
"--no-deps", | ||
"--all-features", | ||
"--document-private-items", | ||
] | ||
need_stdout = false | ||
|
||
[jobs.doc-internal-open] | ||
command = [ | ||
"cargo", | ||
"doc", | ||
"--color", | ||
"always", | ||
"--no-deps", | ||
"--all-features", | ||
"--document-private-items", | ||
"--open", | ||
] | ||
allow_warnings = true | ||
need_stdout = false | ||
on_success = "job:doc-internal" | ||
|
||
# You may define here keybindings that would be specific to | ||
# a project, for example a shortcut to launch a specific job. | ||
# Shortcuts to internal functions (scrolling, toggling, etc.) | ||
# should go in your personal global prefs.toml file instead. | ||
[keybindings] | ||
# alt-m = "job:my-job" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,26 +125,25 @@ mod tests { | |
use bitwarden_crypto::Kdf; | ||
|
||
use super::*; | ||
use crate::{ | ||
client::{LoginMethod, UserLoginMethod}, | ||
mobile::crypto::{AuthRequestMethod, InitUserCryptoMethod, InitUserCryptoRequest}, | ||
}; | ||
use crate::mobile::crypto::{AuthRequestMethod, InitUserCryptoMethod, InitUserCryptoRequest}; | ||
|
||
#[test] | ||
fn test_approve() { | ||
let mut client = Client::new(None); | ||
client.set_login_method(LoginMethod::User(UserLoginMethod::Username { | ||
client_id: "7b821276-e27c-400b-9853-606393c87f18".to_owned(), | ||
email: "[email protected]".to_owned(), | ||
kdf: Kdf::PBKDF2 { | ||
|
||
let master_key = bitwarden_crypto::MasterKey::derive( | ||
"asdfasdfasdf".as_bytes(), | ||
"[email protected]".as_bytes(), | ||
&Kdf::PBKDF2 { | ||
iterations: NonZeroU32::new(600_000).unwrap(), | ||
}, | ||
})); | ||
) | ||
.unwrap(); | ||
|
||
let user_key = "2.Q/2PhzcC7GdeiMHhWguYAQ==|GpqzVdr0go0ug5cZh1n+uixeBC3oC90CIe0hd/HWA/pTRDZ8ane4fmsEIcuc8eMKUt55Y2q/fbNzsYu41YTZzzsJUSeqVjT8/iTQtgnNdpo=|dwI+uyvZ1h/iZ03VQ+/wrGEFYVewBUUl/syYgjsNMbE=".parse().unwrap(); | ||
let private_key ="2.yN7l00BOlUE0Sb0M//Q53w==|EwKG/BduQRQ33Izqc/ogoBROIoI5dmgrxSo82sgzgAMIBt3A2FZ9vPRMY+GWT85JiqytDitGR3TqwnFUBhKUpRRAq4x7rA6A1arHrFp5Tp1p21O3SfjtvB3quiOKbqWk6ZaU1Np9HwqwAecddFcB0YyBEiRX3VwF2pgpAdiPbSMuvo2qIgyob0CUoC/h4Bz1be7Qa7B0Xw9/fMKkB1LpOm925lzqosyMQM62YpMGkjMsbZz0uPopu32fxzDWSPr+kekNNyLt9InGhTpxLmq1go/pXR2uw5dfpXc5yuta7DB0EGBwnQ8Vl5HPdDooqOTD9I1jE0mRyuBpWTTI3FRnu3JUh3rIyGBJhUmHqGZvw2CKdqHCIrQeQkkEYqOeJRJVdBjhv5KGJifqT3BFRwX/YFJIChAQpebNQKXe/0kPivWokHWwXlDB7S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LOnHm1w8dzYbLN44OG44rRsbihMUQp+wUZ6bsI8rrOnm9WErzkbQFbrfAINdoCiNa6cimYIjvvnMTaFWNymqY1vZxGztQiMiHiHYwTfwHTXrb9j0uPM=|09J28iXv9oWzYtzK2LBT6Yht4IT4MijEkk0fwFdrVQ4=".parse().unwrap(); | ||
client | ||
.initialize_user_crypto("asdfasdfasdf", user_key, private_key) | ||
.initialize_user_crypto_master_key(master_key, user_key, private_key) | ||
.unwrap(); | ||
|
||
let public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyLRDUwXB4BfQ507D4meFPmwn5zwy3IqTPJO4plrrhnclWahXa240BzyFW9gHgYu+Jrgms5xBfRTBMcEsqqNm7+JpB6C1B6yvnik0DpJgWQw1rwvy4SUYidpR/AWbQi47n/hvnmzI/sQxGddVfvWu1iTKOlf5blbKYAXnUE5DZBGnrWfacNXwRRdtP06tFB0LwDgw+91CeLSJ9py6dm1qX5JIxoO8StJOQl65goLCdrTWlox+0Jh4xFUfCkb+s3px+OhSCzJbvG/hlrSRcUz5GnwlCEyF3v5lfUtV96MJD+78d8pmH6CfFAp2wxKRAbGdk+JccJYO6y6oIXd3Fm7twIDAQAB"; | ||
|
@@ -206,14 +205,13 @@ mod tests { | |
|
||
// Initialize an existing client which is unlocked | ||
let mut existing_device = Client::new(None); | ||
existing_device.set_login_method(LoginMethod::User(UserLoginMethod::Username { | ||
client_id: "123".to_owned(), | ||
email: email.to_owned(), | ||
kdf: kdf.clone(), | ||
})); | ||
|
||
let master_key = | ||
bitwarden_crypto::MasterKey::derive("asdfasdfasdf".as_bytes(), email.as_bytes(), &kdf) | ||
.unwrap(); | ||
|
||
existing_device | ||
.initialize_user_crypto("asdfasdfasdf", user_key, private_key.parse().unwrap()) | ||
.initialize_user_crypto_master_key(master_key, user_key, private_key.parse().unwrap()) | ||
.unwrap(); | ||
|
||
// Initialize a new device which will request to be logged in | ||
|
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.