Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Move CICO provider url composition server-side #74

Merged
merged 24 commits into from
Mar 11, 2021

Conversation

tarikbellamine
Copy link
Contributor

@tarikbellamine tarikbellamine commented Mar 2, 2021

Description

Moving all provider API keys server-side for better security and ease of future key rotation.

Other changes

  • Formatting asset codes on ProviderOptionsScreen to dry up code
  • Added Ramp API key to enable debit card purchases

Tested

Manually

Related issues

Backwards compatibility

Yes

@tarikbellamine tarikbellamine requested a review from i1skn as a code owner March 2, 2021 00:29
@tarikbellamine tarikbellamine requested review from gnardini and removed request for timmoreton, asaj and i1skn March 2, 2021 00:29
Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Great changes overall.
However biggest security concern is about returning some private keys to the client.

@tarikbellamine tarikbellamine changed the title Move CICO provider keys server-side Move CICO provider url composition server-side Mar 5, 2021
Copy link
Contributor

@gnardini gnardini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, the code on valora-auth is very tidy :)

#!/usr/bin/env bash

firebase functions:config:set \
transak.url_staging=$(grep TRANSAK_URL_STAGING .env | cut -d '=' -f 2-) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really necessary but we could have a bash function that receives the env variable name as parameter and runs grep $1 .env | cut -d '=' -f 2- and call it in all these lines to make them slightly more readable.

Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Couple of additional comments.

Also wondering if we should find a different name for valora-auth that doesn't contain valora.
i.e. to be more in line with the other services names we have and given we've put all Valora branding into a private repo.

@tarikbellamine
Copy link
Contributor Author

Also wondering if we should find a different name for valora-auth that doesn't contain valora.
i.e. to be more in line with the other services names we have and given we've put all Valora branding into a private repo.

@jeanregisser I've renamed it to provider-url-service. I'm flexible on naming though so lmk if you have a suggestion you like more.

Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍
Left some optional comments, but since this is working and looks good relative to security, I'm approving 😄

Comment on lines 3 to 8
firebase functions:config:set \
transak.public_key=$(grep TRANSAK_PUBLIC_KEY_STAGING .env | cut -d '=' -f 2-) \
transak.private_key=$(grep TRANSAK_PRIVATE_KEY_STAGING .env | cut -d '=' -f 2-) \
ramp.public_key=$(grep RAMP_PUBLIC_KEY_STAGING .env | cut -d '=' -f 2-) \
moonpay.public_key=$(grep MOONPAY_PUBLIC_KEY_STAGING .env | cut -d '=' -f 2-) \
moonpay.private_key=$(grep MOONPAY_PRIVATE_KEY_STAGING .env | cut -d '=' -f 2-) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there's a way to import dotenv variables in a single command and also slightly more robustly (handles no quotes, single and double quotes) that we're using in our run_app.sh script https://github.com/celo-org/wallet/blob/4e6cc3a42d654fa072eccb79e6b836a44b123f7d/packages/mobile/scripts/run_app.sh#L42-L44

Copy link
Contributor Author

@tarikbellamine tarikbellamine Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this somewhat manual for now because I couldn't figure out how to properly nest provider specific variables (e.g., do moonpay.public_key instead of moonpay_public_key) and didn't want to crowd the env namesapce

@tarikbellamine tarikbellamine added the automerge Have PR merge automatically when checks pass label Mar 11, 2021
@tarikbellamine tarikbellamine merged commit b1c478f into main Mar 11, 2021
@tarikbellamine tarikbellamine deleted the tarikbellamine/cico-provider-keys branch March 11, 2021 08:28
@ValoraQA
Copy link

ValoraQA commented Mar 23, 2021

Hi @tarikbellamine can you give more information to test this task. Thanks!

@tarikbellamine
Copy link
Contributor Author

Hi @Celoqa! The way to test this is to see if the WebView or InAppBrowser loads correctly for each cash-in option. For example, if you select "MoonPay", then it should load the MoonPay url in app.

If there is a failure, you will see that there is a loading indicator going on forever when you select an option.

@ValoraQA
Copy link

Hi @tarikbellamine Thank you so much for giving more information about this task.
Here we have verified this task using latest Android Internal Build V1.12.0(1004294340) & Test flight build V1.12.0(49) and observe the followings.

Selecting MoonPay:

  • iOS: 1) Loading indicator is shown for 2seconds & "celo wants to use moonpay.io to signin popup is shown after 2 seconds.
    2) User should redirected to Buy.moonpay.io inAppBrowser by tapping on continue button.
  • Android: 1) Loading indicator is shown for 2seconds & User should redirected to Buy.moonpay.io inAppBrowser after 2 seconds.

Selecting Simplex:

  • iOS: User should redirect to Valoraapp.com Webview by tapping on Simplex after 4 seconds
  • Android: User should redirect to Valoraapp.com Webview by tapping on Simplex after 4 seconds

Selecting Ramp:

  • iOS: 1) Loading indicator is shown for 2seconds & "celo wants to use ramp.network to signin popup is shown after 2 seconds.
    2) User should redirected to Buy.ramp.network inAppBrowser by tapping on continue button.

Selecting Transak:

  • iOS: Loading indicator is shown for 4 seconds & user redirected to global.transak.com after 4 seconds
  • Android: Loading indicator is shown for 4 seconds & user redirected to global.transak.com after 4 seconds

Can you please let us know if we need to test anything else in this task.

@tarikbellamine
Copy link
Contributor Author

That's all. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
automerge Have PR merge automatically when checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move CICO provider keys server-side Enable card payments on Ramp
4 participants