-
Notifications
You must be signed in to change notification settings - Fork 14
/
config.ts
66 lines (58 loc) · 2.02 KB
/
config.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
import dotenv from "dotenv";
import { ethers } from "ethers";
import { getEddsaPrivateKey, getEs256kPrivateKey } from "./src/utils/keygen";
dotenv.config();
const getParam = (name: string) => {
const param = process.env[name];
if (!param) {
console.error(`\nConfig param '${name}' missing\n`);
return null;
}
return param;
};
//Provider configs
export const NETWORK_RPC_URL = getParam("NETWORK_RPC_URL");
export const CHAIN_ID = parseInt(getParam("CHAIN_ID")!);
export const NETWORK_NAME = getParam("NETWORK_NAME");
export const REGISTRY_CONTRACT_ADDRESS = getParam("REGISTRY_CONTRACT_ADDRESS");
//Keys
export const ISSUER_EDDSA_PRIVATE_KEY =
getParam("ISSUER_EDDSA_PRIVATE_KEY") ||
getEddsaPrivateKey("ISSUER_EDDSA_PRIVATE_KEY");
export const ISSUER_ES256K_PRIVATE_KEY =
getParam("ISSUER_ES256K_PRIVATE_KEY") ||
getEs256kPrivateKey("ISSUER_ES256K_PRIVATE_KEY");
export const HOLDER_EDDSA_PRIVATE_KEY =
getParam("HOLDER_EDDSA_PRIVATE_KEY") ||
getEddsaPrivateKey("HOLDER_EDDSA_PRIVATE_KEY");
export const HOLDER_ES256K_PRIVATE_KEY =
getParam("HOLDER_ES256K_PRIVATE_KEY") ||
getEs256kPrivateKey("HOLDER_ES256K_PRIVATE_KEY");
//VC configs
export const VC_SCHEMA_URL = getParam("VC_SCHEMA_URL");
export const VC_DIR_PATH =
getParam("VC_DIR_PATH") || "./src/verifiable_credentials";
export const VC = getParam("VC");
export const VC_ES256K_PRIVATE_KEY = getParam("VC_ES256K_PRIVATE_KEY");
//VP configs
export const VP_DIR_PATH =
getParam("VP_DIR_PATH") || "./src/verifiable_presentation";
export const VP = getParam("VP");
export const provider = new ethers.providers.JsonRpcProvider(NETWORK_RPC_URL!);
export const ethrProvider = {
name: NETWORK_NAME!,
chainId: CHAIN_ID,
rpcUrl: NETWORK_RPC_URL!,
registry: REGISTRY_CONTRACT_ADDRESS!,
gasSource: "",
};
export interface JwtPayload {
[key: string]: any;
iss?: string | undefined;
sub?: string | undefined;
aud?: string | string[] | undefined;
exp?: number | undefined;
nbf?: number | undefined;
iat?: number | undefined;
jti?: string | undefined;
}