Skip to content

Commit

Permalink
Updated change email request.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Jan 11, 2024
1 parent a999e0c commit 89b7a52
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 23 deletions.
56 changes: 38 additions & 18 deletions internalsdk/protos/auth.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions internalsdk/session_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -1377,10 +1377,25 @@ func changeEmail(session SessionModel, email string, newEmail string, password s
return log.Errorf("user_not_found error while generating client proof %v", err)
}

// Create new salt and verifier with new email and new slat
newsalt, err := GenerateSalt()
if err != nil {
return err
}
log.Debugf("Slat %v and length %v", newsalt, len(newsalt))

srpClient := srp.NewSRPClient(srp.KnownGroups[group], GenerateEncryptedKey(password, newEmail, newsalt), nil)
verifierKey, err := srpClient.Verifier()
if err != nil {
return err
}

changeEmailRequestBody := &protos.ChangeEmailRequest{
OldEmail: email,
NewEmail: newEmail,
Proof: clientProof,
OldEmail: email,
NewEmail: newEmail,
Proof: clientProof,
NewSalt: newsalt,
NewVerifier: verifierKey.Bytes(),
}

isEmailChanged, err := apimodels.ChangeEmail(changeEmailRequestBody)
Expand Down
4 changes: 2 additions & 2 deletions lib/plans/checkout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class _CheckoutState extends State<Checkout>
case 'stripe':
widgets.add(
PaymentProvider(
logoPaths: [
logoPaths: const [
ImagePaths.visa,
ImagePaths.mastercard,
ImagePaths.unionpay
Expand Down Expand Up @@ -169,7 +169,7 @@ class _CheckoutState extends State<Checkout>
case 'btcpay':
widgets.add(
PaymentProvider(
logoPaths: [ImagePaths.btc],
logoPaths: const [ImagePaths.btc],
onChanged: () => selectPaymentProvider(Providers.btcpay),
selectedPaymentProvider: selectedPaymentProvider!,
paymentType: Providers.btcpay,
Expand Down
2 changes: 2 additions & 0 deletions protos_shared/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ message ChangeEmailRequest {
string old_email = 1;
string new_email = 2;
bytes proof = 3;
bytes new_salt = 4;
bytes new_verifier = 5;
}

// POST /users/delete
Expand Down

0 comments on commit 89b7a52

Please sign in to comment.