-
Notifications
You must be signed in to change notification settings - Fork 23
/
common.go
117 lines (96 loc) · 3.56 KB
/
common.go
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package types
// Supported method-specific-id Formats
const MSIBlockchainAccountId = "MSIBlockchainAccountId"
const MSINonBlockchainAccountId = "MSINonBlockchainAccountId"
// Supported Verification Method Types
const Ed25519VerificationKey2020 = "Ed25519VerificationKey2020"
const EcdsaSecp256k1VerificationKey2019 = "EcdsaSecp256k1VerificationKey2019"
const EcdsaSecp256k1RecoveryMethod2020 = "EcdsaSecp256k1RecoveryMethod2020"
// Mapping between Verification Key and its corresponding Signature
var VerificationKeySignatureMap = map[string]string{
Ed25519VerificationKey2020: "Ed25519Signature2020",
EcdsaSecp256k1VerificationKey2019: "EcdsaSecp256k1Signature2019",
EcdsaSecp256k1RecoveryMethod2020: "EcdsaSecp256k1RecoverySignature2020",
}
var supportedVerificationMethodTypes []string = func() []string {
result := []string{}
for vmType := range VerificationKeySignatureMap {
result = append(result, vmType)
}
return result
}()
// Supported Service Types
var SupportedServiceTypes = []string{
"LinkedDomains",
}
// Did Document ID
const DocumentIdentifierDid = "did"
const DidMethod = "hid"
// CAIP-10 prefixes
const EthereumCAIP10Prefix string = "eip155" // Ethereum Based Chains
const CosmosCAIP10Prefix string = "cosmos" // Cosmos Based Chains
// Supported CAIP-10 prefixes
var CAIP10PrefixForEcdsaSecp256k1RecoveryMethod2020 []string = []string{
EthereumCAIP10Prefix,
}
var CAIP10PrefixForEcdsaSecp256k1VerificationKey2019 []string = []string{
CosmosCAIP10Prefix,
}
const ADR036ClientSpec string = "cosmos-ADR036"
const PersonalSignClientSpec string = "eth-personalSign"
// Supported Client Specs
var SupportedClientSpecs []string = []string{
ADR036ClientSpec,
PersonalSignClientSpec,
}
// Supported CAIP-10 Prefixes
var SupportedCAIP10Prefixes = []string{
EthereumCAIP10Prefix,
CosmosCAIP10Prefix,
}
var SupportedCAIP10EthereumChainIds = []string{
// Ethereum-Based Mainnet Chains
"1", // Ethereum Mainnet
"137", // Polygon Mainnet
"56", // Binance Smart Chain
// Ethereum-Based Testnet Chains
"3", // Ropsten (Ethereum Testnet)
"4", // Rinkeby (Ethereum Testnet)
"5", // Goerli (Ethereum Testnet)
"80001", // Polygon Mumbai Testnet
"97", // Binance Smart Chain Testnet
}
var SupportedCAIP10CosmosChainIds = []string{
"cosmoshub-4", // Cosmos Hub
"osmosis-1", // Osmosis
"akashnet-2", // Akash
"stargaze-1", // Stargaze
"core-1", // Persistence
"crypto-org-chain-mainnet-1", // Crypto.Org Chain
"theta-testnet-001", // Cosmos Hub Theta Testnet
"osmo-test-4", // Osmosis Testnet
"elgafar-1", // Stargaze Testnet
"test-core-1", // Persistence Testnet
"jagrat", // Hypersign Identity Network - Jagrat Testnet
}
// Map between supported cosmos chain-id and their respective blockhchain address prefix
var CosmosCAIP10ChainIdBech32PrefixMap = map[string]string{
// Mainnet Chains
"cosmoshub-4": "cosmos",
"osmosis-1": "osmo",
"akashnet-2": "akash",
"stargaze-1": "stars",
"core-1": "persistence",
"crypto-org-chain-mainnet-1": "cro",
// Testnet Chains
"theta-testnet-001": "cosmos",
"osmo-test-4": "osmo",
"elgafar-1": "stars",
"test-core-1": "persistence",
"jagrat": "hid",
}
// Map between support CAIP-10 prefix and list of chain-ids
var SupportedCAIP10PrefixChainIdsMap = map[string][]string{
EthereumCAIP10Prefix: SupportedCAIP10EthereumChainIds,
CosmosCAIP10Prefix: SupportedCAIP10CosmosChainIds,
}