use builder pattern for MakeCredentail and GetAssertion
This commit is contained in:
@@ -702,15 +702,16 @@ impl PublicKeyCredentialDescriptor {
|
||||
pub struct AuthenticatorOptions {
|
||||
pub rk: bool,
|
||||
pub uv: bool,
|
||||
pub up: bool,
|
||||
}
|
||||
|
||||
impl AuthenticatorOptions {
|
||||
pub fn encoded(&self) -> bool {
|
||||
self.rk || self.uv
|
||||
self.rk || self.uv || self.up
|
||||
}
|
||||
|
||||
pub fn encode<W: WriteBytesExt>(&self, encoder: &mut Encoder<W>) -> FidoResult<()> {
|
||||
let length = (self.rk as usize) + (self.uv as usize);
|
||||
let length = (self.rk as usize) + (self.uv as usize) + (self.up as usize);
|
||||
encoder.object(length)?;
|
||||
if self.rk {
|
||||
encoder.text("rk")?;
|
||||
@@ -720,6 +721,10 @@ impl AuthenticatorOptions {
|
||||
encoder.text("uv")?;
|
||||
encoder.bool(true)?;
|
||||
}
|
||||
if self.up {
|
||||
encoder.text("up")?;
|
||||
encoder.bool(true)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user