Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ build/
.idea
.gradle
local.properties
gradle.properties
*.iml
*.aab

Expand Down Expand Up @@ -82,3 +83,4 @@ __e2e__/dist
# Other
google_play_store.json
egendata_google_play.json
*.hprof
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ An example app for managing consents and viewing data
- Install Watchman `brew install watchman`

### Linux and Android

* Make sure you have java 8 installed, the project is only compatible with this version. Later versions breaks the build.
- With brew you can install java8 with `brew cask install adoptopenjdk8`
- Then remember to se your JAVA_HOME env to this version (and/or add it to your .bashrc): `export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home`
* Install Android Studio https://developer.android.com/studio/install
* In the project directory create the file `android/local.properties` with the content `sdk.dir = /home/USERNAME/Android/Sdk`
* In the project directory create the file `android/local.properties` with the content `sdk.dir = /home/USERNAME/Android/sdk` on linux and, `sdk.dir = /Users/USERNAME/Library/Android/sdk` on mac, replacing USERNAME with your user's name
* Approve the licenses of the SDK packages by running ` /home/USERNAME/Android/Sdk/tools/bin/sdkmanager --licenses`
* If you get `Could not find tools.jar` then you need to point gradle to the JDK installation.
* You can find it with `2>/dev/null find / -name tools.jar -path "*jdk*"`
* If you don't have JDK installed then install it
* Create the file `~/.gradle/gradle.properties` with the line `org.gradle.java.home = /PATH/TO/JDK`
* Set up the device which will run the app (API Level 26, Android 8.0) https://facebook.github.io/react-native/docs/getting-started.html#preparing-the-android-device
* Install and open Android studio. Open the android folder inside Android Studio. Set up the device which will run the app (API Level 26, Android 8.0) by opening AVD manager. The AVD manager can be opened from the dropdown menu next to the play button.
* (Optionally, if you want it to automatically reload on code change) Install Watchman https://facebook.github.io/watchman/docs/install.html#installing-from-source

## Config
Expand Down Expand Up @@ -51,7 +53,11 @@ or whatever is the adress of the operator you want to use. Note that *OPERATOR_U
- `npm run android` is only needed the first time or when adding dependencies (it runs Jetifier to migrate libraries to AndroidX; after that you can run it from Android Studio if you prefer)

- if you want to run it on an actual device you need to run adb reverse tcp:8081 tcp:8081 so that the phone can reach the Metro bundler

- Add a gradle.properties file as /android/gradle.properties with the following contents
```
android.useAndroidX=true
android.enableJetifier=true
```
### __iOS__

- Update Cocoapods if version < 1.7.5 (check with `pod --version`)
Expand Down Expand Up @@ -137,11 +143,11 @@ All the relevant files for how this is currently set up can be found in `ios/fas

`xcode-select --install`

2. Access to the private repository holding the certificates and the provisioning profile.
2. Access to the private repository (Iteam1337/egendata-ios-certificates) holding the certificates and the provisioning profile. Your personal account should be invited as fastlane will use the

3. Edit the `git_url(...)` in `ios/fastlane/Matchfile` to the ssh version of the git url.
3. The certf-repo-passphrase. Currently stored in lastpass under `Egendata iOS Certificate Password`. You will be asked for this password when running the fastlane command.

4. Username and password for the apple user who is performing this operation. This user needs to be a part of the appstore connect team.
4. Username and password for the apple user who is performing this operation. This user needs to be a part of the appstore connect team. Currently stored in lastpass under `Egendata iOS Certificate Password`. You will be asked for these credentials when running the fastlane command.

*NOTE: Remember to change `.env`-file (correct OPERATOR_URL etc.) before doing the steps below*

Expand All @@ -153,19 +159,25 @@ fastlane manual_alpha_release
*NOTE: Fastlane command might error with `error: Multiple commands produce ...`, if so, run again.*
*NOTE: Fastlane command might error with ` error: The sandbox is not in sync with the Podfile.lock`, if so, see the `If build fails` section .*

The app should now have been released in testflight. To access it and invite other people. Make sure you get invited to the team at https://appstoreconnect.apple.com.

### Android (Google Play)

*NOTE: Remember to change `.env`-file (correct OPERATOR_URL etc.) before doing the steps below*

1. Download the Google Play, the release.keystore and the gradle.properties (it's in LastPass)
- Place the `.json`-file somewhere, you'll need to point to it from `android/fastlane/Appfile`
`json_key_file("/path/to/egendata_google_play.json")`
`json_key_file("/path/to/google_play_store.json")`
- Place the `release.keystore` in `android/app`
- Create `gradle.properties` in `android` and paste from lastpass.

2.
```
cd android
fastlane alpha
* cd android
* fastlane android_alpha
* After fastlane has ran, this could take several minutes. You should see the message: "Successfully finished the upload to Google Play"
* Make sure you are invited to the google play account hosting the app. Then, to access the console (currently Iteam's account): https://play.google.com/apps/publish/?account=7914539322420463189#ManageReleaseTrackPlace:p=com.egendata&appid=4972061446016688220&releaseTrackId=4700968953354340768
* Or enter the account, press Egendata app -> Appversioner -> Intern testkanal.

```

5 changes: 5 additions & 0 deletions __e2e__/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ const phone = require(`${phone_e2e_dist_dir}/`)
phone.Config.OPERATOR_URL = 'http://localhost:3000/api'
await phone.createAccount()
```


## React native modules in e2e-tests

To simplify and speed up some javascript implementations of react native functions including cryptographic JOSE functions, some modules are replaced in the test scenario, with code from the /src directory, using webpack. Similar to how the JOSE functions are also replaced for platform specific code when building for IOS and Android.
45 changes: 45 additions & 0 deletions __e2e__/src/native/react-native-jose.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
import * as jwt from 'jwt-lite'
import { privateDecrypt, publicEncrypt } from 'crypto'

export const sign = (payload, keys, header) =>
jwt.sign(payload, keys.jwk, header)
export const verify = (token, jwk) => jwt.verify(token, jwk)
export const decode = (token, options) => jwt.decode(token, options)

export const addRecipient = async (
jwe,
ownerKeys,
recipientKey,
alg = 'RSA-OAEP',
) => {
console.log('ownerkeys', ownerKeys)
console.log(
'adding recipient, current list:',
jwe.recipients.map(({ header: { kid } }) => kid),
)
const ownersEncryptedKey = jwe.recipients.find(
recipient => recipient.header.kid === ownerKeys.privateKey.kid,
)
if (!ownersEncryptedKey) {
throw new Error('no matching recipient for owner key')
}
console.log(ownersEncryptedKey.encrypted_key)
const newEncryptedKey = await reEncryptCek(
ownersEncryptedKey.encrypted_key, // the encrypted key of the encrypted key of the owner
ownerKeys,
recipientKey,
alg,
)

jwe.recipients.push({
header: {
kid: recipientKey.kid,
alg,
},
encrypted_key: newEncryptedKey,
})
return jwe
}

const reEncryptCek = (ownersEncryptedKey, ownerKey, recipientKey, _alg) => {
const decryptedCek = privateDecrypt(
ownerKey.privateKey,
Buffer.from(ownersEncryptedKey, 'base64'),
)
// recipient => recipient.header.kid === ownerKey.kid
return base64url(publicEncrypt(recipientKey.publicKey, decryptedCek))
}
5 changes: 4 additions & 1 deletion __e2e__/src/phone.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import Config from 'react-native-config'
import AsyncStorage from '@react-native-community/async-storage'

export async function createAccount() {
const pds = { provider: 'memory', access_token: 'nope' }
const pds = {
provider: 'memory',
access_token: 'not needed for provider: memory',
}
const acc = {
pds,
}
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ android {
applicationId "com.egendata"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 83
versionName "2.4.0"
versionCode 87
versionName "2.5.0"
ndk {
abiFilters "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
}
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:3.6.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
7 changes: 6 additions & 1 deletion android/fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
json_key_file("/home/travis/build/egendata/app/android/google_play_store.json")
if ENV['CI']
json_key_file("/home/travis/build/egendata/app/android/google_play_store.json")
else
json_key_file("./google_play_store.json")
end

package_name("com.egendata")
4 changes: 2 additions & 2 deletions android/fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ or alternatively using `brew cask install fastlane`

# Available Actions
## Android
### android alpha
### android build
```
fastlane android alpha
fastlane android build
```
Runs all the tests
### android android_alpha
Expand Down
20 changes: 0 additions & 20 deletions android/gradle.properties

This file was deleted.

4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jul 03 11:49:32 CEST 2019
#Thu Jun 11 14:32:29 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
2 changes: 1 addition & 1 deletion ios/Egendata-tvOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>79</string>
<string>83</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/Egendata-tvOSTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>79</string>
<string>83</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions ios/Egendata.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 79;
CURRENT_PROJECT_VERSION = 83;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = BSE2J6442R;
HEADER_SEARCH_PATHS = (
Expand Down Expand Up @@ -1461,7 +1461,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 79;
CURRENT_PROJECT_VERSION = 83;
DEVELOPMENT_TEAM = BSE2J6442R;
HEADER_SEARCH_PATHS = (
"$(inherited)",
Expand Down
2 changes: 1 addition & 1 deletion ios/Egendata/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>79</string>
<string>83</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/EgendataTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>79</string>
<string>83</string>
</dict>
</plist>
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,10 @@ SPEC CHECKSUMS:
React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
react-native-camera: 88f19d7240667a8dae9d76414986c2893d712744
react-native-camera: 9bf6e0cdce0d7dc059d9836eb381d96f58f83d83
react-native-config: 55548054279d92e0e4566ea15a8b9b81028ec342
react-native-jose: e85455676e6190291bdb61f6814c6036ba13fb3d
react-native-simple-crypto: e8aa2319a18926523ba389a654a78dcdf9aa6547
react-native-simple-crypto: e1e958139bae411c5d76a2438b004f601639ac6e
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
Expand All @@ -386,13 +386,13 @@ SPEC CHECKSUMS:
React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe
React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad
ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
ReactNativePermissions: f3beb8871251594a8ea2c6b19a3f8252d5c7379d
RNCAsyncStorage: 2e2e3feb9bdadc752a026703d8c4065ca912e75a
ReactNativePermissions: f0aec11433d43d45953c678b6982921d83ad94c8
RNCAsyncStorage: 621bad7a889b5bf1583a52547f2dcd3a4d1ff15e
RNEmulatorCheck: 00924e42c62a5a3a8751aaaa167fab0c5b12fbb9
RNGestureHandler: 5329a942fce3d41c68b84c2c2276ce06a696d8b0
RNSVG: 8ba35cbeb385a52fd960fd28db9d7d18b4c2974f
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b

PODFILE CHECKSUM: fae4834878e9866413145d252fa5aaae0cfd59cb

COCOAPODS: 1.8.4
COCOAPODS: 1.9.1
7 changes: 5 additions & 2 deletions ios/fastlane/Matchfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
git_url("https://#{ENV['GITHUB_CERT_TOKEN']}@github.com/Iteam1337/egendata-ios-certificates.git")

if ENV['CI']
git_url("https://#{ENV['GITHUB_CERT_TOKEN']}@github.com/Iteam1337/egendata-ios-certificates.git")
else
git_url("[email protected]:Iteam1337/egendata-ios-certificates.git")
end
storage_mode("git")

type("appstore") # The default type, can be: appstore, adhoc, enterprise or development
Expand Down
19 changes: 13 additions & 6 deletions lib/components/Consents/ConsentListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Icon } from '../elements/Icon/Icon'

const Container = styled(TouchableOpacity)`
flex-direction: row;
min-height: 100px
align-items: center;
`

Expand All @@ -21,6 +22,7 @@ const Logo = styled(Image)`
`

const IconContainer = styled(View)`
flex-direction: row;
position: absolute;
top: 0;
right: 0;
Expand All @@ -35,12 +37,17 @@ const ConsentListItem = ({
}) => (
<Container onPress={callback}>
<IconContainer>
<Icon
width="11"
height="15"
name="arrowRight"
fill={egendataTheme.colors.icon.arrowRight}
/>
<Paragraph
style={{
fontWeight: '500',
marginBottom: 25,
marginRight: 5,
color: 'red',
}}
>
remove consent
</Paragraph>
<Icon width="11" height="15" name="arrowRight" fill="red" />
</IconContainer>
<Logotype uri={logoURI} />
<Description>
Expand Down
Loading