This file contains hidden or 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
| let options = {}; | |
| if (!__DEV__) { | |
| options = { | |
| key: fs.readFileSync('./ssl/key.pem', 'utf8'), | |
| cert: fs.readFileSync('./ssl/cert.pem', 'utf8'), | |
| }; | |
| } | |
| const server = __DEV__ ? app : https.createServer(options, app); |
This file contains hidden or 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
| export async function setItem(key: string, value: string) { | |
| try { | |
| return Keychain.setGenericPassword(key, encrypt(value), { | |
| service: `${BUNDLE_ID}.${key}`, | |
| }); | |
| } catch (error) { | |
| Logger.warn(error.message); | |
| return null; | |
| } | |
| } |
This file contains hidden or 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
| let aes256key: ?Array<number>; | |
| sha256([brand, deviceId, ...otherIds].join('')).then( | |
| (hash: string) => { | |
| aes256key = Array.from( | |
| Array.from(hash) | |
| .map((c, i) => (i % 2 ? c : null)) | |
| .filter(Boolean) | |
| .map(c => c.charCodeAt(0)) | |
| ); |
This file contains hidden or 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
| const decrypt = (encryptedHex: string) => { | |
| const encryptedBytes = aes.utils.hex.toBytes(encryptedHex); | |
| const aesCtr = new aes.ModeOfOperation.ctr(aes256key); | |
| const decryptedBytes = aesCtr.decrypt(encryptedBytes); | |
| const decryptedText = aes.utils.utf8.fromBytes(decryptedBytes); | |
| return decryptedText; | |
| }; |
This file contains hidden or 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
| const encrypt = (text: string) => { | |
| const textBytes = aes.utils.utf8.toBytes(text); | |
| const aesCtr = new aes.ModeOfOperation.ctr(aes256key); | |
| const encryptedBytes = aesCtr.encrypt(textBytes); | |
| const encryptedHex = aes.utils.hex.fromBytes(encryptedBytes); | |
| return encryptedHex; | |
| }; |
This file contains hidden or 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
| export const encryptXOR = (text: string, key: string) => { | |
| const bytes = utf8.encode(text); | |
| const output = []; | |
| for (let i = 0; i < bytes.length; i++) { | |
| output[i] = String.fromCharCode( | |
| bytes[i].charCodeAt(0) ^ key[i % key.length].charCodeAt(0) | |
| ); | |
| } |
This file contains hidden or 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
| import * as React from 'react' | |
| import { View, Scene, PointLight, Animated } from 'react-vr' | |
| import Planet from './Planet' | |
| import Sun from './Sun' | |
| class App extends React.Component { | |
| render() { | |
| return ( | |
| <Scene |
This file contains hidden or 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
| import * as React from 'react' | |
| import { Sphere, PointLight, View, asset } from 'react-vr' | |
| class Sun extends React.Component { | |
| render() { | |
| return ( | |
| <View> | |
| <Sphere | |
| radius={5} | |
| widthSegments={30} |
This file contains hidden or 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
| import React from 'react' | |
| /*...*/ | |
| import AnimatedMath from 'react-native-animated-math' | |
| /*...*/ | |
| export default class Globe extends React.Component { | |
| /*...*/ | |
| rotation = new Animated.Value(0) | |
| componentDidMount() { | |
| this.spinAround() |
This file contains hidden or 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
| import React from 'react'; | |
| import { | |
| AppRegistry, | |
| Sphere, | |
| asset, | |
| View, | |
| PointLight, | |
| Animated, | |
| } from 'react-vr'; | |
| import { Easing } from 'react-native'; |
NewerOlder