Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a05bc04
WIP shamir integration
Nov 5, 2018
f494ea0
Merge branch 'master' into setupProject-integrate-shamir
Nov 5, 2018
d06003a
get rid of unused vars, fix test case
Nov 5, 2018
45d99ed
utility functions and combine function
Nov 8, 2018
8e9eef2
writing methods for combine
Nov 8, 2018
8db2253
split functions into smaller functions - add more test cases
Nov 8, 2018
c4053fa
Use react-native-securerandom as a peer dependency
barlock Nov 8, 2018
6088300
wrote more functions and tests
Nov 9, 2018
a3ba7de
fixed typo in lagrange
Nov 9, 2018
585a177
Add npm deploy on release
barlock Nov 9, 2018
82770ca
npm registry
Nov 9, 2018
ef3e38c
jsdoc
Nov 10, 2018
2965580
jsdoc
Nov 11, 2018
8f3227f
resolve merge
Nov 11, 2018
dab1a61
merged in rnsr-peer
Nov 11, 2018
c84a69d
took outbackup files
Nov 11, 2018
d9142bc
Merge pull request #7 from ConsenSys/setup-integrate-shamir-partTwo
hadasz Nov 11, 2018
c306a3d
integrated in secure storage and private key generation
Nov 12, 2018
0b8e4a2
fixed trailing comma
Nov 12, 2018
a30c5d5
took out embarassingly shameless plug for self in example app
Nov 12, 2018
2f71b3e
altered readme
Nov 12, 2018
57a9675
readme
Nov 12, 2018
9e8cc8c
added develop to travs.yml
Nov 12, 2018
8220a90
Merge pull request #9 from ConsenSys/aes
hadasz Nov 12, 2018
3a85f36
changed npm auth token in travis.yml
Nov 12, 2018
b4b5c78
wrote some more tests
Nov 13, 2018
23fb731
integrated in IPFS
Nov 13, 2018
a71c055
made exported function names more descriptive
Nov 13, 2018
e373590
made it prettier
Nov 13, 2018
f6efb05
Merge pull request #12 from ConsenSys/ipfs
hadasz Nov 13, 2018
d1307d1
added encrypted auth token
Nov 14, 2018
0518cbd
deploy to npm on releases to develop
Nov 14, 2018
71b7d5e
edited the installation section
Nov 14, 2018
0d24995
added usage to readme
Nov 14, 2018
35bc2ee
added develop to travis pipeline
Nov 14, 2018
d39fab7
Merge pull request #13 from ConsenSys/readme
hadasz Nov 14, 2018
fbd1e9b
Merge branch 'develop' into travis-deploy
hadasz Nov 14, 2018
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
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
e2e/
RNSecureRandom/__tests__
36 changes: 33 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,51 @@ module.exports = {
mocha: true
},
globals: {
__DEV__: false
__DEV__: false,
device: false,
element: false,
by: false
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:prettier/recommended'
],
plugins: ['react', 'react-native', 'jasmine', 'detox'],
plugins: ['react', 'react-native', 'jasmine', 'detox', 'jsdoc'],
settings: {
react: {
pragma: 'React',
version: '16.5.0'
}
},
rules: {
'react/display-name': 'off'
'react/display-name': 'off',
'jsdoc/check-param-names': 2,
'jsdoc/check-tag-names': 2,
'jsdoc/check-types': 2,
'jsdoc/newline-after-description': 2,
'jsdoc/require-hyphen-before-param-description': 2,
'jsdoc/require-param': 2,
'jsdoc/require-param-description': 2,
'jsdoc/require-param-type': 2,
'jsdoc/require-returns-description': 2,
'jsdoc/require-returns-type': 2,
'require-jsdoc': [
2,
{
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: true,
ArrowFunctionExpression: true
}
}
],
'valid-jsdoc': [
2,
{
requireReturn: false
}
]
}
};
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
language: node_js
node_js:
- '8'
- '8'
branches:
only:
- master
- master
- develop
deploy:
provider: npm
email: hadaszeilberger@gmail.com
api_key:
secure: qg/75hBj7lGkgKt2kuX7uGWQrKhqYLjqQPsDobVkMcnPNGprO8LRYUDDSPMvFbjSeiqdGdwdFgspkOYEljf1vlyS+N3huGm4Hj+WoEe/BW7lZZWROmrQamLChGuZ3H0iFL1SHLe32Ly+7mNvZ9hREPxozPgLRSYLDd+chtxCvvcErO2YFqcKCLjCso3kbDQXO24pbMpD42+ZJEJke0NLBNvbNJ16LG6o3nbvuAVRWd8zWgYafMAbZTbl9bqqXXf+pOf2z2zGtYxVN+rZE7XCW4J3nX4Ya/e1ymyHetugoeTtfxG05HCg5bguznYxJTJaMJSWiQNNCnTQELexZwyTLSPyYsw0dSvf57QSHGyQwxzqadcANn9O6JL6NNROBhpAM6sD52qDBxB9BBEsUwEtXQKMbEOTBQaIHdMKtZMZyinW77/m6XtTzwlmB9CsDN3fUDWAknqY+2foCioZeZvvvGWAbjJQ9eUQL1BUw+/hHtY7cOyvDC1ah4ljnUnIddKlNvZBBxWJbjU7x5S2zhjaayExPaxpd2k/f8RkcxB7URvdCbbxsrzieQ2OPer0ywHAOvyQyFTHtcE3x6PzUeB+dBGkBlS9jMKrR+7HmBp5FafD//uW1k/kMAh3HDkv0THYSYbeNgpmYXRZDLMx45st8SXmoZHF4oNoTHhBxSP5mMo=
on:
branch: develop
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant to put this into the develop branch? As it turns out sense there wasn't a condition before it looks like it was going to do it all releases no matter the branch anyway, so we could just revert this commit too?

tags: true
80 changes: 80 additions & 0 deletions ExampleGrinder/@
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
/*eslint no-unused-vars: "warn"*/
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { randomBitGenerator } from '../lib/randomBitGenerator.js';
import { SSSA } from '../lib/sssa';
import { base64ToBits, bin2hex } from '../lib/utils';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu'
});

type Props = {};

export default class App extends Component<Props> {
state = { randomBits: '', shamirShares: [''] };
async componentDidMount() {
let randomNumber = await randomBitGenerator(14);
let sssa = new SSSA(3);
let secret = 'aaA=';
let shares = await sssa.generateShares(secret, 7, 2, 1);
this.setState({
randomBits: randomNumber,
shamirShares: shares,
shareLength: this.verifyLengthOfShare(secret, 3)
});
console.warn(bin2hex(shares[0]).length);
}
verifyLengthOfShare(secret, coeffLength) {
var secretLengthInBits = base64ToBits(secret);
var expectedLength =
(Math.ceil(secretLengthInBits.length / coeffLength) + 1) * coeffLength;
console.warn(expectedLength);
}
render() {
return (
<View style={styles.container}>
<Text testID="welcome" style={styles.welcome}>
{this.state.randomBits}
</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text testID="randombits" style={styles.instructions}>
{this.state.randomBits.length}
</Text>
<Text testID="shares" style={styles.instructions}>
{this.state.shamirShares.length}
</Text>
<Text testID="oneShare" style={styles.instructions}>
{this.state.shamirShares[0].length === this.state.shareLength}
</Text>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF'
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5
}
});
49 changes: 36 additions & 13 deletions ExampleGrinder/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,48 @@
*/
/*eslint no-unused-vars: "warn"*/
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { generateSecureRandom } from '../RNSecureRandom/index';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu'
});

import { StyleSheet, Text, View } from 'react-native';
import {
encryptSplitAndSpreadSecret,
collectCombineAndDecryptSecret
} from '../index';
const secret = 'shamir';
type Props = {};
/**
* Main App, demonstrating how to use react-native-sssa in a project
*/
export default class App extends Component<Props> {
state = { shares: '', ipfsLocations: '', finalSecret: '' };

/**Runs after component mounts
* Good place for data fetching
*/
async componentDidMount() {
let locationsAndIv = await encryptSplitAndSpreadSecret(secret, 5, 3);
let combinedAndDecryptedSecret = await collectCombineAndDecryptSecret(
locationsAndIv.locations,
locationsAndIv.iv
);
this.setState({
shares: JSON.stringify(locationsAndIv.locations),
finalSecret: combinedAndDecryptedSecret
});
}
/**
*Renders the App
*@returns {React.Element} rendered component
*/
render() {
return (
<View style={styles.container}>
<Text testID="welcome" style={styles.welcome}>
Welcome to React Native!
<Text style={styles.welcome}>Secret</Text>
<Text style={styles.instructions}>{secret}</Text>
<Text testID="shares" style={styles.welcome}>
Array of locations
</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
<Text style={styles.instructions}>{this.state.shares}</Text>
<Text style={styles.welcome}>Secret Again!!</Text>
<Text style={styles.instructions}>{this.state.finalSecret}</Text>
</View>
);
}
Expand Down
Loading