Skip to content

Commit

Permalink
[Wallet + Verification Pool] Add details about generating an app-sign…
Browse files Browse the repository at this point in the history
…ature (celo-org#1482)
  • Loading branch information
jmrossy authored and celo-ci-bot-user committed Oct 28, 2019
1 parent 5ae4dc4 commit 4d96abb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions packages/verification-pool-api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Expand Down

0 comments on commit 4d96abb

Please sign in to comment.