From 6b369c54d6dde67f41f499f9ad79f357eb079517 Mon Sep 17 00:00:00 2001 From: Andri Schatz Date: Thu, 31 Oct 2024 10:52:23 +0100 Subject: [PATCH 01/11] start replacing DeviceData with DeviceWithUsage --- src/frontend/src/flows/manage/index.ts | 5 ++++- src/frontend/src/flows/manage/types.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/flows/manage/index.ts b/src/frontend/src/flows/manage/index.ts index 8d51f4d9ea..bd4e4d305d 100644 --- a/src/frontend/src/flows/manage/index.ts +++ b/src/frontend/src/flows/manage/index.ts @@ -1,5 +1,6 @@ import { DeviceData, + DeviceWithUsage, IdentityAnchorInfo, } from "$generated/internet_identity_types"; import identityCardBackground from "$src/assets/identityCardBackground.png"; @@ -303,6 +304,7 @@ export const displayManage = ( connection, reload: resolve, }); + if (devices.dupPhrase) { toast.error( "More than one recovery phrases are registered, which is unexpected. Only one will be shown." @@ -441,7 +443,7 @@ export const devicesFromDeviceDatas = ({ connection, userNumber, }: { - devices: DeviceData[]; + devices: DeviceWithUsage[]; reload: (connection?: AuthenticatedConnection) => void; connection: AuthenticatedConnection; userNumber: bigint; @@ -470,6 +472,7 @@ export const devicesFromDeviceDatas = ({ const authenticator = { alias: device.alias, + last_usage: device.last_usage, warn: domainWarning(device), rename: () => renameDevice({ connection, device, reload }), remove: hasSingleDevice diff --git a/src/frontend/src/flows/manage/types.ts b/src/frontend/src/flows/manage/types.ts index de42117240..f909ea5164 100644 --- a/src/frontend/src/flows/manage/types.ts +++ b/src/frontend/src/flows/manage/types.ts @@ -3,6 +3,7 @@ import { TemplateResult } from "lit-html"; // A simple authenticator (non-recovery device) export type Authenticator = { alias: string; + last_usage: [] | [BigInt]; rename: () => void; remove?: () => void; warn?: TemplateResult; From 73dc3c8bdc3c366b61d15a061bf4a25a16d1f6eb Mon Sep 17 00:00:00 2001 From: Andri Schatz Date: Thu, 31 Oct 2024 15:10:12 +0100 Subject: [PATCH 02/11] finish replacing DeviceData with DeviceWithUsage, display last_usage formatted in devices list if available --- .../src/flows/manage/authenticatorsSection.ts | 20 ++++++++++++++++++- src/frontend/src/flows/manage/index.ts | 6 +++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/flows/manage/authenticatorsSection.ts b/src/frontend/src/flows/manage/authenticatorsSection.ts index 7e43fd8523..0785d658ad 100644 --- a/src/frontend/src/flows/manage/authenticatorsSection.ts +++ b/src/frontend/src/flows/manage/authenticatorsSection.ts @@ -47,6 +47,7 @@ export const authenticatorsSection = ({ ]; const authenticators = dedupLabels(authenticators_); + console.log(authenticators); return html`