mirror of
https://github.com/quexten/goldwarden.git
synced 2024-11-23 21:44:37 +03:00
Merge pull request #169 from quexten/fix/spelling
Fix symmetric crypto key spelling
This commit is contained in:
commit
1feeb102e6
@ -64,17 +64,17 @@ func sync(ctx context.Context, vault *vault.Vault, cfg *config.Config) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var protectedUserSymetricKey crypto.SymmetricEncryptionKey
|
||||
var protectedUserSymmetricKey crypto.SymmetricEncryptionKey
|
||||
if vault.Keyring.IsMemguard {
|
||||
protectedUserSymetricKey, err = crypto.MemguardSymmetricEncryptionKeyFromBytes(userSymmetricKey)
|
||||
protectedUserSymmetricKey, err = crypto.MemguardSymmetricEncryptionKeyFromBytes(userSymmetricKey)
|
||||
} else {
|
||||
protectedUserSymetricKey, err = crypto.MemorySymmetricEncryptionKeyFromBytes(userSymmetricKey)
|
||||
protectedUserSymmetricKey, err = crypto.MemorySymmetricEncryptionKeyFromBytes(userSymmetricKey)
|
||||
}
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, cfg, &protectedUserSymetricKey, true)
|
||||
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, cfg, &protectedUserSymmetricKey, true)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
@ -106,11 +106,11 @@ func handleLogin(msg messages.IPCMessage, cfg *config.Config, vault *vault.Vault
|
||||
err = cfg.SetUserSymmetricKey(vault.Keyring.GetAccountKey().Bytes())
|
||||
err = cfg.SetMasterPasswordHash([]byte(masterpasswordHash))
|
||||
err = cfg.SetMasterKey([]byte(masterKey.GetBytes()))
|
||||
var protectedUserSymetricKey crypto.SymmetricEncryptionKey
|
||||
var protectedUserSymmetricKey crypto.SymmetricEncryptionKey
|
||||
if vault.Keyring.IsMemguard {
|
||||
protectedUserSymetricKey, err = crypto.MemguardSymmetricEncryptionKeyFromBytes(vault.Keyring.GetAccountKey().Bytes())
|
||||
protectedUserSymmetricKey, err = crypto.MemguardSymmetricEncryptionKeyFromBytes(vault.Keyring.GetAccountKey().Bytes())
|
||||
} else {
|
||||
protectedUserSymetricKey, err = crypto.MemorySymmetricEncryptionKeyFromBytes(vault.Keyring.GetAccountKey().Bytes())
|
||||
protectedUserSymmetricKey, err = crypto.MemorySymmetricEncryptionKeyFromBytes(vault.Keyring.GetAccountKey().Bytes())
|
||||
}
|
||||
if err != nil {
|
||||
defer func() {
|
||||
@ -129,7 +129,7 @@ func handleLogin(msg messages.IPCMessage, cfg *config.Config, vault *vault.Vault
|
||||
}
|
||||
return
|
||||
}
|
||||
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, cfg, &protectedUserSymetricKey, false)
|
||||
err = bitwarden.DoFullSync(context.WithValue(ctx, bitwarden.AuthToken{}, token.AccessToken), vault, cfg, &protectedUserSymmetricKey, false)
|
||||
|
||||
response, err = messages.IPCMessageFromPayload(messages.ActionResponse{
|
||||
Success: true,
|
||||
|
@ -29,9 +29,9 @@ func handleAddSSH(msg messages.IPCMessage, cfg *config.Config, vault *vault.Vaul
|
||||
actionsLog.Warn(err.Error())
|
||||
}
|
||||
ctx := context.WithValue(context.TODO(), bitwarden.AuthToken{}, token.AccessToken)
|
||||
ciph, err := bitwarden.PostCipher(ctx, cipher, cfg)
|
||||
postedCipher, err := bitwarden.PostCipher(ctx, cipher, cfg)
|
||||
if err == nil {
|
||||
vault.AddOrUpdateSecureNote(ciph)
|
||||
vault.AddOrUpdateSecureNote(postedCipher)
|
||||
} else {
|
||||
actionsLog.Warn("Error posting ssh key cipher: " + err.Error())
|
||||
}
|
||||
|
@ -113,11 +113,11 @@ func (key MemguardSymmetricEncryptionKey) MacKeyBytes() ([]byte, error) {
|
||||
return keyBytes, nil
|
||||
}
|
||||
|
||||
func MemoryAssymmetricEncryptionKeyFromBytes(key []byte) (MemoryAsymmetricEncryptionKey, error) {
|
||||
func MemoryAsymmetricEncryptionKeyFromBytes(key []byte) (MemoryAsymmetricEncryptionKey, error) {
|
||||
return MemoryAsymmetricEncryptionKey{key}, nil
|
||||
}
|
||||
|
||||
func MemguardAssymmetricEncryptionKeyFromBytes(key []byte) (MemguardAsymmetricEncryptionKey, error) {
|
||||
func MemguardAsymmetricEncryptionKeyFromBytes(key []byte) (MemguardAsymmetricEncryptionKey, error) {
|
||||
k := memguard.NewEnclave(key)
|
||||
return MemguardAsymmetricEncryptionKey{k}, nil
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ func CreateAuthResponse(ctx context.Context, authRequest AuthRequestData, keyrin
|
||||
if err != nil {
|
||||
return AuthRequestResponseData{}, err
|
||||
}
|
||||
requesterKey, err := crypto.MemoryAssymmetricEncryptionKeyFromBytes(publicKey)
|
||||
requesterKey, err := crypto.MemoryAsymmetricEncryptionKeyFromBytes(publicKey)
|
||||
if err != nil {
|
||||
return AuthRequestResponseData{}, err
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ func SetPin(useMemguard bool, pin []byte) {
|
||||
func GetPin() ([]byte, error) {
|
||||
approved := biometrics.CheckBiometrics(biometrics.SSHKey)
|
||||
if approved {
|
||||
bufer, err := cachedPin.Open()
|
||||
buffer, err := cachedPin.Open()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bufer.Bytes(), nil
|
||||
return buffer.Bytes(), nil
|
||||
} else {
|
||||
return nil, errors.New("biometrics not approved")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user