Skip to content

Commit

Permalink
Allow empty oldSecrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Powersource committed May 5, 2023
1 parent dee5074 commit f4d3f27
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion group/add-member/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var content = {
Notes:

- `secret` is the symmetric key for this epoch
- `oldSecrets` is an array of all secrets of all predecessor epochs to this epoch, all the way back to the root epoch. Only there when initially adding someone to a group, it should be undefined on re-additions.
- `oldSecrets` is an array of all secrets of all predecessor epochs to this epoch, all the way back to the root epoch. Should be undefined or at least empty on re-additions.
- when initially adding someone to a group, there should be one add-member message per tip epoch. this is to make it clear to the people in that epoch what the members of that epoch are. this is also why `oldSecrets` only should contain secrets of predecessor epochs, not of parallel fork epochs
- `root` is the same as `tangles.group.root`
- the redundancy is here to make it more obvious which root you should be using the compute `group_id`
Expand Down
2 changes: 1 addition & 1 deletion group/add-member/v2/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
oldSecrets: {
type: 'array',
items: [{ $ref: '#/definitions/secret' }],
minItems: 1
minItems: 0
},
root: { $ref: '#/definitions/messageId' },
creator: { $ref: '#/definitions/feedId' },
Expand Down
2 changes: 1 addition & 1 deletion group/add-member/v2/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"$ref": "#/definitions/secret"
}
],
"minItems": 1
"minItems": 0
},
"root": {
"$ref": "#/definitions/messageId"
Expand Down
2 changes: 1 addition & 1 deletion test/add-member.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ test('is-group-add-member', (t) => {

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

t.end()
})

0 comments on commit f4d3f27

Please sign in to comment.