-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathowner.go
47 lines (41 loc) · 844 Bytes
/
owner.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
package gitkeys
import (
"bytes"
"crypto/sha512"
)
// owner ...
type owner struct {
name string
empty bool
keySET *keySET
checksum [sha512.Size]byte
}
// checkSum ...
func (o *owner) checkSum() {
var buf bytes.Buffer
if o.name == _empty {
out("[internal-error] [checkSum] owner empty")
}
buf.WriteString(o.name)
if !o.empty {
buf.WriteString(o.keySET.String())
}
o.checksum = sha512.Sum512(buf.Bytes())
}
// getOwnerUrl ...
// func getOwnerUrl(owner string) string {
// return _urlprefix + owner
// }
// newOwner ..
// func newOwner() *owner {
// return &owner{
// empty: true,
// keySET: newKeySET(),
// checksum: [sha512.Size]byte{},
// }
// }
// valid ...
// func (o *owner) valid(newCheckSum [sha512.Size]byte) bool {
// o.checkSum()
// return bytes.Equal(o.checksum[:], newCheckSum[:])
// }