| … | … | @@ -61,12 +61,16 @@ bogbot.sign = async (data) => { |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | bogbot.open = async (msg) => { |
| 64 | | const pubkey = msg.substring(0, 44) |
| 65 | | const sig = msg.substring(44) |
| 64 | try { |
| 65 | const pubkey = msg.substring(0, 44) |
| 66 | const sig = msg.substring(44) |
| 66 | 67 | |
| 67 | | const opened = new TextDecoder().decode(nacl.sign.open(decode(sig), decode(pubkey))) |
| 68 | const opened = new TextDecoder().decode(nacl.sign.open(decode(sig), decode(pubkey))) |
| 68 | 69 | |
| 69 | | return opened |
| 70 | return opened |
| 71 | } catch (err) { |
| 72 | console.log('Not a valid Bog5 protocol message') |
| 73 | } |
| 70 | 74 | } |
| 71 | 75 | |
| 72 | 76 | import { yaml } from './lib/yaml.js' |