and key size
This commit is contained in:
parent
3a7f25020a
commit
391c5b1eeb
3 changed files with 10 additions and 3 deletions
|
|
@ -6,11 +6,14 @@ import (
|
|||
)
|
||||
|
||||
type LuxKey struct {
|
||||
Type proto.LuxType
|
||||
Id proto.LuxID
|
||||
Key []byte
|
||||
Type proto.LuxType // 2
|
||||
Id proto.LuxID // 16
|
||||
Key []byte // 32
|
||||
}
|
||||
|
||||
const LUX_KEY_AES_SIZE = 32
|
||||
const LUX_PROTO_KEY_SIZE = proto.LUX_PROTO_TYPE_SIZE + proto.LUX_PROTO_ID_SIZE + LUX_KEY_AES_SIZE
|
||||
|
||||
func (key *LuxKey) NewLuxKey(keyType proto.LuxType) error {
|
||||
key.Type = keyType
|
||||
key.Id = proto.NewLuxID()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import "github.com/google/uuid"
|
|||
|
||||
type LuxID struct{ uuid.UUID }
|
||||
|
||||
const LUX_PROTO_ID_SIZE = 16
|
||||
|
||||
func NewLuxID() LuxID {
|
||||
return LuxID{uuid.New()}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ const (
|
|||
LuxTypeNode
|
||||
)
|
||||
|
||||
const LUX_PROTO_TYPE_SIZE = 2
|
||||
|
||||
func (luxType *LuxType) Read(rd *LuxBuffer) error {
|
||||
if val, err := rd.ReadUint16(); err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue