feat(INDA-383): daily stats.
[ProtonMail-WebClient.git] / packages / shared / lib / keyTransparency / telemetry.ts
blob9d11024d92cd4af595b8ed5d75441f5fe4fe80f8
1 import type { AddressAuditWarningDetails } from '@proton/key-transparency/lib';
2 import { AddressAuditWarningReason } from '@proton/key-transparency/lib';
4 export const getWarningReason = (warningDetails?: AddressAuditWarningDetails) => {
5     if (!warningDetails) {
6         return 'undefined';
7     }
8     const { reason, sklVerificationFailed, addressWasDisabled } = warningDetails;
9     if (reason === AddressAuditWarningReason.UnverifiableHistory) {
10         if (addressWasDisabled) {
11             return 'disabled_address';
12         }
14         if (sklVerificationFailed) {
15             return 'skl_verification_failed';
16         }
18         return 'unverifiable_history';
19     }
20     if (reason === AddressAuditWarningReason.AddressWithNoKeys) {
21         return 'address_with_no_keys';
22     }
23     // should not fall here
24     return 'unknown';