[client.keyset] added Getter and Setter 'MigrationCode(<uint8|nil>) uint8' for migration code

This commit is contained in:
xdrm-brackets 2018-04-22 18:44:03 +02:00
parent 8ef698f4c3
commit 27dcb81e5f
1 changed files with 23 additions and 0 deletions

View File

@ -183,3 +183,26 @@ func (s *T) Fetch(reader io.Reader) error {
return nil
}
/* (6) Getter/Setter for migration code 'mcode'
*
* @mcode<uint8> [OPT] New value
*
* @return mcode<uint8> Migration code
*
---------------------------------------------------------*/
func (s T) MigrationCode(optional... uint8) uint8 {
/* (1) If no valid code given -> return current one */
if len(optional) < 1 || optional[0] > 3 {
return s.mcode
}
/* (2) Set new code */
s.mcode = optional[0]
/* (3) Return new code */
return s.mcode
}