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 ethEcies = require('eth-ecies'); | |
function encrypt(publicKey, userData) { | |
let userPublicKey = new Buffer(publicKey, 'hex'); | |
let bufferUserData = new Buffer(userData); | |
let encryptedUserData = ethEcies.encrypt(userPublicKey, bufferUserData); | |
return encryptedUserData.toString('base64'); | |
} |
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
<script src="https://unpkg.com/ipfs/dist/index.js"></script> | |
const node = new Ipfs() | |
node.on('ready', () => { | |
console.log('IPFS Ready'); | |
const file = 'File contents'; | |
let fileBuffer = new buffer.Buffer(file); | |
node.files.add(fileBuffer, (err, hash) => { |
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
<script src="https://unpkg.com/ipfs/dist/index.js"></script> | |
const node = new Ipfs() | |
node.on('ready', () => { | |
console.log("IPFS Ready"); | |
}); |
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
pragma solidity 0.4.15; | |
contract SharedStorage { | |
address public contractImplementation; | |
} | |
contract Forwardable { | |
/** | |
* @dev Performs a delegatecall and returns whatever the delegatecall returned (entire context execution will return!) | |
* @param _dst Destination address to perform the delegatecall |
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
pragma solidity ^0.4.20; | |
contract KeyValueStorage { | |
mapping(bytes32=>uint256) public uints; | |
mapping(bytes32=>bytes32) public bytes32s; | |
mapping(bytes32=>bool) public bools; | |
// And any other type you like | |
modifier onlyWhitelisted() { | |
_; |
NewerOlder