2020-08-17 09:03:52 +00:00
|
|
|
package refs
|
|
|
|
|
|
|
|
type OwnerID struct {
|
|
|
|
val []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type ContainerID struct {
|
|
|
|
val []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type ObjectID struct {
|
|
|
|
val []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type Address struct {
|
|
|
|
cid *ContainerID
|
|
|
|
|
|
|
|
oid *ObjectID
|
|
|
|
}
|
|
|
|
|
2020-08-20 07:59:45 +00:00
|
|
|
type Checksum struct {
|
|
|
|
typ ChecksumType
|
|
|
|
|
|
|
|
sum []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type ChecksumType uint32
|
|
|
|
|
2022-02-22 11:25:43 +00:00
|
|
|
type SignatureScheme uint32
|
|
|
|
|
2022-02-25 07:36:46 +00:00
|
|
|
//nolint:revive
|
2022-02-22 11:25:43 +00:00
|
|
|
const (
|
2022-03-02 10:15:36 +00:00
|
|
|
ECDSA_SHA512 SignatureScheme = iota
|
2022-02-22 11:25:43 +00:00
|
|
|
ECDSA_RFC6979_SHA256
|
2022-03-15 13:54:47 +00:00
|
|
|
ECDSA_RFC6979_SHA256_WALLET_CONNECT
|
2022-02-22 11:25:43 +00:00
|
|
|
)
|
|
|
|
|
2020-08-20 09:43:47 +00:00
|
|
|
type Signature struct {
|
|
|
|
key, sign []byte
|
2022-02-22 11:25:43 +00:00
|
|
|
scheme SignatureScheme
|
2020-08-20 09:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Version struct {
|
|
|
|
major, minor uint32
|
|
|
|
}
|
|
|
|
|
2020-08-20 07:59:45 +00:00
|
|
|
const (
|
|
|
|
UnknownChecksum ChecksumType = iota
|
|
|
|
TillichZemor
|
|
|
|
SHA256
|
|
|
|
)
|
|
|
|
|
2020-08-17 09:03:52 +00:00
|
|
|
func (o *OwnerID) GetValue() []byte {
|
|
|
|
if o != nil {
|
|
|
|
return o.val
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *OwnerID) SetValue(v []byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
o.val = v
|
2020-08-17 09:03:52 +00:00
|
|
|
}
|
|
|
|
|
2020-08-17 10:39:21 +00:00
|
|
|
func (c *ContainerID) GetValue() []byte {
|
|
|
|
if c != nil {
|
|
|
|
return c.val
|
2020-08-17 09:03:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-08-17 10:39:21 +00:00
|
|
|
func (c *ContainerID) SetValue(v []byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
c.val = v
|
2020-08-17 09:03:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ObjectID) GetValue() []byte {
|
|
|
|
if o != nil {
|
|
|
|
return o.val
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (o *ObjectID) SetValue(v []byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
o.val = v
|
2020-08-17 09:03:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Address) GetContainerID() *ContainerID {
|
|
|
|
if a != nil {
|
|
|
|
return a.cid
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Address) SetContainerID(v *ContainerID) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.cid = v
|
2020-08-17 09:03:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Address) GetObjectID() *ObjectID {
|
|
|
|
if a != nil {
|
|
|
|
return a.oid
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Address) SetObjectID(v *ObjectID) {
|
2022-03-23 11:42:57 +00:00
|
|
|
a.oid = v
|
2020-08-17 09:03:52 +00:00
|
|
|
}
|
2020-08-20 07:59:45 +00:00
|
|
|
|
|
|
|
func (c *Checksum) GetType() ChecksumType {
|
|
|
|
if c != nil {
|
|
|
|
return c.typ
|
|
|
|
}
|
|
|
|
|
|
|
|
return UnknownChecksum
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Checksum) SetType(v ChecksumType) {
|
2022-03-23 11:42:57 +00:00
|
|
|
c.typ = v
|
2020-08-20 07:59:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Checksum) GetSum() []byte {
|
|
|
|
if c != nil {
|
|
|
|
return c.sum
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Checksum) SetSum(v []byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
c.sum = v
|
2020-08-20 07:59:45 +00:00
|
|
|
}
|
2020-08-20 09:43:47 +00:00
|
|
|
|
|
|
|
func (s *Signature) GetKey() []byte {
|
|
|
|
if s != nil {
|
|
|
|
return s.key
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Signature) SetKey(v []byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
s.key = v
|
2020-08-20 09:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Signature) GetSign() []byte {
|
|
|
|
if s != nil {
|
|
|
|
return s.sign
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Signature) SetSign(v []byte) {
|
2022-03-23 11:42:57 +00:00
|
|
|
s.sign = v
|
2020-08-20 09:43:47 +00:00
|
|
|
}
|
|
|
|
|
2022-02-22 11:25:43 +00:00
|
|
|
func (s *Signature) GetScheme() SignatureScheme {
|
|
|
|
if s != nil {
|
|
|
|
return s.scheme
|
|
|
|
}
|
2022-03-02 10:15:36 +00:00
|
|
|
return 0
|
2022-02-22 11:25:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Signature) SetScheme(scheme SignatureScheme) {
|
2022-03-23 11:42:57 +00:00
|
|
|
s.scheme = scheme
|
2022-02-22 11:25:43 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 09:43:47 +00:00
|
|
|
func (v *Version) GetMajor() uint32 {
|
|
|
|
if v != nil {
|
|
|
|
return v.major
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v *Version) SetMajor(val uint32) {
|
2022-03-23 11:42:57 +00:00
|
|
|
v.major = val
|
2020-08-20 09:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *Version) GetMinor() uint32 {
|
|
|
|
if v != nil {
|
|
|
|
return v.minor
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (v *Version) SetMinor(val uint32) {
|
2022-03-23 11:42:57 +00:00
|
|
|
v.minor = val
|
2020-08-20 09:43:47 +00:00
|
|
|
}
|