-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
92 lines (78 loc) · 1.44 KB
/
types.ts
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
export type HandshakeIn = {
account: string;
network: number;
destination: string;
};
export type HandshakeResult = HandshakeIn & {
timestamp: number;
signature: string;
};
export type HandshakeResultWithMessage = HandshakeResult & {
message: string;
};
export type SignedMessage = {
message: string;
signature: string;
hash: string;
};
export type Secret = HandshakeIn & {
position: number;
nonce: number;
expiry: number;
};
export type RawCaptcha = {
image: string;
segment: string;
posX: number;
posY: number;
};
export type BaseCaptcha = {
image: string;
segment: string;
magicToken: string; // Secret
};
export type SignedCaptcha = BaseCaptcha & {
signature: string;
};
export type SolvedCaptcha = SignedCaptcha & {
posX: number;
posY: number;
};
export type ProofData = {
account: string;
nonce: number;
timestamp: number;
destination: string;
};
export type Proof = {
s: string;
r: string;
v: number;
data: ProofData;
};
export interface EIP712Domain {
name: string;
version: string;
chainId: number;
verifyingContract: string;
}
export type TypedData = {
domain: EIP712Domain;
message: ProofData;
primaryType: string;
types: any;
};
export type Positions = {
posX: number;
posY: number;
};
export enum ErrorCode {
NONE,
INVALID_INPUT,
UNSUPPORTED_NETWORK,
INVALID_SIGNATURE,
INVALID_SIGNATURE_STRING,
SESSION_EXPIRED,
INVALID_REQUEST,
INVALID_SOLUTION,
}