Skip to content

Commit

Permalink
updated the code according to the sd-jwt-07 document
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Sukhachev <[email protected]>
  • Loading branch information
alexsdsr committed Jan 18, 2024
1 parent 84ef9d3 commit 2dc9a08
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub const DEFAULT_DIGEST_ALG: &str = "sha-256";
const SD_LIST_PREFIX: &str = "...";
const _SD_JWT_TYP_HEADER: &str = "sd+jwt";
const KB_JWT_TYP_HEADER: &str = "kb+jwt";
const KB_DIGEST_KEY: &str = "_sd_hash";
const KB_DIGEST_KEY: &str = "sd_hash";
pub const COMBINED_SERIALIZATION_FORMAT_SEPARATOR: &str = "~";
const JWT_SEPARATOR: &str = ".";
const CNF_KEY: &str = "cnf";
Expand Down
4 changes: 2 additions & 2 deletions src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ impl SDJWTVerifier {
return Err(Error::InvalidInput("Invalid nonce".to_string()));
}
if self.sd_jwt_engine.serialization_format == "compact" {
let _sd_hash = self._get_key_binding_digest_hash()?;
if key_binding_jwt.claims.get(KB_DIGEST_KEY) != Some(&Value::String(_sd_hash)) {
let sd_hash = self._get_key_binding_digest_hash()?;
if key_binding_jwt.claims.get(KB_DIGEST_KEY) != Some(&Value::String(sd_hash)) {
return Err(Error::InvalidInput("Invalid digest in KB-JWT".to_string()));
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub const W3C_VC_CLAIMS: &str = r#"{
"jti": "http://example.com/credentials/3732",
"iat": 1683000000,
"exp": 1883000000,
"type": "IdentityCredential",
"vct": "IdentityCredential",
"credentialSubject": {
"given_name": "John",
"family_name": "Doe",
Expand Down

0 comments on commit 2dc9a08

Please sign in to comment.