core/webauthn: Add algorithm and curve to WebAuthnListResidentCredentials response.

pull/902/head
Andrew Kozlik 4 years ago committed by Andrew Kozlik
parent f610787f8d
commit 2f905a1157

@ -53,5 +53,7 @@ message WebAuthnCredentials {
optional uint32 creation_time = 8;
optional bool hmac_secret = 9;
optional bool use_sign_count = 10;
optional sint32 algorithm = 11;
optional sint32 curve = 12;
}
}

@ -33,6 +33,8 @@ async def list_resident_credentials(
creation_time=cred.creation_time,
hmac_secret=cred.hmac_secret,
use_sign_count=cred.use_sign_count,
algorithm=cred.algorithm,
curve=cred.curve,
)
for cred in resident_credentials.find_all()
]

@ -24,6 +24,8 @@ class WebAuthnCredential(p.MessageType):
creation_time: int = None,
hmac_secret: bool = None,
use_sign_count: bool = None,
algorithm: int = None,
curve: int = None,
) -> None:
self.index = index
self.id = id
@ -35,6 +37,8 @@ class WebAuthnCredential(p.MessageType):
self.creation_time = creation_time
self.hmac_secret = hmac_secret
self.use_sign_count = use_sign_count
self.algorithm = algorithm
self.curve = curve
@classmethod
def get_fields(cls) -> Dict:
@ -49,4 +53,6 @@ class WebAuthnCredential(p.MessageType):
8: ('creation_time', p.UVarintType, 0),
9: ('hmac_secret', p.BoolType, 0),
10: ('use_sign_count', p.BoolType, 0),
11: ('algorithm', p.SVarintType, 0),
12: ('curve', p.SVarintType, 0),
}

@ -18,6 +18,10 @@ import click
from .. import fido
ALGORITHM_NAME = {-7: "ES256 (ECDSA w/ SHA-256)", -8: "EdDSA"}
CURVE_NAME = {1: "P-256 (secp256r1)", 6: "Ed25519"}
@click.group(name="fido")
def cli():
@ -33,6 +37,7 @@ def credentials():
@click.pass_obj
def credentials_list(connect):
"""List all resident credentials on the device."""
creds = fido.list_credentials(connect())
for cred in creds:
click.echo("")
@ -53,6 +58,12 @@ def credentials_list(connect):
click.echo(" hmac-secret enabled: {}".format(cred.hmac_secret))
if cred.use_sign_count is not None:
click.echo(" Use signature counter: {}".format(cred.use_sign_count))
if cred.algorithm is not None:
algorithm = ALGORITHM_NAME.get(cred.algorithm, cred.algorithm)
click.echo(" Algorithm: {}".format(algorithm))
if cred.curve is not None:
curve = CURVE_NAME.get(cred.curve, cred.curve)
click.echo(" Curve: {}".format(curve))
click.echo(" Credential ID: {}".format(cred.id.hex()))
if not creds:

@ -24,6 +24,8 @@ class WebAuthnCredential(p.MessageType):
creation_time: int = None,
hmac_secret: bool = None,
use_sign_count: bool = None,
algorithm: int = None,
curve: int = None,
) -> None:
self.index = index
self.id = id
@ -35,6 +37,8 @@ class WebAuthnCredential(p.MessageType):
self.creation_time = creation_time
self.hmac_secret = hmac_secret
self.use_sign_count = use_sign_count
self.algorithm = algorithm
self.curve = curve
@classmethod
def get_fields(cls) -> Dict:
@ -49,4 +53,6 @@ class WebAuthnCredential(p.MessageType):
8: ('creation_time', p.UVarintType, 0),
9: ('hmac_secret', p.BoolType, 0),
10: ('use_sign_count', p.BoolType, 0),
11: ('algorithm', p.SVarintType, 0),
12: ('curve', p.SVarintType, 0),
}

Loading…
Cancel
Save