Skip to content

Commit

Permalink
House keeping
Browse files Browse the repository at this point in the history
Update example
Bowser and node suppoer
  • Loading branch information
Lewis Freiberg committed Oct 23, 2017
1 parent b210b03 commit 9e8e03b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"env",
{
"targets": {
"browsers": ["last 2 versions"],
"node": "current"
"browsers": "> 5%",
"node": "4.1.1"
},
"debug": true
}
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Additionally, due to quirks in the `rust-wasm-loader` you will need to adjust th
```javascript
// Install dependencies
yarn
// Install submodules
git submodule update --init --recursive
// Build for web
yarn web -- --env.path=serving/path/here/
```
Expand All @@ -30,12 +32,12 @@ The below command will build a file called `mam.node.js` in the `lib/` directory
```javascript
// Install dependencies
yarn
// Install submodules
git submodule update --init --recursive
// Build for node
yarn node
```



## Concepts

#### Security Levels
Expand All @@ -45,3 +47,6 @@ Public - Root is equal to address and the side key is ‘999999…’
Private - WIP

Restricted - WIP



4 changes: 2 additions & 2 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var Mam = require('../static/mam.node.js')
var Mam = require('../lib/mam.node.js')
var IOTA = require('iota.lib.js')
var iota = new IOTA({ provider: `http://p101.iotaledger.net:14700/` })
var iota = new IOTA({ provider: `http://p103.iotaledger.net:14700/` })

const example = async () => {
// Init State
Expand Down
14 changes: 7 additions & 7 deletions lib/mam.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9130,7 +9130,7 @@ function getMamRoot(SEED, CHANNEL) {
}

function createMessage(SEED, MESSAGE, SIDE_KEY, CHANNEL) {
if (!SIDE_KEY) SIDE_KEY = '999999999999999999999999999999999999999999999999999999999999999999999999999999999';
if (!SIDE_KEY) SIDE_KEY = `999999999999999999999999999999999999999999999999999999999999999999999999999999999`;
// MAM settings
var SEED_trits = string_to_ctrits_trits(SEED);
var MESSAGE_trits = string_to_ctrits_trits(MESSAGE);
Expand Down Expand Up @@ -9175,7 +9175,7 @@ function createMessage(SEED, MESSAGE, SIDE_KEY, CHANNEL) {
}

function decodeMessage(PAYLOAD, SIDE_KEY, ROOT) {
if (!SIDE_KEY) SIDE_KEY = '999999999999999999999999999999999999999999999999999999999999999999999999999999999';
if (!SIDE_KEY) SIDE_KEY = `999999999999999999999999999999999999999999999999999999999999999999999999999999999`;

var PAYLOAD_trits = string_to_ctrits_trits(PAYLOAD);
var SIDE_KEY_trits = string_to_ctrits_trits(SIDE_KEY);
Expand Down Expand Up @@ -9302,7 +9302,7 @@ var create = function create(state, message) {
channel.next_root = mam.next_root;
state.channel = channel;
return {
state: state,
state,
payload: mam.payload,
root: mam.root
};
Expand Down Expand Up @@ -19446,10 +19446,10 @@ function decrypt(message, key, salt) {
}

module.exports = {
encrypt: encrypt,
decrypt: decrypt,
increment: increment,
hash: hash
encrypt,
decrypt,
increment,
hash
};

/***/ }),
Expand Down
16 changes: 8 additions & 8 deletions lib/mam.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -22152,7 +22152,7 @@ wasm.initialize({ noExitRuntime: true }).then(function (IOTA) {
}

function createMessage(SEED, MESSAGE, SIDE_KEY, CHANNEL) {
if (!SIDE_KEY) SIDE_KEY = '999999999999999999999999999999999999999999999999999999999999999999999999999999999';
if (!SIDE_KEY) SIDE_KEY = `999999999999999999999999999999999999999999999999999999999999999999999999999999999`;
// MAM settings
var SEED_trits = string_to_ctrits_trits(SEED);
var MESSAGE_trits = string_to_ctrits_trits(MESSAGE);
Expand Down Expand Up @@ -22197,7 +22197,7 @@ wasm.initialize({ noExitRuntime: true }).then(function (IOTA) {
}

function decodeMessage(PAYLOAD, SIDE_KEY, ROOT) {
if (!SIDE_KEY) SIDE_KEY = '999999999999999999999999999999999999999999999999999999999999999999999999999999999';
if (!SIDE_KEY) SIDE_KEY = `999999999999999999999999999999999999999999999999999999999999999999999999999999999`;

var PAYLOAD_trits = string_to_ctrits_trits(PAYLOAD);
var SIDE_KEY_trits = string_to_ctrits_trits(SIDE_KEY);
Expand Down Expand Up @@ -22248,7 +22248,7 @@ var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var m
});
}
}
})({"wasmBinaryFile":"lib/iota-bindings-emscripten.wasm","ENVIRONMENT":"WEB"})
})({"wasmBinaryFile":"/iota-bindings-emscripten.wasm","ENVIRONMENT":"WEB"})
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(41), __webpack_require__(6).Buffer))

/***/ }),
Expand Down Expand Up @@ -31862,7 +31862,7 @@ var create = function create(state, message) {
channel.next_root = mam.next_root;
state.channel = channel;
return {
state: state,
state,
payload: mam.payload,
root: mam.root
};
Expand Down Expand Up @@ -42008,10 +42008,10 @@ function decrypt(message, key, salt) {
}

module.exports = {
encrypt: encrypt,
decrypt: decrypt,
increment: increment,
hash: hash
encrypt,
decrypt,
increment,
hash
};

/***/ }),
Expand Down
12 changes: 6 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin
const path = require('path')
const env = require('yargs').argv.env // use --env with webpack 2

let output = env.path !== undefined ? env.path : 'lib/'
let libraryName = 'mam.'
let entry
let target
let outputFile
let rules = [
var output = env.path !== undefined ? env.path : 'lib/'
var libraryName = 'mam.'
var entry
var target
var outputFile
var rules = [
{
test: /(\.jsx|\.js)$/,
loader: 'babel-loader',
Expand Down

0 comments on commit 9e8e03b

Please sign in to comment.