Skip to content

Commit

Permalink
Re-enable ownKey functions and document in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Powersource committed Nov 2, 2023
1 parent c1ec519 commit aded020
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ These endpoints give you access to additional features, such as:
- `ssb.tribes.poBox.create(opts, cb)`
- `ssb.tribes.addPOBox(groupId, cb)`
- `ssb.tribes.poBox.get(groupId, cb)`
- **self-DM keys**
- `ssb.tribes.ownKeys.list(cb)`: returns a list of self-DM keyinfo. Always a length of 1 (only a list for historical reasons). The keyinfo has the format `{ key: Buffer, scheme: String }`.
- `ssb.tribes.ownKeys.register(key)`: sets the self-DM key (buffer).
- **managing people applying to join to a group**
- deprecated, please use [ssb-tribes-registration](https://gitlab.com/ahau/lib/ssb-plugins/ssb-tribes-registration)
- for the old docs, [see here](./README.deprecated.md)
Expand Down
28 changes: 12 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,24 +371,20 @@ function init (ssb, config) {
})
},
get: scuttle.group.getPOBox
}
},

// for internal use - ssb-ahau uses this for backups
// TODO: does ahau use this for backups though?
// i couldn't find a self.get function in box2 so we might have to add that if this is needed
// ownKeys: {
// list (cb) {
// onKeystoreReady(() => {
// cb(null, [keystore.self.get()])
// })
// },
// register (key, cb) {
// onKeystoreReady(() => {
// //ssb.box2.setOwnDMKey(key)
// keystore.self.set(key, cb)
// })
// }
// }
ownKeys: {
list (cb) {
ssb.box2.getOwnDMKey((err, dmKeyInfo) => {
if (err) return cb(Error("Couldn't get own dm key on ownKeys.list", { cause: err }))
return cb(null, [dmKeyInfo])
})
},
register (key) {
ssb.box2.setOwnDMKey(key)
}
}
}
}

Expand Down

0 comments on commit aded020

Please sign in to comment.