[client:client] fixed migration validation
This commit is contained in:
parent
50d17723f8
commit
0b24036360
|
@ -107,10 +107,8 @@ func (c *T) Receive(r io.Reader) error {
|
||||||
|
|
||||||
/* (1) If pending migration -> migrate */
|
/* (1) If pending migration -> migrate */
|
||||||
if c.key.MigrationCode() == 2 {
|
if c.key.MigrationCode() == 2 {
|
||||||
c.key.MigrationCode(3)
|
c.migrateKey()
|
||||||
if DEBUG {
|
if DEBUG { fmt.Printf("*** VALIDATED MIGRATION\n") }
|
||||||
fmt.Printf("*** VALIDATED MIGRATION\n")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (2) No error anyway */
|
/* (2) No error anyway */
|
||||||
|
@ -136,9 +134,7 @@ func (c *T) Receive(r io.Reader) error {
|
||||||
err = c.rescue(y1, y2)
|
err = c.rescue(y1, y2)
|
||||||
if err != nil { return err }
|
if err != nil { return err }
|
||||||
|
|
||||||
/* (4) Reset key to not consumed */
|
if DEBUG { fmt.Printf("*** MIGRATION PREPARED\n") }
|
||||||
c.key.MigrationCode(0)
|
|
||||||
c.updateConfig()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
|
|
|
@ -328,10 +328,11 @@ func (c *T) rescue(y1 []byte, y2 []byte) error {
|
||||||
/* (4) Get the received hash */
|
/* (4) Get the received hash */
|
||||||
receivedHash := xor.ByteArray(y1, hashedTimeId)
|
receivedHash := xor.ByteArray(y1, hashedTimeId)
|
||||||
|
|
||||||
/* (4) Try to rescue the key */
|
/* (5) Try to rescue the key */
|
||||||
err = c.key.Rescue(receivedHash)
|
err = c.key.Rescue(receivedHash)
|
||||||
if err != nil { return err }
|
if err != nil { return err }
|
||||||
|
|
||||||
|
/* (6) Store updated key */
|
||||||
c.updateConfig()
|
c.updateConfig()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue