anproto -- authenticated non-networked protocol or another proto sha256 blobs signed with ed25519 keypairs anproto.com
ed25519 social protocols

add example that works with node.js

Changed files
+37 -2
+1 -1
README.md
··· 8 8 9 9 [anproto.com](https://anproto.com) 10 10 11 - + [Deno/Browser implementation](https://github.com/evbogue/anproto) [by Evbogue] 11 + + [JavaScript implementation](https://github.com/evbogue/anproto) [by Evbogue] 12 12 + [Golang implementation](https://github.com/vic/goan) [by Vic] 13 13 14 14 try it at [anproto.com/try](https://anproto.com/try) or use a client such as [wiredove](https://wiredove.net/)
+1 -1
ex.js
··· 3 3 const m = "Hello World"; 4 4 const h = await an.hash(m); 5 5 const k = await an.gen(); 6 - const s = await an.sign(m, k); 6 + const s = await an.sign(h, k); 7 7 const o = await an.open(s); 8 8 9 9 console.log(k);
+35
node_ex.js
··· 1 + // get an.js working in Node.js -- from https://github.com/vic/goan/blob/main/js_helper.js 2 + 3 + import { createRequire } from 'module'; 4 + const require = createRequire(import.meta.url); 5 + 6 + globalThis.self = { 7 + crypto: { 8 + getRandomValues: (buf) => { 9 + require('crypto').randomFillSync(buf); 10 + return buf; 11 + } 12 + } 13 + }; 14 + 15 + if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle === 'undefined') { 16 + globalThis.crypto = globalThis.crypto || {}; 17 + try { 18 + globalThis.crypto.subtle = require('crypto').webcrypto.subtle; 19 + } catch (e) { 20 + console.log(e) 21 + } 22 + } 23 + 24 + const { an } = await import('./an.js'); 25 + 26 + const m = "Hello World"; 27 + const h = await an.hash(m); 28 + const k = await an.gen(); 29 + const s = await an.sign(h, k); 30 + const o = await an.open(s); 31 + 32 + console.log(k); 33 + console.log(h); 34 + console.log(s); 35 + console.log(o);