diff --git a/.gitignore b/.gitignore index 01272de..4f62747 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ examples.mk json-rpc/ -supernode/websocket_chat -supernode/floaddress.org.html -supernode/Makefile -playground \ No newline at end of file +supernode/playground/ +playground diff --git a/supernode/Makefile b/supernode/Makefile new file mode 100644 index 0000000..2fbb694 --- /dev/null +++ b/supernode/Makefile @@ -0,0 +1,3 @@ +PROG = websocket_chat +MODULE_CFLAGS = -DMG_ENABLE_FILESYSTEM=1 +include ../examples.mk diff --git a/supernode/ecdsa.html b/supernode/ecdsa.html deleted file mode 100644 index 9a54964..0000000 --- a/supernode/ecdsa.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - WebCrypto API Demo: ECDSA Generate Keys Sign Verify Message - - - - -

Generate ECDSA Public Private Keys and perform Sign and Verify Message

- -
- - Named Curve - - Input Text to Signed - - - - -
- -
- Signature Output (Hex)
- ECDSA Public Key (JWK) :
- ECDSA Private Key (JWK): -
- - -
Thanks for downloading the code, if you like it Support 8gwifi.org By purchasing The Modern Cryptography Cookbook - - - - \ No newline at end of file diff --git a/supernode/index.html b/supernode/index.html deleted file mode 100644 index a5c40e4..0000000 --- a/supernode/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - WebSocket Test - - - - - - -
-

Websocket PubSub Demonstration

- -

- This page demonstrates how Mongoose could be used to implement - - publish–subscribe pattern. Open this page in several browser - windows. Each window initiates persistent - WebSocket - connection with the server, making each browser window a websocket client. - Send messages, and see messages sent by other clients. -

- -
-
- -

- - -

-
- - diff --git a/supernode/json-rpc.js b/supernode/json-rpc.js deleted file mode 100644 index 5012ba5..0000000 --- a/supernode/json-rpc.js +++ /dev/null @@ -1,189 +0,0 @@ -/* - The MIT License (MIT) - - Copyright (c) 2014 Oliver Moran - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -*/ - -var JSON_RPC = {}; - - - - var id = 0, callbacks = {}; - - /** - * Constructs a new JSON-RPC Request - * @param method A String containing the name of the method to be invoked. - * @param params (optional) A Structured value that holds the parameter values to be used during the invocation of the method. - */ - JSON_RPC.Request = function (method, params) { - this.jsonrpc = "2.0"; - this.method = method; - if (typeof params !== "undefined") { - this.params = params; - } - - this.id = id++; - }; - - // Implements getters and setters for the result of a JSON-RPC Request. - // The result may be an any Object or primitive - Object.defineProperty(JSON_RPC.Request.prototype, "result", { - get: function () { return this._result; }, - set: function (result) { - delete this.method; // remove the method name - delete this.params; // remove the params - delete this.error; // remove error state if it exists - this._result = result; - } - }); - - // Implements getters and setters for the error state of a JSON-RPC Request. - // Error should be a JSON_RPC.Error object - Object.defineProperty(JSON_RPC.Request.prototype, "error", { - get: function () { return this._error; }, - set: function (error) { - delete this.method; // remove the method name - delete this.params; // remove the params - delete this.result; // remove result state if it exists - this._error = error; - } - }); - - /** - * Returns a String representation of a JSON-RPC Request - * @returns A JSON String - */ - JSON_RPC.Request.prototype.toString = function () { - var rpc = { - jsonrpc: this.jsonrpc, - id: this.id - }; - - if (this.method !== undefined) rpc.method = this.method; - if (this.params !== undefined) rpc.params = this.params; - if (this.result !== undefined) rpc.result = this.result; - if (this.error !== undefined) rpc.error = this.error; - - return JSON.stringify(rpc); - }; - - /** - * Constructs a new JSON-RPC Notification - * @param method A String containing the name of the method to be invoked. - * @param params (optional) A Structured value that holds the parameter values to be used during the invocation of the method. - */ - JSON_RPC.Notification = function (method, params) { - this.jsonrpc = "2.0"; - this.method = method; - if (typeof params !== "undefined") { - this.params = params; - } - }; - - /** - * Returns a String representation of a JSON-RPC Notification - * @returns A JSON String - */ - JSON_RPC.Notification.prototype.toString = function () { - var rpc = { - jsonrpc: this.jsonrpc, - method: this.method, - params: this.params - }; - - return JSON.stringify(rpc); - }; - - /** - * Constructs a new JSON-RPC Errror object - * @params code A Number that indicates the error type that occurred. -32768 to -32000 are reserved. - * @param message (optional) A String providing a short description of the error. - * @param data (optional) A Primitive or Structured value that contains additional information about the error. - */ - JSON_RPC.Error = function (code, message, data) { - this.code = code; - if (typeof message == "string") this.message = message; - if (data !== undefined) this.data = data; - }; - - // stock errors - JSON_RPC.PARSE_ERROR = new JSON_RPC.Error(-32700, "An error occurred on the server while parsing the JSON text."); - JSON_RPC.INVALID_REQUEST = new JSON_RPC.Error(-32600, "The JSON sent is not a valid Request object."); - JSON_RPC.METHOD_NOT_FOUND = new JSON_RPC.Error(-32601, "The method does not exist / is not available."); - JSON_RPC.INVALID_PARAMS = new JSON_RPC.Error(-32602, "Invalid method parameter(s)."); - JSON_RPC.INTERNAL_ERROR = new JSON_RPC.Error(-32603, "Internal JSON-RPC error."); - - /** - * Parses a JSON-RPC string and converts to a JSON-RPC object or an Array of such strings. - * @params rpc A String or Array to parse to a JSON-RPC object. - */ - JSON_RPC.parse = function (rpc) { - // batch? - if (rpc.constructor === Array) { - var arr = []; - rpc.forEach(function (el) { - arr.push(JSON_RPC.parse(el)); - }); - return arr; - } - - // parsable? - var rpc; - try { - rpc = JSON.parse(rpc); - } catch (err) { - var obj = new JSON_RPC.Request(); - obj.result = JSON_RPC.PARSE_ERROR; - obj.id = null; - return obj; - } - - // 2.0? - if (rpc.jsonrpc !== "2.0") { - var obj = new JSON_RPC.Request(); - obj.result = JSON_RPC.INVALID_REQUEST; - obj.id = null; - return obj; - } - - // request or notification? - var obj = (rpc.id === undefined) - ? new JSON_RPC.Notification(rpc.method, rpc.params) - : new JSON_RPC.Request(rpc.method, rpc.params); - // have an ID? - if (rpc.id !== undefined) obj.id = rpc.id; - // is it a result? - if (rpc.result !== undefined) obj.result = rpc.result; - // is it a error? - if (rpc.error !== undefined) { - obj.error = new JSON_RPC.Error( - rpc.error.code, - rpc.error.message, - rpc.error.data - ); - } - - // parsed :-) - return obj; - }; - - - diff --git a/supernode/websocket_chat b/supernode/websocket_chat new file mode 100755 index 0000000..643ecbb Binary files /dev/null and b/supernode/websocket_chat differ diff --git a/supernode/websocketc1.html b/supernode/websocketc1.html deleted file mode 100644 index 8dcd00b..0000000 --- a/supernode/websocketc1.html +++ /dev/null @@ -1,296 +0,0 @@ - - - LocalBitcoin++ Prototype - - -

Localbitcoin++ Prototype

- -
\ No newline at end of file