diff --git a/src/git.xdrm.io/schastsp/client/keyset/keyset.go b/src/git.xdrm.io/schastsp/client/keyset/keyset.go index 0a44ac7..4cf6119 100644 --- a/src/git.xdrm.io/schastsp/client/keyset/keyset.go +++ b/src/git.xdrm.io/schastsp/client/keyset/keyset.go @@ -19,7 +19,7 @@ type Set struct { max uint16 // max depth sec []byte // secret - consumption uint // consumption level + consumption uint8 // consumption level // 0: none // 1: need to migrate // 2: waiting migration @@ -123,6 +123,15 @@ func (s *Set) Decrement() uint16 { } + +/* (5) Prepare a renewal +* +* @return level outDesc +* +---------------------------------------------------------*/ + + + /* (5) Serialisation * * @return serial String representation @@ -155,6 +164,10 @@ func (s *Set) Store(writer io.Writer) error { err = binary.Write(writer, binary.BigEndian, s.depth) if err != nil { return err } + /* (4) Copy migration level */ + err = binary.Write(writer, binary.BigEndian, s.consumption) + if err != nil { return err } + return nil } @@ -200,6 +213,10 @@ func (s *Set) Fetch(reader io.Reader) error { err = binary.Read(reader, binary.BigEndian, &s.depth) if err != nil { return err } + /* (6) Try to copy the consumption level */ + err = binary.Read(reader, binary.BigEndian, &s.consumption) + if err != nil { return err } + return nil }