mono
This commit is contained in:
parent
7db60975fa
commit
e1a2675097
4
client/.gitignore
vendored
Normal file
4
client/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package-lock.json
|
||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
.cache/
|
||||||
5
client/index.html
Executable file
5
client/index.html
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script src="./index.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
19
client/index.js
Executable file
19
client/index.js
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
const cbor = require('borc');
|
||||||
|
const assert = require('assert');
|
||||||
|
// Create WebSocket connection.
|
||||||
|
const ws = new WebSocket('ws://localhost:40000');
|
||||||
|
ws.binaryType = 'arraybuffer';
|
||||||
|
|
||||||
|
// Connection opened
|
||||||
|
ws.addEventListener('open', function (event) {
|
||||||
|
ws.send(cbor.encode({ method: 'cryp_generate', params: { level: 64 }}));
|
||||||
|
ws.send(cbor.encode({ method: 'account_create', params: { name: 'ntr' }}));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listen for messages
|
||||||
|
ws.addEventListener('message', function (event) {
|
||||||
|
console.log('Message from server ', event.data);
|
||||||
|
const blob = new Uint8Array(event.data);
|
||||||
|
const decoded = cbor.decodeAll(blob);
|
||||||
|
console.log(decoded[0]);
|
||||||
|
});
|
||||||
17
client/package.json
Executable file
17
client/package.json
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "cryps-client",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "parcel index.html",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"dependencies": {
|
||||||
|
"borc": "^2.0.3",
|
||||||
|
"cbor": "^4.1.1",
|
||||||
|
"parcel": "^1.9.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
0
.gitignore → server/.gitignore
vendored
0
.gitignore → server/.gitignore
vendored
Loading…
x
Reference in New Issue
Block a user