Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/toyobayashi/wasm-demo
https://github.com/toyobayashi/wasm-demo
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/toyobayashi/wasm-demo
- Owner: toyobayashi
- Created: 2020-06-02T10:29:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-07T05:04:22.000Z (over 4 years ago)
- Last Synced: 2024-11-05T22:46:07.096Z (about 2 months ago)
- Language: C++
- Size: 314 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wasm-demo
AJAX encryption demo based on WebAssembly.
Client: use `public/crypto.wasm` and `public/crypto.js`
Server: use `build/Release/addon.node`
## Example
request:
`{"a":1,"b":"2","c":true,"d":["list","item"],"e":null}`
==== Client `Module.encryptJson(request: any): base64 string` ====>
`4921999568155729cEgfKvCXPwElpWXWr9xxzFirFco4u9Nai0/VZOa8Q8x3pCekR5vWmuaW+9hvtT3y`
response:
`7291012914083737w75+D0LFkJTqi1rk26KvZwfKpRgdjgO0COGijyUlNdTr3W16ROSkQWQHLpffqG4Izm6wwJmyAlRIYveC5lc0C/uWdcl4f4ozAzSM8BWJ4wk=`
==== Client `Module.decryptJson(response: base64 string): JavaScript Object` ====>
``` js
{
code: 0,
data: {
a: 1,
b: '2',
c: true,
d: ['list', 'item'],
e: null
},
error: null,
message: 'OK'
}
```## Require:
* Node.js
* System C/C++ compiler tool chain (cl.exe / gcc / clang)
## Build
``` bash
$ npm install
$ npm run build
```Defines: `CRYPTO_ENC_KEY` & `CRYPTO_DEC_KEY`, opposite from server and client
## Run
``` bash
$ npm start
````http://127.0.0.1:8096`