forked from Proxmox/proxmox
tfa: add WebauthnConfig::digest method
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
21b56f0c79
commit
df3e1c53d5
@ -49,6 +49,18 @@ pub struct WebauthnConfig {
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
impl WebauthnConfig {
|
||||
pub fn digest(&self) -> [u8; 32] {
|
||||
let data = format!(
|
||||
"rp={:?}\norigin={:?}\nid={:?}\n",
|
||||
self.rp,
|
||||
self.origin.0.as_str(),
|
||||
self.id,
|
||||
);
|
||||
openssl::sha::sha256(data.as_bytes())
|
||||
}
|
||||
}
|
||||
|
||||
/// For now we just implement this on the configuration this way.
|
||||
///
|
||||
/// Note that we may consider changing this so `get_origin` returns the `Host:` header provided by
|
||||
|
Loading…
x
Reference in New Issue
Block a user