From f4d3f27a5128032258af847a6e0f217b3d4ad76d Mon Sep 17 00:00:00 2001 From: Jacob Karlsson Date: Fri, 5 May 2023 17:04:39 +0200 Subject: [PATCH] Allow empty oldSecrets --- group/add-member/README.md | 2 +- group/add-member/v2/schema.js | 2 +- group/add-member/v2/schema.json | 2 +- test/add-member.test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/group/add-member/README.md b/group/add-member/README.md index 9749f92..34d1a9f 100644 --- a/group/add-member/README.md +++ b/group/add-member/README.md @@ -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` diff --git a/group/add-member/v2/schema.js b/group/add-member/v2/schema.js index 8779ac1..361f933 100644 --- a/group/add-member/v2/schema.js +++ b/group/add-member/v2/schema.js @@ -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' }, diff --git a/group/add-member/v2/schema.json b/group/add-member/v2/schema.json index 18fb215..93cdbc6 100644 --- a/group/add-member/v2/schema.json +++ b/group/add-member/v2/schema.json @@ -29,7 +29,7 @@ "$ref": "#/definitions/secret" } ], - "minItems": 1 + "minItems": 0 }, "root": { "$ref": "#/definitions/messageId" diff --git a/test/add-member.test.js b/test/add-member.test.js index 7ce22ee..f140b0f 100644 --- a/test/add-member.test.js +++ b/test/add-member.test.js @@ -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() })