-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathparameters.go
54 lines (41 loc) · 1.87 KB
/
parameters.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
package mnemonikey
import (
"time"
)
// EpochIncrement is the level of granularity available for the creation date of
// keys generated by mnemonikey.
const EpochIncrement = time.Second
// EpochStart is the start of the epoch after which key creation times are encoded
// in recovery phrases. It is exactly midnight in UTC time on the new year's eve
// between 2022 and 2023.
//
// In unix time, this epoch is exactly 1672531200 seconds after the unix epoch.
var EpochStart = time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC)
const (
// MnemonicVersionLatest is the latest known mnemonikey version number. Backups encoded with versions higher
// than this number will fail to decode.
MnemonicVersionLatest MnemonicVersion = 1
// EraLatest is the latest known mnemonikey era number.
EraLatest Era = 0
)
const (
// MnemonicVersionBitCount is the number of bits in the backup payload reserved for the version number.
MnemonicVersionBitCount uint = 4
// CreationOffsetBitCount is the number of bits used to represent a key creation offset.
CreationOffsetBitCount uint = 31
// ChecksumBitCount is the number of bits in the backup payload reserved for the checksum.
ChecksumBitCount uint = 5
// EntropyBitCount is the number of bits of entropy in the seed used to derive PGP keys.
EntropyBitCount = 128
// SaltBitCount is the number of bits of salt used for seed encryption keys.
SaltBitCount uint = 19
// EncSeedVerifyBitCount is the number of bits used for seed encryption key validation.
EncSeedVerifyBitCount uint = 5
)
const (
checksumMask = (1 << ChecksumBitCount) - 1
encSeedVerifyMask = (1 << EncSeedVerifyBitCount) - 1
)
// MaxCreationTime is the farthest point in the future that the mnemonikey recovery phrase
// encoding algorithm can represent key creation timestamps for.
var MaxCreationTime = EpochStart.Add(EpochIncrement * (time.Duration(1<<CreationOffsetBitCount) - 1))