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

Add oldSecrets field to add-member #33

Merged
merged 3 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
6 changes: 6 additions & 0 deletions group/add-member/v2/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
'type',
'version',
'secret',
'oldSecrets',
'root',
'creator',
'recps',
Expand All @@ -32,6 +33,11 @@ module.exports = {
pattern: '^v2$'
},
secret: { $ref: '#/definitions/secret' },
oldSecrets: {
type: 'array',
items: [{ $ref: '#/definitions/secret' }],
minItems: 0
},
Comment on lines +35 to +39
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mixmix would it make sense to instead put this in the epoch inits? would save a lot of repetition, but would make initial replication of a group slower

(ps our meeting notes for reference ssbc/ssb-tribes2#76 (comment) )

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might have to add some special logic in tribes2 for this though which would mean more coding

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a bad idea... but would rather not right now - the problem is that the group/init doesn't necessarily know about all past epochs.... oh, well it does actually, just not the parallel ones.

There might be a problem with how many keys you could add to a new init.
I kinda like the idea the more I think about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is coded already and it's not too bad I'm gonna put this in this "stuff we could maybe do if we have more time" issue ssbc/ssb-group-exclusion-spec#30 and just merge

root: { $ref: '#/definitions/messageId' },
creator: { $ref: '#/definitions/feedId' },
text: { type: 'string' },
Expand Down
10 changes: 10 additions & 0 deletions group/add-member/v2/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type",
"version",
"secret",
"oldSecrets",
"root",
"creator",
"recps",
Expand All @@ -22,6 +23,15 @@
"secret": {
"$ref": "#/definitions/secret"
},
"oldSecrets": {
"type": "array",
"items": [
{
"$ref": "#/definitions/secret"
}
],
"minItems": 0
},
"root": {
"$ref": "#/definitions/messageId"
},
Expand Down
9 changes: 9 additions & 0 deletions test/add-member.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const Mock = (overwrite = {}) => {
type: 'group/add-member',
version: 'v2',
secret: Secret(),
oldSecrets: [Secret(), Secret()],
root: groupRoot,
creator: FeedId(),
text: 'welcome keks!', // optional
Expand Down Expand Up @@ -95,5 +96,13 @@ test('is-group-add-member', (t) => {
'%shGMltJNglMNLpxdnDGz/Y+j6HukBelnCS84D+GR2DM=.sha256'
t.false(isValid(sigilLink), 'fails if a link is a sigil link and not a uri')

const noOld = Mock()
noOld.oldSecrets = undefined
t.false(isValid(noOld), 'fails on missing oldSecrets')

const emptyOld = Mock()
emptyOld.oldSecrets = []
t.true(isValid(emptyOld), 'allows empty oldSecrets')

t.end()
})