-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconstants.ts
More file actions
73 lines (61 loc) · 2.02 KB
/
constants.ts
File metadata and controls
73 lines (61 loc) · 2.02 KB
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
import { TORUS_SAPPHIRE_NETWORK } from "@toruslabs/constants";
import { CHAIN_NAMESPACES, CustomChainConfig } from "@web3auth/base";
import { ec as EllipticCurve } from "elliptic";
export const DEFAULT_CHAIN_CONFIG: CustomChainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0xaa36a7",
rpcTarget: "https://rpc.ankr.com/eth_sepolia",
displayName: "Ethereum Sepolia Testnet",
blockExplorer: "https://sepolia.etherscan.io",
ticker: "ETH",
tickerName: "Ethereum",
decimals: 18,
};
export const WEB3AUTH_NETWORK = {
MAINNET: TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET,
DEVNET: TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET,
} as const;
export const USER_PATH = {
NEW: "NewAccount",
EXISTING: "ExistingAccount",
REHYDRATE: "RehydrateAccount",
RECOVER: "RecoverAccount",
} as const;
export enum FactorKeyTypeShareDescription {
HashedShare = "hashedShare",
SecurityQuestions = "tssSecurityQuestions",
DeviceShare = "deviceShare",
SeedPhrase = "seedPhrase",
PasswordShare = "passwordShare",
SocialShare = "socialShare",
Other = "Other",
}
export const DELIMITERS = {
Delimiter1: "\u001c",
Delimiter2: "\u0015",
Delimiter3: "\u0016",
Delimiter4: "\u0017",
};
export const ERRORS = {
TKEY_SHARES_REQUIRED: "required more shares",
INVALID_BACKUP_SHARE: "invalid backup share",
};
export const SOCIAL_FACTOR_INDEX = 1;
/**
* Defines the TSS Share Index in a simplified way for better implementation.
**/
export enum TssShareType {
DEVICE = 2,
RECOVERY = 3,
}
export const VALID_SHARE_INDICES = [TssShareType.DEVICE, TssShareType.RECOVERY];
export const SCALAR_LEN = 32; // Length of secp256k1 scalar in bytes.
export const FIELD_ELEMENT_HEX_LEN = 32 * 2; // Length of secp256k1 field element in hex form.
export const CURVE = new EllipticCurve("secp256k1");
export const MAX_FACTORS = 10; // Maximum number of factors that can be added to an account.
export const SOCIAL_TKEY_INDEX = 1;
export const OPS = {
DELETE_FACTOR: "delete_factor",
CREATE_FACTOR: "created_factor",
LOCAL_SIGN: "local_sign",
};