Skip to content

Commit

Permalink
change user_id encoding to hex
Browse files Browse the repository at this point in the history
  • Loading branch information
stneng committed Sep 6, 2022
1 parent 7e4299e commit 56793ec
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[package]
name = "colink-server"
version = "0.1.9"
version = "0.1.10"
edition = "2021"

[dependencies]
async-trait = "0.1"
base64 = "0.13.0"
chrono = "0.4"
futures-lite = "1.12"
hex = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion src/service/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl crate::server::MyService {
));
}
self.check_user_consent(&user_consent_to_be_checked, &self.public_key.serialize())?;
let user_id = base64::encode(&user_public_key.serialize());
let user_id = hex::encode(&user_public_key.serialize());
let mq_uri = match self.mq.create_user_account().await {
Ok(mq_uri) => mq_uri,
Err(e) => return Err(Status::internal(e)),
Expand Down
2 changes: 1 addition & 1 deletion src/service/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ impl crate::server::MyService {
}
self.check_user_consent(decision.user_consent.as_ref().unwrap(), core_public_key_vec)?;
// After checking user consent, we need to verify that the user_id match up with the UserConsent's user public key.
let user_pubilc_key_vec_from_userid: &Vec<u8> = &base64::decode(user_id).unwrap();
let user_pubilc_key_vec_from_userid: &Vec<u8> = &hex::decode(user_id).unwrap();
let user_public_key_vec_from_userconsent: &Vec<u8> =
&decision.user_consent.as_ref().unwrap().public_key;
if user_pubilc_key_vec_from_userid != user_public_key_vec_from_userconsent {
Expand Down

0 comments on commit 56793ec

Please sign in to comment.