Skip to content

Instantly share code, notes, and snippets.

start (secret) -> return apiObject with [encrypt, decrypt] with plaintext secret stored in closure
encrypt (input) -> generate salt, iv, additionalData, -> generate hash from salt and secret -> generate key from hash -> encrypt with key -> return json string with salt, iv, additionalData, and encrypted data (edited)
decrypt(input) -> read salt, iv, additionalData -> generate hash from salt and secret -> generate key from hash -> decrypt with key -> return unecrypted data
and the 'encrypted text' includes plaintext metadata about the encryption settings (salt, iv, additionalData)
;(function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {
╭─{👘 } kumavis in ~/Development/Node/ethereum-address-generator
╰─± node example.js
Looking for an address starting with "abc".
tried 1000 identities.
tried 2000 identities.
tried 3000 identities.
tried 4000 identities.
tried 5000 identities.
tried 6000 identities.
Found after 6110 attempts!
10:46 <kumavis> maybe components could have some generic channel-generating hooks ?
10:46 <kumavis> render() { return inputBox( state.label, state.channels.bindValue('label') ) }
10:47 <kumavis> which could simplify to inputBox( state, 'label' )
10:47 <kumavis> so i dont have to create a channel that only updates a value directly passed in
10:48 <kumavis> right now i have to do inputBox(state.newIdentityAddress, state.channels.updateNewIdentityAddress)
10:48 <kumavis> function updateNewIdentityAddress(state, data) {
10:48 <kumavis> state.newIdentityAddress.set(data.text)
10:48 <kumavis> }
10:48 <kumavis> its just a lot of code to do one simple thing i feel
10:56 ⇐ alexandergugel quit ([email protected]) Remote host closed the connection
nm = NumberMachine()
nm.multiply(2)
nm.add(6)
nm.subtract(3)
nm.multiply(2)
nm(10) //=> 46
nm(0) //=> 6
nm(20) //=> 86
@kumavis
kumavis / gist:c654143c4bcdea21e618
Last active August 29, 2015 14:14
How to Mercury (kumavis style)

First define your component:

  • value types and defaults for each key
  • 'channels', actions that potentially modify state or perform i/o. triggered by button presses, mouse movements, etc
var Value = require('observ')
var Component = require('../lib/component.js')
var Wallet = require('../wallet/index.js')
var Identity = require('../identity/index.js')
var render = require('./render.js')
std=["top", "window", "location", "external", "chrome", "document", "define", "global", "cr", "ntp", "templateData", "Handler", "i18nTemplate"];Object.keys(window).filter(function(item){return std.indexOf(item)===-1})
function* addGenerator() {
var i = 0;
while (true) {
i += yield i;
}
}
var adder = addGenerator();
adder.next().value; // 0
adder.next(5).value; // 5
@kumavis
kumavis / gist:220699f0fc5d52e2cfc4
Last active August 29, 2015 14:13
Example of es6 transpile
var koa = require('koa');
var app = koa();
// logger
app.use(function *(next){
var start = new Date;
yield next;
var ms = new Date - start;
console.log('%s %s - %s', this.method, this.url, ms);
# Ethereum Browser - MIST Analogue
============== WHAT ============
### Goals:
(1) Identity Management
(2) Wallet App
(3) Contract Browser
(4) Dapp runtime environment