aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-02-03 17:19:37 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-02-03 17:19:37 -1000
commit2ebbca91a4fd8ac957a0bbe3335827a17746771f (patch)
tree5b3a310c70ae019229570f5b69664cd3f6a59e30 /lib
parent8985feb5e74cf17eb5e2a24977b677047c441fcc (diff)
downloadpatchfoo-2ebbca91a4fd8ac957a0bbe3335827a17746771f.tar.gz
patchfoo-2ebbca91a4fd8ac957a0bbe3335827a17746771f.zip
Render peer invites
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js4
-rw-r--r--lib/render-msg.js11
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/app.js b/lib/app.js
index 0cc2702..18bbb14 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -47,6 +47,10 @@ function App(sbot, config) {
var capsConfig = config.caps || {}
this.userInviteCap = capsConfig.userInvite
|| new Buffer('MxiG/9q04kN2C6vJQKa6ZhAj0G/FdfRkmeGTMnpsoek=', 'base64')
+ // sha256('user-invites:DEVELOPMENT')
+ this.peerInviteCap = capsConfig.peerInvite
+ || new Buffer('pmr+IzM+4VAZgi5H5bOopXkwnzqrNussS7DtAJsfbf0=', 'base64')
+ // sha256('peer-invites:DEVELOPMENT')
*/
var host1 = /:/.test(this.host) ? '[' + this.host + ']' : this.host
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 2720751..357edbe 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -341,7 +341,8 @@ RenderMsg.prototype.message = function (cb) {
case 'address': return this.address(cb)
case 'pub-owner-announce': return this.pubOwnerAnnounce(cb)
case 'pub-owner-confirm': return this.pubOwnerConfirm(cb)
- case 'user-invite': return this.userInvite(cb)
+ case 'user-invite':
+ case 'peer-invite': return this.peerInvite(cb)
default: return this.object(cb)
}
}
@@ -788,8 +789,8 @@ RenderMsg.prototype.pubOwnerConfirm = function (cb) {
], cb)
}
-RenderMsg.prototype.userInvite = function (cb) {
- this.wrapMini('user invite', cb)
+RenderMsg.prototype.peerInvite = function (cb) {
+ this.wrapMini('peer invite', cb)
/*
var self = this
var invite = this.c.invite
@@ -797,14 +798,14 @@ RenderMsg.prototype.userInvite = function (cb) {
var author = this.msg.value.author
// this.c.private
// this.c.reveal
- var isValid = ssbKeys.verifyObj(invite, this.serve.app.userInviteCap, this.c)
+ var isValid = ssbKeys.verifyObj(invite, this.serve.app.peerInviteCap, this.c)
if (host && host !== author) self.link(host, gotHostLink)
else gotHostLink()
function gotHostLink(err, hostLink) {
if (err) return cb(err)
self.wrap([
isValid ? 'valid ' : 'invalid ',
- 'user invite',
+ 'peer invite',
hostLink ? [' from ', hostLink] : '',
h('a', {href: self.toUrl(invite)}, u.truncate(invite, 10)),
], cb)