Skip to content

Commit

Permalink
Add pcp_version field to UserData
Browse files Browse the repository at this point in the history
  • Loading branch information
valff committed Jun 13, 2024
1 parent 35ff8ce commit 2d3f166
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions orb-qr-link/src/user_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ pub struct UserData {
pub self_custody_public_key: String,
/// User's biometric data policy.
pub data_policy: DataPolicy,
/// Personal Custody Package version.
#[serde(default = "pcp_version_default")]
pub pcp_version: u16,
}

/// User's biometric data policy. Part of [`UserData`].
Expand Down Expand Up @@ -51,10 +54,12 @@ impl UserData {
identity_commitment,
self_custody_public_key,
data_policy,
pcp_version,
} = self;
hasher.update(identity_commitment.as_bytes());
hasher.update(self_custody_public_key.as_bytes());
hasher.update(&[*data_policy as u8]);
hasher.update(&pcp_version.to_ne_bytes());
}
}

Expand All @@ -77,3 +82,7 @@ impl ToString for DataPolicy {
}
}
}

fn pcp_version_default() -> u16 {
2
}

0 comments on commit 2d3f166

Please sign in to comment.