/
secret_free.go
71 lines (52 loc) · 1.24 KB
/
secret_free.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
package keypair
import . "github.com/yu-org/yu/common"
type FreePubkey struct{}
func (s *FreePubkey) Type() string {
return SecretFree
}
func (s *FreePubkey) Equals(key Key) bool {
_, ok := key.(*FreePubkey)
return ok
}
func (s *FreePubkey) Bytes() []byte {
return nil
}
func (s *FreePubkey) String() string {
return ToHex(s.Bytes())
}
func (s *FreePubkey) BytesWithType() []byte {
return append([]byte(SecretFreeIdx), s.Bytes()...)
}
func (s *FreePubkey) StringWithType() string {
return ToHex(s.BytesWithType())
}
func (s *FreePubkey) Address() Address {
return NullAddress
}
func (s *FreePubkey) VerifySignature(msg, sig []byte) bool {
return true
}
// ------ Private key ------
type FreePrivkey struct{}
func (f *FreePrivkey) Type() string {
return SecretFree
}
func (f *FreePrivkey) Equals(key Key) bool {
_, ok := key.(*FreePrivkey)
return ok
}
func (f *FreePrivkey) Bytes() []byte {
return nil
}
func (f *FreePrivkey) String() string {
return ToHex(f.Bytes())
}
func (f *FreePrivkey) BytesWithType() []byte {
return append([]byte(SecretFreeIdx), f.Bytes()...)
}
func (f *FreePrivkey) StringWithType() string {
return ToHex(f.BytesWithType())
}
func (f *FreePrivkey) SignData(bytes []byte) ([]byte, error) {
return nil, nil
}