diff options
author | Ev Bogue <ev@evbogue.com> | 2019-04-25 21:16:17 -0500 |
---|---|---|
committer | Ev Bogue <ev@evbogue.com> | 2019-04-25 21:16:17 -0500 |
commit | bd14700d559f08e1585cf6ae40b6f78c9cd295eb (patch) | |
tree | 0832194cbe8a8eb43be0ce5750f0d254a6896021 /bog.js | |
parent | 48dbaa05211d817b63a0acbcf425b7c15400a259 (diff) |
this isnt quite working yet, but commiting anyway
Diffstat (limited to 'bog.js')
-rw-r--r-- | bog.js | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -25,7 +25,15 @@ async function keys (key) { publicKey: '@' + nacl.util.encodeBase64(genkey.publicKey), privateKey: nacl.util.encodeBase64(genkey.secretKey) } - localforage.setItem('id', keypair) + if (keypair.publicKey.includes('/')) { + console.log('TRYING AGAIN') + setTimeout(function () { + location.reload() + }, 10) + } else { + localforage.setItem('id', keypair) + } + return keypair } } @@ -103,7 +111,7 @@ async function publish (post, keys) { } else { - post.seq = 0 + post.seq = 1 message.key = '%' + nacl.util.encodeBase64(nacl.hash(nacl.util.decodeUTF8(JSON.stringify(post)))), message.signature = nacl.util.encodeBase64(nacl.sign(nacl.util.decodeUTF8(JSON.stringify(post)), nacl.util.decodeBase64(keys.privateKey))) |