Commit 5149f71f authored by Sietse Ringers's avatar Sietse Ringers
Browse files

refactor: rename some variables of keyshare secret methods

parent c13ece86
......@@ -75,13 +75,13 @@ func (s *unencryptedUserSecrets) setID(id [32]byte) {
}
func (c *Core) encryptUserSecrets(secrets unencryptedUserSecrets) (UserSecrets, error) {
var result UserSecrets
var encSecret UserSecrets
// Store key id
binary.LittleEndian.PutUint32(result[0:], c.decryptionKeyID)
binary.LittleEndian.PutUint32(encSecret[0:], c.decryptionKeyID)
// Generate and store nonce
_, err := rand.Read(result[4:16])
_, err := rand.Read(encSecret[4:16])
if err != nil {
return UserSecrets{}, err
}
......@@ -91,9 +91,9 @@ func (c *Core) encryptUserSecrets(secrets unencryptedUserSecrets) (UserSecrets,
if err != nil {
return UserSecrets{}, err
}
gcm.Seal(result[:16], result[4:16], secrets[:], nil)
gcm.Seal(encSecret[:16], encSecret[4:16], secrets[:], nil)
return result, nil
return encSecret, nil
}
func (c *Core) decryptUserSecrets(secrets UserSecrets) (unencryptedUserSecrets, error) {
......@@ -111,12 +111,12 @@ func (c *Core) decryptUserSecrets(secrets UserSecrets) (unencryptedUserSecrets,
if err != nil {
return unencryptedUserSecrets{}, err
}
var result unencryptedUserSecrets
_, err = gcm.Open(result[:0], secrets[4:16], secrets[16:], nil)
var unencSecret unencryptedUserSecrets
_, err = gcm.Open(unencSecret[:0], secrets[4:16], secrets[16:], nil)
if err != nil {
return unencryptedUserSecrets{}, err
}
return result, nil
return unencSecret, nil
}
func (c *Core) decryptUserSecretsIfPinOK(secrets UserSecrets, pin string) (unencryptedUserSecrets, error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment