Skip to content

Commit

Permalink
major: Ios native port (#791)
Browse files Browse the repository at this point in the history
* fix: update metadata

* docs: created issue for stock metadata updates

* docs: lint

* feat: add generalized metadata storage mwp

* feat: metadata info on network details page (early stub)

* feat: invalid metadata message

* feat: built-in metadata loaded in constants

feat: metadata versions added to constants

* fix!: metadata is actuallty loaded;
removed som non-essential networks due to metadata loading issues

* fix: annoying hooks warning about updating component from another component fixed

* fix: smoother metadata loading; initiation moved to separate from fetching block

* ref: merged networkscontext and registriescontext

* fix: remove process race on init and small fixes

* fix: infinite useEffect cycle in payload card; probably there is more

* feat: show list of available metadata packages for given network

* feat: choose metadata from network settings submenu

* test: fix typos in unit tests

* test: fix tests and some lint/type errors

* feat: Metadata management scanner (#749)

* feat: MWP fast Rust-processed QR scanner frontend

* build: temporarily switch dependency rust-native to side branch

* feat: implement rust code for fountain parsing. Saving point for partial dependencies upgrade attempts

* feat: add metadata through fountain QR codes! (go to network settings>"network name">ManageMetadata>Fast Qr Scanner)

* fix: lint and types

* fix: typo in constants

* fix: multiple minor bugs

* refactor: return rust native libs where they belong (#751)

* ref: return rust native libs where they belong

* docs: lost gitignore

* refactor: move reference animated qr code generator to external repository

* build: move header files in ios build part

* build: add more memory for ios node build

* build: add more memory for ios node build in a different way

* build: revert ios build changes, modify bitrise script to allocate less memory

* build: duplicate headers for ios

* fix: Transaction parser (#754)

* feat: parse generic transaction. Ugly but now works.

* test: increase e2e timeout

* fix: lint

* feat: automatically generate built-in metadata (#755)

* feat: add rust code to automatically fetch and generate built-in metadata constants

* test: add extra paths for linter to ignore

* feat: automatically update constants/networkSpecs.ts with new metadata info

* fix: add blake2 hash to metadata handles; use it as ID if no spec_name or spec_version is available

* fix: blake2 hash in networkSpecs constants

* fix: add hashes for centrifuge and edgeware

* fix: metadata autogeneration lint

* build: update failure_derive to 1.8.0

* build: convenience reminder in build script

* fix: multiple fixes to allow versionless metadata

* test: fix unit tests to recognize versioned metadata

* refactor: faster metadata queries (#759)

* perf: moved metadata handle generator to rust

* refactor: lint and types

* build: try ti disable flipper

* fix: update metadata

* test: increase alert timeout

* test: typo in consts

* fix: merged last commit that was dropped from last squash for some reason

* feat: Metadata management page (#760)

* build: bump polkadot/api version to latest

* fix: red boxes on registering networks

* build: mess with upgrades and lint

* feat: can delete unused metadata (except for built-in probably)

* build: Upgrade polkadot-js 4 7 2 (#761)

* upgrade polkadot and react-native

* test: disabled failing tests temporarily

* test: restore tests

* fix: lint

* test: fix ts-ignore updated rule

* fix: lint and types

* test: bump nodejs version

* test: bump wasm-crypto needed for tests

* fix: update metadata

* build: bump node version for e2e

* build: bump node version in bitrise.yml

* test: teach signing test to scroll down

* test: fix addNewNetwork signing test with scrolling

* test: forgot to import scrolling tap everywhere it's needed

* fix: update westend metadata

* build: build rust for detox

* build: try to fix comment in macro build issue for zeroize_derive

* fix: typu in NetworkContext file

* build: update synstructure rust dep

* build: disable 32-bit ios targets

* build: remoce macro proc so that cross-compile works

* build: very ugly hack to address ios inability to build dynamic libs and rust-lang/cargo#4881

* fix: update metadata

* feat: loading screen stub

* lint

* fix: import react to splashscreen tab

* fix: metadata qr alignment error

* test: increase e2e timeout

* feat: loaded metadata preview screen

* test: switch ios and android e2e tests order

* test: add waiting for loading in beforeall e2e

* fix: lint

* test: typo

* fix: update metadata

* test: preparing for new e2e tests

* docs: bump license year in ts

* docs: bump license year in ios

* docs: bump version year in rust

* fix: gracefully fail to parse transaction if no metadata is available

* test: fix gradle api for detox

* test: remove waiting for alerts

* fix: lint

* feat: slightly prettier loading screen

* fix: lint

* fix: properly handle networks with unset metadata on loading

* fix: #767 and some lint

* fix: lint and types

* feat: slightly prettier transaction parser

* fix: types and lint

* test: attempt to run e2e on bitrise

* test: bump node version on bitrise

* test: swap ios and android testing again

* build: automatically set NDK_HOME with other variables

* test: download last reasonable config from bitrise

* test: increase verbosity in e2e test

* test: increase verbosity for e2e ci test on github

* test: wait for chooser screen after account creation in e2e

* test: this will be reverted - check that ios really clears memory between tests

* fix: lint and ios build

* test: preparing for new tests

* build: ios version fix attempt

* build: fixing ios build

* build: rename xcode folders

* build: update some deps

* build: remove ios/SubstrateSignTests

* fix: reverse ios module renaming mess

* build: ios folder cleanup

* build: move swift-bridge header around

* fix: Bridging header location

* fix: libsigner.a location

* build: try different places for static ios rust lib

* build: remove ndk address and some file duplicates

* build: ios linking

* test: some unfinished test specs added

* chore: update meta_reading

* chore: bump metadata reading version

* fix: gitignore

* fix: gitignore

* feat: rust transaction parser mwp demo

* fix: accept V13 metadata

* feat: stub for rust transaction parser call

* feat: mwp rust transaction parse demo (stub vor visualization)

* feat: add more cards to transaction renderer

* fix: lint and make some things prettier

* build: manually return linking lines to ios project file

* feat: migrate metadata db to insecure storage

* fix: accept V13 metadata

* chore: update metadata

* feat: add templates for cards: loading and error in transaction

* feat: add error messages cards generation and some refactor

* feat!: remove ethereum support, direct connection to transaction parser. Can't sign at the moment.

* refactor: tidy up transaction parser code

* feat: active SIGN button in details screen and some sanitation to remove legacy

* feat: prepare data transfer for signature and signing pin screen

* feat: signing is back! and with all 3 crypto algorithms as well!

* fix: show error messages on pin entry

* fix: remove silly testing message from really hard to find place

* feat: proper pin code error messages and start of rust storage testing (sled vs sqlite?)

* chore: update metadata

* fix: invalid payload screen crashing

* fix: temporarilty disable mortality check until upstream conforms

* fix: data to sign format correction

* feat: payload details look

* test: remove decoders test from RN suite (moved to Rust tests)

* test: remove units conversion test from RN suite (moved to Rust tests)

* fix: choose sled as db

* fix: lint

* fix: some types, lint and legacy removal

* fix: purge ethereum

* fix: ios support and more legacy purging

* ci: Rework Gitlab (#782)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* feat: move all storage to rust (#780)

* FEAT: MFP sled database for android

* feat: network db handling utils

* docs: signing and parsing modules documentation

* fix: gitignore to ignore temporary db files in db handling tests

* refactor: move network specs constants to rust side

* fix: gitignore typo

* fix: gitignoring properly

* test: cleanup db tests locations

* feat: part of bridge to access new network specs storage from RN

* refactor: organize all cards and errors in transaction parsing into enums

* feat: network selector queries db. And some cleanup.

* test: add test feature to show all payload info cards

* feat: MWP metadata signing app example

* feat: MWP fetch and show derivations for given seed and network

* feat: removed RN data storages; app loads and fetches some data - MWP

* feat: prepare fetched metadata for signing and save to db instead of plaintext

* feat: account creation in db and signed metadata checks

* feat: generate metadata qr codes; also bridge Rust to RN

* feat: load type specs and some refactor

* feat: add hw backed key generation section to android

* fix: gitignore

* feat: automatic fetch chainspecs

* fix: create new seed

* fix: mwp address list screen

* feat: replace ethsign with XSalsa20Poly1305; just to save this state - this will be reverted

* feat: native credential-only unlock screen for Android (defunct)

* fix: unhang app on auth

* feat: HW keys for android (auth screen freezes thread, WIP)

* fix: proper thread locks for biometric prompt (Android)

* fix: fetch all seed names

* feat: add seed button

* feat: POC identity cards render

* fix: recover seed now works similar to create seed

* feat: general look for identity cards

* feat: bells and whistles on identity screen

* feat: send public key to UI on fetching relevant identities

* chore: remove some unused java deps

* chore: remove some unused polkadot js deps

* feat: export public account (uos step 1)

* chore: cleanup obsolete screens

* chore: more cleanup

* feat: derivation checker and identity creation backend

* ci: Gitlab build (#784)

* tighten up build scripts

* rewrite gitlab

* add signing

* fix

* enable

* update gitlab-ci.yml

* become unstuck

* fix

* add debug output

* fix

* fix

* fix

* add artifact

* remove test branch

* feat: expose identity creation functions

* feat: expose identity creation functions in RN; handle address collisions

* feat: add new identity

* feat: n+1 feature

* feat: backend to delete identities and suggest their names

* feat: delete identity

* major: tools for creating full signed offline QR updates

* feat: move prepopulated db to assets to copy on init

* feat: remove global context; make TOCnPP condition to populate db; app factory reset should work through deletion of app data now

* refactor: remove old rust code, some general cleanup

* fix: screen refresh on addition of account

* fix: refresh on address deletion

* refactor: RN cleanup

* feat: nice suggestions for seed names

* lint: RN lint and cleanup

* refactor: some types and more cleanup

* feat: automatic TOFU metadata, types and network specs import, fixed signing

* lint: cleanup meta_reading

* fix: signing and upgrading screens fixes

* feat: populate cold database from hot one (and some more cleanup)

* refactor: move all screens to one place

* feat: network settings screen

* feat: remove metadata, remove network

* CI: rework

* CI: poke the pipeline

* CI: metadata

* CI: make it work

* fix: network removal call properly

* fix: empty metadata does not crash; also some refactor and backend for listing all addresses

* fix: rn build android (#785)

* fix: disable broken minification with proguard

* revert: cat in ci

* docs: readme for db_handling

* fix: .h header for ios build

* fix: remove obsolete meta handle generator

* fix: cargo.toml cleanup for main module

* feat: use anyhow to propagate errors to ios

* feat: anyhow all rust code

* refactor: decrease code redundancy by helpers

* fix: rust ios return seedphrase on successful creation

* major: native ios wip dump

* feat: add rust-identicon dependency just to test build

* major: ios account management UI

* ci: remove yarn calls from e2e; should add tests later

* ci: remove ts lint types and unit tests

* ci: ga build script fix

* refactor: cleanup of junk files

* fix: simplify data model and fix some memory leaks and threading

* ci: scheme in actions

* feat: better rust qr parser and PC implementation as devtool

* feat: try to send svg string to ios

* fix: QR parser succeeds 1 frame sooner

* test: 1-frame multiframe decode unit test

* feat: transaction parsing and preview sketch

* feat: history backend

* feat: seed and network settings screens, TC and PP

* feat: bindings for history ios

* feat: ios history ui stub

* refactor: tidy up history in transaction parsing

* feat: rust QR code png renderer

* refactor: consolidate qr constants

* feat: integrate QR code generation into signing

* feat: ios history and hard types in tx and history ui cards

* fix: seriously, output is supposed to be binary-encoded hex symbols?!

* feat: new export pubkey qr code generator

* feat: identicons stub, faster qr videos

* feat: show identities for all seeds

* feat: show all seeds and minor UI fixes

* chore: cleanup RN

* docs: remove ETH, explain legacy situation

* docs: some tutorials

* docs: reference to uos

* fix: signing db checksum mismatch bugfix

* docs: mark how releases are tagged

Co-authored-by: Martin Pugh <[email protected]>
Co-authored-by: Martin Pugh <[email protected]>
Co-authored-by: Denis P <[email protected]>
  • Loading branch information
4 people authored Sep 22, 2021
1 parent c6b30f5 commit b9fa369
Show file tree
Hide file tree
Showing 599 changed files with 33,181 additions and 32,944 deletions.
2 changes: 1 addition & 1 deletion .buckconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[android]
target = Google Inc.:Google APIs:23
target = Google Inc.:Google APIs:30

[maven_repositories]
central = https://repo1.maven.org/maven2
90 changes: 0 additions & 90 deletions .eslintrc.js

This file was deleted.

44 changes: 5 additions & 39 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,14 @@ jobs:
- name: Checkout submodules
shell: bash
run: git submodule update --init --recursive
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: '13.x'
- name: Cache Npm
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Pods
uses: actions/cache@v1
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install dependencies
run: |
brew tap wix/brew
brew install applesimutils
npm install -g yarn
npm install -g react-native-cli
npm install -g detox-cli
gem install xcpretty
yarn
- name: Build CocoaPods
run: cd ios && pod install && cd ..
gem install xcpretty
- name: Rust build
shell: bash
run: cd scripts && ./build.sh ios && cd ..
- name: Detox biuld
run: yarn build-e2e:ci
- name: Detox test
run: yarn test-e2e:ci
run: xcodebuild -workspace ios/NativeSigner.xcodeproj/project.xcworkspace -scheme NativeSigner -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build/NativeSigner -UseModernBuildSystem=YES | xcpretty -t && exit ${PIPESTATUS[0]}

52 changes: 0 additions & 52 deletions .github/workflows/yarn-tools.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ fastlane/screenshots
android/.project
android/app/.project
android/app/bin

# rust
rust/*/target
rust/db_handling/signer_database
rust/db_handling/tests
rust/meta_reading/tests
78 changes: 30 additions & 48 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,39 @@
# .gitlab-ci.yml
#
# parity-signer
#
# pipelines can be triggered manually in the web

stages:
- test
- build
variables:
GIT_DEPTH: "3"
SIMPLECOV: "true"
RUST_BACKTRACE: "1"
RUSTFLAGS: ""
CARGOFLAGS: ""
cache:
untracked: true

variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 100

default:
cache: {}

android-test:
stage: test
image: parity/android-sdk
only:
- master
- /^[0-9]+$/
# testing Android build on this branch
- tbaut-without-version
script:
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get install -y nodejs
- npm install -g yarn
- npm install
- npm run test
tags:
- linux-docker
workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH

android-build:
stage: build
image: parity/android-sdk
only:
- beta
- tags
- stable
- triggers
- master
android-build-release:
stage: build
image: paritytech/parity-signer:latest
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
artifacts:
paths:
- signer-app-release-signed.apk
script:
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get install -y nodejs
- echo "ndk.dir=/usr/local/android-ndk-r16b" > android/local.properties
- echo "sdk.dir=/opt/android-sdk" >> android/local.properties
- npm install -g yarn
- bash ./setup_linux.sh
- bash ./gen_key.sh
- cd android && ./gradlew assembleRelease
- pwd
- ls
- cat "$KEYSTORE_DATA" | base64 -d > /tmp/gitlab-ci.keystore
- wc /tmp/gitlab-ci.keystore
- ./scripts/build-release.sh /tmp/gitlab-ci.keystore "$KEYSTORE_ALIAS" "$KEYSTORE_PASS"
tags:
- linux-docker
artifacts:
paths:
- ./android/app/build/outputs/apk/release/app-release.apk

9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

46 changes: 38 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,47 @@

![Parity Signer](./docs/tutorials/images/logo-parity-signer.jpg)

**Please read instructions in [Getting started](#getting-started) before building or using the Signer**

Parity Signer is a mobile application that allows any smartphone to act as an air-gapped crypto wallet. This is also known as "cold storage".

You can create Substrate and Ethereum accounts, sign messages/transactions, and transfer funds to and from these accounts without any sort of connectivity enabled on the device.
You can create accounts in Substrate-based networks, sign messages/transactions, and transfer funds to and from these accounts without any sort of connectivity enabled on the device.

You must turn off or even physically remove the smartphone's Wifi, Mobile Network, and Bluetooth to ensure that the mobile phone containing these accounts will not be exposed to any online threat.
You must turn off or even physically remove the smartphone's Wifi, Mobile Network, and Bluetooth to ensure that the mobile phone containing these accounts will not be exposed to any online threat. Switching to airplane mode suffices in many cases.

**Disabling the mobile phone's networking abilities is a requirement for the app to be used as intended, check our [wiki](./docs/wiki/Security-And-Privacy.md) for more details.**

Have a look at the tutorial on our wiki to learn how to use [Parity Signer together with Polkadot-js app](./docs/tutorials/Kusama-tutorial.md), or [MyCrypto app](./docs/tutorials/MyCrypto-tutorial.md) and [Parity Fether](./docs/tutorials/Fether-tutorial.md) for Ethereum.
Have a look at the tutorial on our wiki to learn how to use [Parity Signer together with Polkadot-js app](./docs/tutorials/Kusama-tutorial.md).

Any data transfer from or to the app happens using QR code. By doing so, the most sensitive piece of information, the private keys, will never leave the phone. The Parity Signer mobile app can be used to store any Substrate account, this includes Polkadot (DOT) and Kusama (KSM) networks.

## Key features

- This is not a complete cryptowallet in itself. The Signer does not sync with blockchain, so it does not know your account balance, whether transactions were successful or even if the account exists! This is a **cold wallet** app only stores keys, reads and signs messages. It should always be used with **hot wallet** like [polkadot.js](https://polkadot.js.org/apps)
- The Signer alone does not make your accounts secure. **You must maintain security yourself**. Airgap should be only part of your security protocol, improper use of Signer could still lead to loss of funds and/or secrets.
- When properly used, Signer provides best achievable security with Substrate networks to-date.

## System requirements

Currently Signer is available only for iOS. Android version is coming soon.

## Getting Started

Any data transfer from or to the app happens using QR code. By doing so, the most sensitive piece of information, the private keys, will never leave the phone. The Parity Signer mobile app can be used to store any Polkadot or Ethereum account, this includes KSM, ETH, ETC as well as Ether from various testnets (Kovan, Ropsten...).
**These tutorials and docs are heavily outdated at the moment, please use them as references or help improving**

## Getting Start
The `master` branch contains development code; for stable releases and release candidates please use [Release](https://github.com/paritytech/parity-signer/tree/release) branch or fetch tagged commits.

If you are upgrading from older version of Signer, please see [changelog](./docs/wiki/Changelog.md) and [upgrading Signer](./docs/wiki/Upgrading.md)

Please note that the Signer app is an advanced tool designed for maximum security and complex features. In many use cases, more user-friendly tools would be sufficient.

[Getting started guide](./docs/tutorials/Start.md)

### Tutorials

- [Signing with Pokadot.js Apps](./docs/tutorials/Kusama-tutorial.md)
- [Recover Account from Polkadot.js Apps](./docs/tutorials/Recover-Account-Polkadotjs.md)
- [Manage Accounts on Parity Signer](./docs/tutorials/Hierarchical-Deterministic-Key-Derivation.md)
- [Signing with MyCrypto](./docs/tutorials/MyCrypto-tutorial.md)
- [Signing with Fether](./docs/tutorials/Fether-tutorial.md)
- [Update New Network](./docs/tutorials/New-Network.md)

### Wiki
Expand All @@ -39,8 +59,18 @@ Any data transfer from or to the app happens using QR code. By doing so, the mos
- [Testing](./docs/wiki/Test.md)
- [Troubleshooting](./docs/wiki/Troubleshooting.md)
- [QA Check List](./docs/wiki/QA.md)
- [HDKD Feature](./docs/wiki/HDKD.md)
- [Key derivations](https://substrate.dev/docs/en/knowledgebase/integrate/subkey)
- [Changelog](./docs/wiki/Changelog.md)
- [QR encoding definition](https://github.com/maciejhirsz/uos)

### Legacy versions

Older versions of this app could be useful for development, however, they are not safe for use in production. They are available at following branches:

- [Last public release with React Native](https://github.com/paritytech/parity-signer/tree/legacy-4.5.3)
- [Non-ascii characters fix and some transaction parsing](https://github.com/paritytech/parity-signer/tree/legacy-4.6.2)
- [Metadata types import and message parsing in RN](https://github.com/paritytech/parity-signer/tree/legacy-metadataRN)
- [Rust backend with RN frontend](https://github.com/paritytech/parity-signer/tree/legacy-rust)

## License

Expand Down
9 changes: 0 additions & 9 deletions ReactotronConfig.js

This file was deleted.

Loading

0 comments on commit b9fa369

Please sign in to comment.