Fix login-with-device approval

This commit is contained in:
Bernd Schoolmann 2023-09-04 17:47:52 +02:00
parent e840b22145
commit 31cf9746d5
No known key found for this signature in database

View File

@ -63,10 +63,10 @@ func CreateAuthResponse(ctx context.Context, authRequest AuthRequestData, keyrin
if err != nil { if err != nil {
return authRequestResponse, err return authRequestResponse, err
} }
masterPasswordHash, err := config.GetMasterPasswordHash() //masterPasswordHash, err := config.GetMasterPasswordHash()
if err != nil { //if err != nil {
return authRequestResponse, err // return authRequestResponse, err
} //}
publicKey, err := base64.StdEncoding.DecodeString(authRequest.PublicKey) publicKey, err := base64.StdEncoding.DecodeString(authRequest.PublicKey)
requesterKey, err := crypto.AssymmetricEncryptionKeyFromBytes(publicKey) requesterKey, err := crypto.AssymmetricEncryptionKeyFromBytes(publicKey)
@ -75,16 +75,15 @@ func CreateAuthResponse(ctx context.Context, authRequest AuthRequestData, keyrin
if err != nil { if err != nil {
panic(err) panic(err)
} }
encryptedMasterPasswordHash, err := crypto.EncryptWithAsymmetric(masterPasswordHash, requesterKey) //encryptedMasterPasswordHash, err := crypto.EncryptWithAsymmetric(masterPasswordHash, requesterKey)
if err != nil { //if err != nil {
panic(err) // panic(err)
} //}
err = authenticatedHTTPPut(ctx, config.ConfigFile.ApiUrl+"/auth-requests/"+authRequest.ID, &authRequestResponse, AuthRequestResponseData{ err = authenticatedHTTPPut(ctx, config.ConfigFile.ApiUrl+"/auth-requests/"+authRequest.ID, &authRequestResponse, AuthRequestResponseData{
DeviceIdentifier: config.ConfigFile.DeviceUUID, DeviceIdentifier: config.ConfigFile.DeviceUUID,
Key: string(encryptedUserSymmetricKey), Key: string(encryptedUserSymmetricKey),
MasterPasswordHash: string(encryptedMasterPasswordHash), Requestapproved: true,
Requestapproved: true,
}) })
return authRequestResponse, err return authRequestResponse, err
} }