+++ /dev/null
-/* jshint devel:true */
-"use strict";
-console.log('Welcome to iotjs-www', '\n\n');
-// set up the base line..
-// Using browserify to set up browser exports
-var crypto = require('crypto-js');
-var _ = require('underscore');
-var ByteBuffer = require('bytebuffer');
-var hash = require('object-hash');
-var forge = require('node-forge');
-(function() {
- var root = this;
- // iot namespace main constructor
- var iot = function(obj) {
- if (obj instanceof iot) return obj;
- if (!(this instanceof iot)) return new iot(obj);
- this.iot = obj;
- };
- // export iot to the global exports
- if (typeof exports !== 'undefined') {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports = iot;
- }
- exports.iot = iot;
- } else {
- root.iot = iot;
- }
-
-
- iot.baselinetest = function() {
- // baseline test
- console.log('its alive!!!');
- console.log();
-
-
- //local hash test
- console.log(hash('hello man'));
- console.log(typeof hash('hello man'));
- console.log();
-
-
- //Pair test
- var p = new Pair(1, 2);
- console.log(p.toString());
- console.log();
-
-
- //iotstring test
- var i = new IoTString('hello');
- console.log(i.length());
- console.log();
-
-
- //local crypto test
- var data = [{id: 1}, {id: 2}];
- // Encrypt
- var ciphertext = crypto.AES.encrypt(JSON.stringify(data), 'secret key 123');
- // Decrypt
- var bytes = crypto.AES.decrypt(ciphertext.toString(), 'secret key 123');
- var decryptedData = JSON.parse(bytes.toString(crypto.enc.Utf8));
- // console.log(decryptedData);
-
- var e = crypto.HmacMD5("Message", "Secret Passphrase");
- console.log(typeof e.toString());
- }
-}())
\ No newline at end of file