From 4d96abb42b4909f3f5b048f1d9b5b483d1b69888 Mon Sep 17 00:00:00 2001 From: J M Rossy Date: Mon, 28 Oct 2019 11:45:09 +0100 Subject: [PATCH] [Wallet + Verification Pool] Add details about generating an app-signature (#1482) --- packages/mobile/README.md | 21 +++++++++++++------- packages/verification-pool-api/src/config.ts | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/mobile/README.md b/packages/mobile/README.md index 48d9e7a9775..f0e4ed53308 100644 --- a/packages/mobile/README.md +++ b/packages/mobile/README.md @@ -25,7 +25,7 @@ This makes Gradle faster: export GRADLE_OPTS='-Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"' ``` -## Running +## Running the App 1. If you haven't already, run `yarn` from the monorepo root to install dependencies. @@ -97,6 +97,12 @@ yarn run build-sdk TESTNET before rebuilding the app. Note that this will assume the testnets have a corresponding `/blockchain-api` and `/notification-service` set up. +### Running Wallet app in ZeroSync mode + +By default, the mobile wallet app runs geth in ultralight sync mode where all the epoch headers are fetched. The default sync mode is defined in [packages/mobile/.env](https://github.com/celo-org/celo-monorepo/blob/master/packages/mobile/.env#L4) file. + +To run wallet in zero sync mode, where it would connect to the remote nodes and sign transactions in web3, change the default sync mode in the aforementioned file to -1. The mode has only been tested on Android and is hard-coded to be [crash](https://github.com/celo-org/celo-monorepo/blob/aeddeefbfb230db51d2ef76d50c5f882644a1cd3/packages/mobile/src/web3/contracts.ts#L73) on iOS. + ## Testing To execute the suite of tests, run `yarn test` @@ -176,16 +182,16 @@ cd android/ Where `YOUR_BUILD_VARIANT` can be any of the app's build variants, such as debug or release. -## Generating GraphQL Types +## Configuring the SMS Retriever -We're using [GraphQL Code Generator][graphql code generator] to properly type -GraphQL queries. If you make a change to a query, run `yarn build:gen-graphql-types` to update the typings in the `typings` directory. +On android, the wallet app uses the SMS Retriever API to automatically input codes during phone number verification. -## Running Wallet app in ZeroSync mode +The service that route SMS messages to the app needs to be configured to [append this app signature to the message][sms retriever]. Note, the signature will need to be computed using the signing key from the google play dashboard. -By default, the mobile wallet app runs geth in ultralight sync mode where all the epoch headers are fetched. The default sync mode is defined in [packages/mobile/.env](https://github.com/celo-org/celo-monorepo/blob/master/packages/mobile/.env#L4) file. +## Generating GraphQL Types -# To run wallet in zero sync mode, where it would connect to the remote nodes and sign transactions in web3, change the default sync mode in the aforementioned file to -1. The mode has only been tested on Android and is hard-coded to be [crash](https://github.com/celo-org/celo-monorepo/blob/aeddeefbfb230db51d2ef76d50c5f882644a1cd3/packages/mobile/src/web3/contracts.ts#L73) on iOS. +We're using [GraphQL Code Generator][graphql code generator] to properly type +GraphQL queries. If you make a change to a query, run `yarn build:gen-graphql-types` to update the typings in the `typings` directory. ## How we handle Geth crashes in wallet app on Android @@ -259,3 +265,4 @@ $ adb kill-server && adb start-server [rntl-docs]: https://callstack.github.io/react-native-testing-library/ [jest]: https://jestjs.io/docs/en/snapshot-testing [redux-saga-test-plan]: https://github.com/jfairbank/redux-saga-test-plan +[sms retriever]: https://developers.google.com/identity/sms-retriever/verify#1_construct_a_verification_message diff --git a/packages/verification-pool-api/src/config.ts b/packages/verification-pool-api/src/config.ts index 39431b76904..bd3120984f3 100644 --- a/packages/verification-pool-api/src/config.ts +++ b/packages/verification-pool-api/src/config.ts @@ -19,6 +19,8 @@ export const networkid = functionConfig[CELO_ENV]['testnet-id'] export const appSignature = functionConfig[CELO_ENV]['app-signature'] export const smsAckTimeout = functionConfig[CELO_ENV]['sms-ack-timeout'] || 5000 // default 5 seconds +console.debug(`Config settings: app-signture:${appSignature}, networkId:${networkid}`) + // @ts-ignore export const web3 = new Web3(`https://${CELO_ENV}-infura.celo-testnet.org`)