-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.go
51 lines (41 loc) · 1.02 KB
/
address.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
package go_mhda
const (
// Derivation algorithms
Secp256k1 = Algorithm(`secp256k1`)
Ed25519 = Algorithm(`ed25519`)
Sr25519 = Algorithm(`sr25519`) // Polkadot https://wiki.polkadot.network/docs/learn-account-advanced
Secp256r1 = Algorithm(`secp256r1`) // SUI https://docs.sui.io/learn/cryptography/sui-wallet-specs
Secp384r1 = Algorithm(`secp384r1`)
Secp521r1 = Algorithm(`secp521r1`)
Prime256v1 = Algorithm(`prime256v1`) // OpenSSL
// Address formats
HEX = Format(`hex`)
P2PKH = Format(`p2pkh`)
P2S4 = Format(`p2s4`)
P2WPKH = Format(`p2wpkh`)
Bech32 = Format(`bech32`)
Base58 = Format(`base58`)
SS58 = Format(`ss58`)
)
type Algorithm string
type Format string
var (
indexAlgorithms = map[Algorithm]bool{
Secp256k1: true,
Ed25519: true,
Sr25519: true,
Secp256r1: true,
Secp384r1: true,
Secp521r1: true,
Prime256v1: true,
}
indexFormats = map[Format]bool{
HEX: true,
P2PKH: true,
P2S4: true,
P2WPKH: true,
Bech32: true,
Base58: true,
SS58: true,
}
)