aboutsummaryrefslogtreecommitdiff
path: root/bog.js
diff options
context:
space:
mode:
authorEv Bogue <ev@evbogue.com>2019-04-25 21:16:17 -0500
committerEv Bogue <ev@evbogue.com>2019-04-25 21:16:17 -0500
commitbd14700d559f08e1585cf6ae40b6f78c9cd295eb (patch)
tree0832194cbe8a8eb43be0ce5750f0d254a6896021 /bog.js
parent48dbaa05211d817b63a0acbcf425b7c15400a259 (diff)
this isnt quite working yet, but commiting anyway
Diffstat (limited to 'bog.js')
-rw-r--r--bog.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/bog.js b/bog.js
index aa347ce..26cc409 100644
--- a/bog.js
+++ b/bog.js
@@ -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)))