summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crypto.rs49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/crypto.rs b/src/crypto.rs
index cf1044e..4b379de 100644
--- a/src/crypto.rs
+++ b/src/crypto.rs
@@ -283,7 +283,9 @@ mod test {
use hex_literal::hex;
use password_hash::{Output, SaltString};
- use crate::crypto::{KeyBundle, KeyFetchReq, SessionCredentials};
+ use crate::crypto::{
+ AccountResetReq, KeyBundle, KeyFetchReq, PasswordChangeReq, SessionCredentials,
+ };
use super::{AuthPW, SecretBytes};
@@ -405,4 +407,49 @@ mod test {
);
Ok(())
}
+
+ #[test]
+ fn test_password_change() {
+ let req = PasswordChangeReq::from_change_token(&shex!(
+ "0000000000000000 0000000000000000 0000000000000000 0000000000000000"
+ ));
+ assert_eq!(
+ req.token_id.0,
+ hex!("5a9f93f66c26fd1c 1ea9826fafc422e9 4b9c9f833cd2bfa5 da18c8d3317224aa")
+ );
+ assert_eq!(
+ req.req_hmac_key.0,
+ hex!("31940008f942939a 22d7cf8ad38dc6ac 346a8148439c0d98 d4a6ae8352da4536")
+ );
+ }
+
+ #[test]
+ fn test_password_forgot() {
+ let req = PasswordChangeReq::from_forgot_token(&shex!(
+ "0000000000000000 0000000000000000 0000000000000000 0000000000000000"
+ ));
+ assert_eq!(
+ req.token_id.0,
+ hex!("570e79050fd157a9 b8e7d7d6f88a3f67 e36207c5dfabe7d8 a80994502a624e07")
+ );
+ assert_eq!(
+ req.req_hmac_key.0,
+ hex!("fde451da23c03eec fe94e401eeef8bff 5c51742839b8058e c216214f78742d9a")
+ );
+ }
+
+ #[test]
+ fn test_account_reset() {
+ let req = AccountResetReq::from_token(&shex!(
+ "0000000000000000 0000000000000000 0000000000000000 0000000000000000"
+ ));
+ assert_eq!(
+ req.token_id.0,
+ hex!("8ade842449ab0285 e7b22de9d428cd5b 3c38ea0aa78e2956 a6a69ec66818d864")
+ );
+ assert_eq!(
+ req.req_hmac_key.0,
+ hex!("d17d0a55c5a0451c f21efaf39f3611bc 54ebc530ceb1fe8c 9be330c1b68f989f")
+ );
+ }
}