-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* this is a mock for doc purposes * implemented aes function * iOS unit tests * detox setup * test app for detox * m * reset index.js in cleanup of detox tests * including e2e test notes in readme * make iv proper length, delete unused files * this is a mock for doc purposes * implemented aes function * iOS unit tests * detox setup * test app for detox * reset index.js in cleanup of detox tests * including e2e test notes in readme * make iv proper length, delete unused files * this is a mock for doc purposes * implemented aes function * iOS unit tests * detox setup * make iv proper length, delete unused files * package.json * detox detox detox * detox * made test directory for unit tests * testing detox with travis * travis <3 detox * travis attempt 3 * travis * travis * travis <3 brew * travis still <3 brew * travis <3 xcode tools * downgraded iphone to match xcode 9, which is used to match travis xcode cli tools * updated index files * package json alteration to get detox to work in travis * ensure there is a polyfill * fixed package.json * travis <3 react-native * typo * install react-native-cli * travis <3 detox-cli * took detox out of travis * changed some filenames for more clarity * updated readme * code review changes * reverted travis * made readme more readable * post install react-native link" * corrected file name * Remove Polyfill from index * Update index.ios.js * Update meat-grinder.js * Update init.js * Delete index.js
- Loading branch information
Showing
14 changed files
with
175 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- "8" | ||
- '8' | ||
branches: | ||
only: | ||
- master | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { Component } from 'react'; | ||
import { encryptWithAes } from '../src/utils/meat-grinder.js'; | ||
import { View, Text } from 'react-native'; | ||
var inputSizes = [16, 20, 48]; | ||
const testPrivateKey = | ||
'8238BAE35C77FE4AEBB2DEB1B83A6F0027A01D0E4D93BF5B81F7117796955A17'; | ||
export default class E2ETests extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { input16: 0, input20: 0, input48: 0 }; | ||
inputSizes.map(inputSize => { | ||
this.encryptForSize(inputSize); | ||
}); | ||
} | ||
async encryptForSize(sizeInBytes) { | ||
let aesOutput = await encryptWithAes( | ||
testPrivateKey, | ||
new Array(sizeInBytes).join('x') | ||
); | ||
if (!aesOutput) { | ||
throw Error('output is not good'); | ||
} | ||
this.setState({ ['input'.concat(sizeInBytes)]: aesOutput.ciphertext }); | ||
return 'success'; | ||
} | ||
render() { | ||
return ( | ||
<View testID="welcome" style={{ flex: 1, justifyContent: 'center' }}> | ||
<Text testID="16ByteInput">{this.state.input16.length}</Text> | ||
<Text testID="20ByteInput">{this.state.input20.length}</Text> | ||
<Text testID="48ByteInput">{this.state.input48.length}</Text> | ||
</View> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"setupTestFrameworkScriptFile": "./init.js", | ||
"testEnvironment": "node" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-env detox/detox, jest*/ | ||
describe('Example', () => { | ||
beforeEach(async () => { | ||
await device.reloadReactNative(); | ||
}); | ||
|
||
it('should have welcome screen', async () => { | ||
await expect(element(by.id('16ByteInput'))).toHaveText('24'); | ||
}); | ||
/* it('should show hello screen after tap', async () => { | ||
await element(by.id('hello_button')).tap(); | ||
await expect(element(by.text('Hello!!!'))).toBeVisible(); | ||
}); | ||
it('should show world screen after tap', async () => { | ||
await element(by.id('world_button')).tap(); | ||
await expect(element(by.text('World!!!'))).toBeVisible(); | ||
}); | ||
*/ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const detox = require('detox'); | ||
const config = require('../package.json').detox; | ||
const adapter = require('detox/runners/jest/adapter'); | ||
const { exec } = require('child_process'); | ||
|
||
jest.setTimeout(120000); | ||
jasmine.getEnv().addReporter(adapter); | ||
|
||
beforeAll(async () => { | ||
exec('cp index.e2e.js index.js'); | ||
await detox.init(config); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await adapter.beforeEach(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await adapter.afterAll(); | ||
exec('rm index.js'); | ||
await detox.cleanup(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { AppRegistry } from 'react-native'; | ||
import { name as appName } from './app.json'; | ||
import E2ETests from './e2e/E2ETests'; | ||
AppRegistry.registerComponent(appName, () => E2ETests); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { AppRegistry } from 'react-native'; | ||
import App from './src/App'; | ||
import { name as appName } from './app.json'; | ||
AppRegistry.registerComponent(appName, () => App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import Aes from 'react-native-aes-crypto'; | ||
//arguments: file - plaintext file | ||
//return value:encrypted file | ||
export async function encryptWithAes(privateKey, plainTextFile) { | ||
const iv = 'sixteen bytes iv'; //To DO: randomly generate | ||
try { | ||
const ciphertext = await Aes.encrypt(plainTextFile, privateKey, iv); | ||
return { ciphertext, iv }; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
|
||
//arguments: encrypted file | ||
//return value: array of (x,y) coordinates | ||
/* | ||
import Aes from '@trackforce/react-native-aes-crypto'; | ||
//arguments: file - plaintext file | ||
//return value:encrypted file | ||
export async function encryptWithAes(privateKey, plainTextFile) { | ||
const iv = 'sixteen bytes iv'; //To DO: randomly generate | ||
try { | ||
const ciphertext = await Aes.encrypt(plainTextFile, privateKey, iv); | ||
return { ciphertext, iv }; | ||
} catch (error) { | ||
throw error; | ||
} | ||
} | ||
//arguments: encrypted file | ||
//return value: array of (x,y) coordinates | ||
function encryptWithShamirs(encryptedFile) {} | ||
//arguments:array points needed to reconstruct encryptedFile | ||
//return value: array of new (x,y) coordinates | ||
function hashPointsWithPrivateKey(arrayOfPoints) {} | ||
//argument: array of (x,y) coordinates | ||
//return value: Promise that resolves to an array of IPFS Hashe's | ||
async function submitPointsToIPFS(points) {} | ||
async function saveToVault(plainTextFile) { | ||
let points = hashPointsWithPrivateKey( | ||
encryptWithShamirs(encryptWithAes(plainTextFile)) | ||
); | ||
let ipfsHashes = await submitPointsToIPFS(points); | ||
return ipfsHashes; | ||
} | ||
*/ |