-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add act to unregister identity (#57)
- Loading branch information
Showing
3 changed files
with
35 additions
and
41 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,35 +1,3 @@ | ||
use { | ||
crate::auth::jwt::{JwtClaims, JwtVerifierByIssuer}, | ||
serde::{Deserialize, Serialize}, | ||
}; | ||
|
||
pub mod register; | ||
pub mod resolve; | ||
pub mod unregister; | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct IdentityKeyClaims { | ||
aud: String, // keys server url used for registering | ||
exp: usize, // timestamp when jwt must expire TODO: Should be 1 hour | ||
iat: usize, // timestamp when jwt was issued | ||
iss: String, // public identity key in form of did:key, also used to verify jwt signature | ||
pkh: String, // corresponding blockchain account (did:pkh) | ||
} | ||
|
||
impl JwtClaims for IdentityKeyClaims { | ||
fn is_valid(&self) -> bool { | ||
true | ||
// TODO: Add validation: | ||
// aud must be equal this dns? | ||
// exp must be in future | ||
// iat must be in past | ||
// iss must be valid did:key | ||
// pkh must be valid did:pkh | ||
} | ||
} | ||
|
||
impl JwtVerifierByIssuer for IdentityKeyClaims { | ||
fn get_iss(&self) -> &str { | ||
&self.iss | ||
} | ||
} |
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