Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to db2 #96

Merged
merged 64 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
e78fb74
Switch to db2 (broken tests)
Powersource Oct 13, 2023
6327c55
Install box2 and replace some queries
Powersource Oct 13, 2023
c6af752
Fix init publish
Powersource Oct 13, 2023
15894e3
Use publish helper instead of hook
Powersource Oct 13, 2023
4b3324c
Replace link queries
Powersource Oct 14, 2023
bc16b7b
Load feedstate compat
Powersource Oct 14, 2023
ff57d16
Update ssb-crut to latest
Powersource Oct 15, 2023
d6db441
Use box2 publish in crut
Powersource Oct 15, 2023
2bcafd9
Start using box2 functions
Powersource Oct 15, 2023
2c49797
Remove unneeded check in create
Powersource Oct 15, 2023
de53bb5
Fix create tests
Powersource Oct 15, 2023
265e832
Remove logs
Powersource Oct 15, 2023
2d302b9
Fix list and get tests
Powersource Oct 15, 2023
a9cb983
Fix old query in invite test
Powersource Oct 16, 2023
cda1298
Mostly fix tangle tests
Powersource Oct 17, 2023
2fdb89a
Remove tangle cache to fix branching
Powersource Oct 17, 2023
54ee6e8
Fix listAuthors
Powersource Oct 17, 2023
9ab7c68
Use box2 with pobox support
Powersource Oct 18, 2023
0bf5c63
Use box2 fns in exclude listener
Powersource Oct 18, 2023
61f48bd
Fix subtribe test query
Powersource Oct 18, 2023
b203306
Disable some publish tests for now and leave comments
Powersource Oct 18, 2023
aaa0d9a
Fix listeners not emitting newly decrypted
Powersource Oct 18, 2023
9fa098c
Fix invite test getting stuck without rebuild hook
Powersource Oct 18, 2023
c4c4b2c
Skip rebuild-manager tests and fix rebuild test
Powersource Oct 19, 2023
5bc9829
Fix a rebuild test
Powersource Oct 19, 2023
1444043
Fix the rest of the rebuild tests
Powersource Oct 19, 2023
6951c93
Skip unbox tests and format
Powersource Oct 19, 2023
e702f62
Fix lint issues
Powersource Oct 19, 2023
33d73a3
Make flaky rebuild test async
Powersource Oct 19, 2023
68323e9
Remove envelope file
Powersource Oct 20, 2023
6b7a01e
Remove onKeystoreReady
Powersource Oct 20, 2023
dd62bad
Remove some keystore usage
Powersource Oct 20, 2023
55d9754
Remove keystore refs and uninstall keyring
Powersource Oct 20, 2023
e0f8e67
Fix lint
Powersource Oct 20, 2023
45c5779
Update readme and deps
Powersource Oct 20, 2023
0584f80
Remove db1 plugins
Powersource Oct 20, 2023
8a5ed09
Use fast equal in link fns
Powersource Oct 24, 2023
2f07fbe
Remove rebuild manager
Powersource Oct 24, 2023
65eb1c5
Remove indexes check tests
Powersource Oct 24, 2023
9ff3384
Remove test for envelope self dm hack
Powersource Oct 24, 2023
6d97ded
Allow feed ids in first recps slot
Powersource Oct 24, 2023
75cd723
Fix unbox test
Powersource Oct 24, 2023
8b10fc8
Make group tangle query faster
Powersource Oct 24, 2023
109e5c6
Remove commented code
Powersource Oct 24, 2023
787b76f
Uninstall obz
Powersource Oct 24, 2023
3d6a5d9
Uninstall level
Powersource Oct 24, 2023
fd907e8
Uninstall futoin-hkdf and mkdirp
Powersource Oct 24, 2023
e5d5d32
Uninstall charwise
Powersource Oct 24, 2023
63a5f9c
Remove unbox vectors (moved to envelope-spec)
Powersource Oct 25, 2023
191da5a
Remove 10sec timeout on testbot close
Powersource Oct 26, 2023
38d58d0
Correct readme on when encryption happens
Powersource Oct 26, 2023
af5b060
Remove blank line in readme
Powersource Oct 26, 2023
4a03bc0
Move publish function out into own thing
Powersource Oct 26, 2023
bab331b
Document tribes.publish
Powersource Oct 26, 2023
50eb790
Put into subheading
Powersource Oct 26, 2023
10cb328
Merge pull request #104 from ssbc/no-close-timeout
Powersource Oct 26, 2023
0809c99
Use box2 release with pobox
Powersource Oct 30, 2023
fcb1245
Update box2 version in readme
Powersource Oct 30, 2023
68a4045
Rename seek index
Powersource Oct 30, 2023
2d8be0c
Simplify reindexed stream
Powersource Oct 30, 2023
20c7c21
Remove commented code
Powersource Oct 30, 2023
6428831
Update comment in add member fn
Powersource Oct 30, 2023
2f01a5f
Filter pobox listener more
Powersource Oct 31, 2023
dcec468
Change lint parent child index names
Powersource Oct 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ const config = require('ssb-config')
const caps = require('ssb-caps')

const stack = SecretStack({ caps })
.use(require('ssb-db')) // << required
.use(require('ssb-backlinks')) // << required index
.use(require('ssb-query')) // << required index
.use(require('ssb-tribes'))
.use(require('ssb-private1')) // if you want to support old decryption
// *order matters*, load tribes first
.use(require('ssb-db2/core'))
.use(require('ssb-classic'))
.use(require('ssb-db2/compat'))
.use(require('ssb-db2/compat/feedstate'))
.use(require('ssb-box2'))
.use(...)

const ssb = stack(config)
const ssb = stack({
...config,
box2: {
...config.box2,
legacyMode: true
}
})
```


Expand All @@ -34,7 +39,7 @@ ssb.tribes.create({}, (err, info) => {
test: 'kia ora, e te whānau',
recps: [groupId] // <<< you can now put a groupId in the recps
}
ssb.publish(content, (err, msg) => {
ssb.tribes.publish(content, (err, msg) => {
mixmix marked this conversation as resolved.
Show resolved Hide resolved
// tada msg is encrypted to group!

const cookie = '@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1xbz8=.ed25519'
Expand All @@ -53,7 +58,7 @@ ssb.tribes.create({}, (err, info) => {

This plugin provides functions for creating groups and administering things about them, but it also provides a bunch of "automatic" behviour.

1. **When you publish a message with `recps` it will auto-encrypt** the content when:
1. **When you publish a message with `recps` using `ssb.tribes.publish` it will auto-encrypt** the content when:
- there are 1-16 FeedIds (direct mesaaging)
- there is 1 GroupId (private group messaging)
- there is 1 GroupId followed by 1-15 FeedId
Expand All @@ -78,14 +83,22 @@ This plugin provides functions for creating groups and administering things abou
## Requirements

A Secret-Stack server running the plugins:
- `ssb-db` >= 20.3.0
- `ssb-db2/core` >= 7.1.1
- `ssb-classic`
- `ssb-tribes`
- `ssb-backlinks` >= 2.1.1 - used for adding group tangle meta data to messages
- `ssb-query` >= 2.4.5 - used for listing groups linked to your feedId, or subgroup linked to groups
- `ssb-db2/compat`
- `ssb-db2/compat/feedstate`
- `ssb-box2` >= 7.2.0
- `ssb-replicate` - (optional) used to auto-replicate people who you're in groups with

The secret stack option `config.box2.legacyMode` also needs to be `true`.

## API

### `ssb.tribes.publish(content, cb)`

A wrapper around `ssb.db.create` that makes sure you have correct tangles (if relevant) in your message. Mutates `content`. You need to put recipients in `content.recps` if you want it to be encrypted.

### `ssb.tribes.create(opts, cb)`

Mint a new private group.
Expand Down Expand Up @@ -325,4 +338,3 @@ Find subGroups which have linked with a groupId (see `ssb.tribes.link.createSubG
## TODO

- [ ] add the latest known "sequence" at time of add-member, so we know if we need to reindex!

148 changes: 0 additions & 148 deletions envelope.js

This file was deleted.

Loading