anproto -- authenticated non-networked protocol or another proto sha256 blobs signed with ed25519 keypairs anproto.com
ed25519 social protocols
at main 830 B view raw
1// get an.js working in Node.js -- from https://github.com/vic/goan/blob/main/js_helper.js 2 3import { createRequire } from 'module'; 4const require = createRequire(import.meta.url); 5 6globalThis.self = { 7 crypto: { 8 getRandomValues: (buf) => { 9 require('crypto').randomFillSync(buf); 10 return buf; 11 } 12 } 13}; 14 15if (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 24const { an } = await import('./an.js'); 25 26const m = "Hello World"; 27const h = await an.hash(m); 28const k = await an.gen(); 29const s = await an.sign(h, k); 30const o = await an.open(s); 31 32console.log(k); 33console.log(h); 34console.log(s); 35console.log(o);