You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/src/apps/webauthn/list_resident_credentials.py

39 lines
1.2 KiB

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from trezor.messages import WebAuthnListResidentCredentials, WebAuthnCredentials
async def list_resident_credentials(
msg: WebAuthnListResidentCredentials,
) -> WebAuthnCredentials:
from trezor.messages import WebAuthnCredential, WebAuthnCredentials
from trezor.ui.layouts import confirm_action
from . import resident_credentials
await confirm_action(
"credentials_list",
"List credentials",
description="Export information about the credentials stored on this device?",
verb="EXPORT",
)
creds = [
WebAuthnCredential(
index=cred.index,
id=cred.id,
rp_id=cred.rp_id,
rp_name=cred.rp_name,
user_id=cred.user_id,
user_name=cred.user_name,
user_display_name=cred.user_display_name,
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()
]
return WebAuthnCredentials(credentials=creds)