From 5c9e91d32b25d46a13662fb475d94469188d97ea Mon Sep 17 00:00:00 2001 From: Jacob Karlsson Date: Fri, 5 May 2023 14:09:06 +0200 Subject: [PATCH] Rename groupKey to secret --- group/add-member/README.md | 4 ++-- group/add-member/v2/schema.js | 8 ++++---- group/add-member/v2/schema.json | 8 ++++---- group/definitions.js | 4 ++-- group/initEpoch/README.md | 2 +- group/initEpoch/v2/schema.js | 8 ++++---- group/initEpoch/v2/schema.json | 8 ++++---- group/initRoot/README.md | 4 ++-- group/initRoot/v2/schema.js | 8 ++++---- group/initRoot/v2/schema.json | 8 ++++---- test/add-member.test.js | 4 ++-- test/helpers.js | 4 ++-- test/initEpoch.test.js | 8 ++++---- test/initRoot.test.js | 4 ++-- 14 files changed, 41 insertions(+), 41 deletions(-) diff --git a/group/add-member/README.md b/group/add-member/README.md index dc6a807..ecb65de 100644 --- a/group/add-member/README.md +++ b/group/add-member/README.md @@ -8,7 +8,7 @@ This is about adding people to your group var content = { type: "group/add-member", version: "v2", - groupKey: "3YUat1ylIUVGaCjotAvof09DhyFxE8iGbF6QxLlCWWc=", + secret: "3YUat1ylIUVGaCjotAvof09DhyFxE8iGbF6QxLlCWWc=", root: "ssb:message/classic/THxjTGPuXvvxnbnAV7xVuVXdhDcmoNtDDN0j3UTxcd8=", creator: "ssb:feed/bendybutt-v1/VuVXdhDTHxjTGPuXvvxnbnAV7xcmoNtDDN0j3UTxcd8=", text: "welcome keks!", // optional @@ -37,7 +37,7 @@ var content = { Notes: -- `groupKey` is the symmetric key for the group +- `secret` is the symmetric key for the group - `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` - in the future our tangles may be _cloaked_ which means this key would become more important diff --git a/group/add-member/v2/schema.js b/group/add-member/v2/schema.js index feb7448..8c5533f 100644 --- a/group/add-member/v2/schema.js +++ b/group/add-member/v2/schema.js @@ -3,7 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-only const { - groupKey, + secret, messageId, feedId, groupId, @@ -16,7 +16,7 @@ module.exports = { required: [ 'type', 'version', - 'groupKey', + 'secret', 'root', 'creator', 'recps', @@ -31,7 +31,7 @@ module.exports = { type: 'string', pattern: '^v2$' }, - groupKey: { $ref: '#/definitions/groupKey' }, + secret: { $ref: '#/definitions/secret' }, root: { $ref: '#/definitions/messageId' }, creator: { $ref: '#/definitions/feedId' }, text: { type: 'string' }, @@ -53,7 +53,7 @@ module.exports = { }, additionalProperties: false, definitions: { - ...groupKey, + ...secret, ...messageId, ...feedId, ...groupId, diff --git a/group/add-member/v2/schema.json b/group/add-member/v2/schema.json index c498f5e..e5dca17 100644 --- a/group/add-member/v2/schema.json +++ b/group/add-member/v2/schema.json @@ -4,7 +4,7 @@ "required": [ "type", "version", - "groupKey", + "secret", "root", "creator", "recps", @@ -19,8 +19,8 @@ "type": "string", "pattern": "^v2$" }, - "groupKey": { - "$ref": "#/definitions/groupKey" + "secret": { + "$ref": "#/definitions/secret" }, "root": { "$ref": "#/definitions/messageId" @@ -62,7 +62,7 @@ }, "additionalProperties": false, "definitions": { - "groupKey": { + "secret": { "type": "string", "pattern": "^[a-zA-Z0-9\\/+]{42}[AEIMQUYcgkosw048]=$" }, diff --git a/group/definitions.js b/group/definitions.js index 6fc2ea1..ffe089d 100644 --- a/group/definitions.js +++ b/group/definitions.js @@ -14,7 +14,7 @@ const feedId = { pattern: '^ssb:feed/bendybutt-v1/[a-zA-Z0-9_\\-]{42}[AEIMQUYcgkosw048]=$' } -const groupKey = { +const secret = { type: 'string', pattern: '^[a-zA-Z0-9\\/+]{42}[AEIMQUYcgkosw048]=$' } @@ -58,7 +58,7 @@ module.exports = { messageId: { messageId }, groupId: { groupId }, feedId: { feedId }, - groupKey: { groupKey }, + secret: { secret }, tangle: { root: { tangle: { diff --git a/group/initEpoch/README.md b/group/initEpoch/README.md index 2e83834..248e3a3 100644 --- a/group/initEpoch/README.md +++ b/group/initEpoch/README.md @@ -13,7 +13,7 @@ const groupId = 'ssb:identity/group/g_JTmMEjG4JP2aQAO0LM8tIoRtNkTq07Se6h1qwnQKb= var plainText = { type: 'group/init' version: 'v2', - groupKey: group_key.toString('base64'), + secret: group_secret.toString('base64'), tangles: { group: { root: groupRoot, diff --git a/group/initEpoch/v2/schema.js b/group/initEpoch/v2/schema.js index 8a42e85..c62fa3e 100644 --- a/group/initEpoch/v2/schema.js +++ b/group/initEpoch/v2/schema.js @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: LGPL-3.0-only -const { groupKey, tangle, groupId, feedId } = require('../../definitions') +const { secret, tangle, groupId, feedId } = require('../../definitions') module.exports = { type: 'object', - required: ['type', 'version', 'groupKey', 'tangles', 'recps'], + required: ['type', 'version', 'secret', 'tangles', 'recps'], properties: { type: { type: 'string', @@ -16,7 +16,7 @@ module.exports = { type: 'string', pattern: '^v2$' }, - groupKey: { $ref: '#/definitions/groupKey' }, + secret: { $ref: '#/definitions/secret' }, tangles: { type: 'object', required: ['group', 'epoch', 'members'], @@ -39,7 +39,7 @@ module.exports = { }, additionalProperties: false, definitions: { - ...groupKey, + ...secret, ...groupId, ...feedId, ...tangle.any // this pulls in tangle.root and tangle.update diff --git a/group/initEpoch/v2/schema.json b/group/initEpoch/v2/schema.json index 567d72e..2c576fd 100644 --- a/group/initEpoch/v2/schema.json +++ b/group/initEpoch/v2/schema.json @@ -3,7 +3,7 @@ "required": [ "type", "version", - "groupKey", + "secret", "tangles", "recps" ], @@ -16,8 +16,8 @@ "type": "string", "pattern": "^v2$" }, - "groupKey": { - "$ref": "#/definitions/groupKey" + "secret": { + "$ref": "#/definitions/secret" }, "tangles": { "type": "object", @@ -55,7 +55,7 @@ }, "additionalProperties": false, "definitions": { - "groupKey": { + "secret": { "type": "string", "pattern": "^[a-zA-Z0-9\\/+]{42}[AEIMQUYcgkosw048]=$" }, diff --git a/group/initRoot/README.md b/group/initRoot/README.md index 6132f58..fb20ab7 100644 --- a/group/initRoot/README.md +++ b/group/initRoot/README.md @@ -26,7 +26,7 @@ var prevMsgId = 'ssb:message/classic/Zz-Inkte70Qz1UVKUHIhOgo16Oj_n37PfgmIzLDBgZw var feed_id = ... BFE binary encoding of feed_id var prev_msg_id = ... BFE binary encoding of feed_id -var group_key = { +var group_secret = { key: group_buffer, // group_buffer is symmetric key as buffer scheme: 'envelope-large-symmetric-group' } @@ -40,7 +40,7 @@ var msg_key = ... make up a one use key for the msg as a buffer var plainText = { type: 'group/init' version: 'v2', - groupKey: group_key.toString('base64'), + secret: group_secret.toString('base64'), tangles: { group: { root: null, diff --git a/group/initRoot/v2/schema.js b/group/initRoot/v2/schema.js index 91c7791..001c7be 100644 --- a/group/initRoot/v2/schema.js +++ b/group/initRoot/v2/schema.js @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: LGPL-3.0-only -const { groupKey, tangle } = require('../../definitions') +const { secret, tangle } = require('../../definitions') module.exports = { type: 'object', - required: ['type', 'version', 'groupKey', 'tangles'], + required: ['type', 'version', 'secret', 'tangles'], properties: { type: { type: 'string', @@ -16,7 +16,7 @@ module.exports = { type: 'string', pattern: '^v2$' }, - groupKey: { $ref: '#/definitions/groupKey' }, + secret: { $ref: '#/definitions/secret' }, tangles: { type: 'object', required: ['group', 'epoch', 'members'], @@ -29,7 +29,7 @@ module.exports = { }, additionalProperties: false, definitions: { - ...groupKey, + ...secret, ...tangle.root } } diff --git a/group/initRoot/v2/schema.json b/group/initRoot/v2/schema.json index 0a147ca..d4c4490 100644 --- a/group/initRoot/v2/schema.json +++ b/group/initRoot/v2/schema.json @@ -3,7 +3,7 @@ "required": [ "type", "version", - "groupKey", + "secret", "tangles" ], "properties": { @@ -15,8 +15,8 @@ "type": "string", "pattern": "^v2$" }, - "groupKey": { - "$ref": "#/definitions/groupKey" + "secret": { + "$ref": "#/definitions/secret" }, "tangles": { "type": "object", @@ -40,7 +40,7 @@ }, "additionalProperties": false, "definitions": { - "groupKey": { + "secret": { "type": "string", "pattern": "^[a-zA-Z0-9\\/+]{42}[AEIMQUYcgkosw048]=$" }, diff --git a/test/add-member.test.js b/test/add-member.test.js index d6857d6..6cb3346 100644 --- a/test/add-member.test.js +++ b/test/add-member.test.js @@ -4,7 +4,7 @@ const test = require('tape') const isValid = require('../').validator.group.addMember -const { GroupKey, GroupId, FeedId, MsgId } = require('./helpers') +const { Secret, GroupId, FeedId, MsgId } = require('./helpers') const Mock = (overwrite = {}) => { const groupRoot = MsgId() @@ -12,7 +12,7 @@ const Mock = (overwrite = {}) => { const base = { type: 'group/add-member', version: 'v2', - groupKey: GroupKey(), + secret: Secret(), root: groupRoot, creator: FeedId(), text: 'welcome keks!', // optional diff --git a/test/helpers.js b/test/helpers.js index 1bbf65a..5d66a10 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -8,7 +8,7 @@ const key = () => .replace(/\//g, '_') .replace(/\+/g, '-') -const GroupKey = () => new SecretKey().toString() +const Secret = () => new SecretKey().toString() const GroupId = () => `ssb:identity/group/${key()}` const FeedId = () => `ssb:feed/bendybutt-v1/${key()}` @@ -16,7 +16,7 @@ const MsgId = () => `ssb:message/classic/${key()}` module.exports = { key, - GroupKey, + Secret, GroupId, FeedId, MsgId diff --git a/test/initEpoch.test.js b/test/initEpoch.test.js index 584ead4..371b617 100644 --- a/test/initEpoch.test.js +++ b/test/initEpoch.test.js @@ -4,13 +4,13 @@ const test = require('tape') const isValid = require('../').validator.group.initEpoch -const { MsgId, GroupKey, GroupId, FeedId } = require('./helpers') +const { MsgId, Secret, GroupId, FeedId } = require('./helpers') const Mock = (overwrite = {}) => { const base = { type: 'group/init', version: 'v2', - groupKey: GroupKey(), + secret: Secret(), tangles: { group: { root: MsgId(), @@ -65,8 +65,8 @@ test('is-epoch-init', (t) => { t.false(isValid(badRecps), 'fails if encrypted to several groups, not self') const badKey = Mock() - badKey.groupKey = 'potato' - t.false(isValid(badKey), 'fails if bad groupKey') + badKey.secret = 'potato' + t.false(isValid(badKey), 'fails if bad secret') const badRoot = Mock() badRoot.tangles.group.root = GroupId() diff --git a/test/initRoot.test.js b/test/initRoot.test.js index 933353f..3243e06 100644 --- a/test/initRoot.test.js +++ b/test/initRoot.test.js @@ -4,13 +4,13 @@ const test = require('tape') const isValid = require('../').validator.group.initRoot -const { GroupKey, MsgId, GroupId } = require('./helpers') +const { Secret, MsgId, GroupId } = require('./helpers') const Mock = (overwrite = {}) => { const base = { type: 'group/init', version: 'v2', - groupKey: GroupKey(), + secret: Secret(), tangles: { group: { root: null,