security/blessingstore: Remove old serialization format that should
not be used anywhere by now.
Change-Id: I39742e1bae4533b7035237302a3cf6f58dda0783
diff --git a/lib/security/blessingstore.go b/lib/security/blessingstore.go
index 8397294..5ff62b7 100644
--- a/lib/security/blessingstore.go
+++ b/lib/security/blessingstore.go
@@ -27,25 +27,6 @@
errDataOrSignerUnspecified = verror.Register(pkgPath+".errDataOrSignerUnspecified", verror.NoRetry, "{1:}{2:} persisted data or signer is not specified{:_}")
)
-// TODO(ataly, ashankar): Get rid of this struct once we have switched all
-// credentials directories to the new serialization format.
-type blessings struct {
- Value security.Blessings
-}
-
-// TODO(ataly, ashankar): Get rid of this struct once we have switched all
-// credentials directories to the new serialization format.
-type state struct {
- // Store maps BlessingPatterns to the Blessings object that is to be shared
- // with peers which present blessings of their own that match the pattern.
- //
- // All blessings bind to the same public key.
- Store map[security.BlessingPattern]*blessings
- // Default is the default Blessings to be shared with peers for which
- // no other information is available to select blessings.
- Default *blessings
-}
-
// blessingStore implements security.BlessingStore.
type blessingStore struct {
publicKey security.PublicKey
@@ -193,45 +174,6 @@
return nil
}
-// TODO(ataly, ashankar): Get rid of this method once we have switched all
-// credentials directories to the new serialization format.
-func (bs *blessingStore) deserializeOld() error {
- data, signature, err := bs.serializer.Readers()
- if err != nil {
- return err
- }
- if data == nil && signature == nil {
- return nil
- }
-
- var old state
- if err := decodeFromStorage(&old, data, signature, bs.signer.PublicKey()); err != nil {
- return err
- }
-
- for p, wb := range old.Store {
- if wb != nil {
- bs.state.PeerBlessings[p] = wb.Value
- }
- }
- if old.Default != nil {
- bs.state.DefaultBlessings = old.Default.Value
- }
-
- if err := bs.verifyState(); err != nil {
- return err
- }
-
- // Save the blessingstore in the new serialization format. This will ensure
- // that all credentials directories in the old format will switch to the new
- // format.
- if err := bs.save(); err != nil {
- return err
- }
-
- return nil
-}
-
func (bs *blessingStore) deserialize() error {
data, signature, err := bs.serializer.Readers()
if err != nil {
@@ -241,7 +183,7 @@
return nil
}
if err := decodeFromStorage(&bs.state, data, signature, bs.signer.PublicKey()); err != nil {
- return bs.deserializeOld()
+ return err
}
return bs.verifyState()
}