forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.ts
More file actions
38 lines (32 loc) · 881 Bytes
/
common.ts
File metadata and controls
38 lines (32 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Copyright (c) 2023 Hengyang Zhang
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
import { type I18nKey } from "@i18n"
import { type LimitMessage } from "@i18n/message/app/limit"
type LimitVerificationMessage = LimitMessage['verification']
export type VerificationContext = {
difficulty: timer.limit.VerificationDifficulty
locale: timer.Locale
}
export type VerificationPair = {
prompt?: I18nKey<LimitVerificationMessage> | string
promptParam?: any
answer: I18nKey<LimitVerificationMessage> | string
second: number
}
/**
* Verification code generator
*/
export interface VerificationGenerator {
/**
* Whether to support
*/
supports(context: VerificationContext): boolean
/**
* Render the prompt
*/
generate(context: VerificationContext): VerificationPair
}