diff --git a/src/coValue.ts b/src/coValue.ts index f79b9ce00..ea0b8f57e 100644 --- a/src/coValue.ts +++ b/src/coValue.ts @@ -45,18 +45,11 @@ export type CoValueHeader = { meta: JsonObject | null; createdAt: `2${string}` | null; uniqueness: `z${string}` | null; - publicNickname?: string; }; export function coValueIDforHeader(header: CoValueHeader): RawCoValueID { const hash = shortHash(header); - if (header.publicNickname) { - return `co_${header.publicNickname}_z${hash.slice( - "shortHash_z".length - )}`; - } else { - return `co_z${hash.slice("shortHash_z".length)}`; - } + return `co_z${hash.slice("shortHash_z".length)}`; } export function accountOrAgentIDfromSessionID( diff --git a/src/crypto.test.ts b/src/crypto.test.ts index 3b31afafa..2248d6b58 100644 --- a/src/crypto.test.ts +++ b/src/crypto.test.ts @@ -49,7 +49,7 @@ test("encrypting round-trips, but invalid receiver can't unseal", () => { const nOnceMaterial = { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 0 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 0 }, } as const; const sealed = seal( @@ -101,22 +101,22 @@ test("Encryption for transactions round-trips", () => { const encrypted1 = encryptForTransaction({ a: "hello" }, secret, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 0 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 0 }, }); const encrypted2 = encryptForTransaction({ b: "world" }, secret, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 1 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 1 }, }); const decrypted1 = decryptForTransaction(encrypted1, secret, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 0 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 0 }, }); const decrypted2 = decryptForTransaction(encrypted2, secret, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 1 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 1 }, }); expect([decrypted1, decrypted2]).toEqual([{ a: "hello" }, { b: "world" }]); @@ -128,22 +128,22 @@ test("Encryption for transactions doesn't decrypt with a wrong key", () => { const encrypted1 = encryptForTransaction({ a: "hello" }, secret, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 0 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 0 }, }); const encrypted2 = encryptForTransaction({ b: "world" }, secret, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 1 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 1 }, }); const decrypted1 = decryptForTransaction(encrypted1, secret2, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 0 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 0 }, }); const decrypted2 = decryptForTransaction(encrypted2, secret2, { in: "co_zTEST", - tx: { sessionID: "co_agent_zTEST_session_zTEST", txIndex: 1 }, + tx: { sessionID: "co_zTEST_session_zTEST", txIndex: 1 }, }); expect([decrypted1, decrypted2]).toEqual([undefined, undefined]); diff --git a/src/ids.ts b/src/ids.ts index de15bddc1..bceba43aa 100644 --- a/src/ids.ts +++ b/src/ids.ts @@ -1,6 +1,6 @@ import { AccountIDOrAgentID } from './account.js'; -export type RawCoValueID = `co_z${string}` | `co_${string}_z${string}`; +export type RawCoValueID = `co_z${string}`; export type TransactionID = { sessionID: SessionID; txIndex: number }; diff --git a/src/node.ts b/src/node.ts index 8ed08b7f3..153bae8a2 100644 --- a/src/node.ts +++ b/src/node.ts @@ -154,7 +154,6 @@ export class LocalNode { ruleset: { type: "team", initialAdmin: this.account.id }, meta: null, ...createdNowUnique(), - publicNickname: "team", }); let teamContent = expectTeamContent(teamCoValue.getCurrentContent()); diff --git a/src/permissions.test.ts b/src/permissions.test.ts index 8f8ada28e..9c07956e0 100644 --- a/src/permissions.test.ts +++ b/src/permissions.test.ts @@ -266,7 +266,6 @@ test("Admins can write to an object that is owned by their team", () => { ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); let childContent = expectMap(childObject.getCurrentContent()); @@ -309,7 +308,6 @@ test("Writers can write to an object that is owned by their team", () => { ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); const childObjectAsWriter = childObject.testWithDifferentAccount( @@ -369,7 +367,6 @@ test("Readers can not write to an object that is owned by their team", () => { ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); const childObjectAsReader = childObject.testWithDifferentAccount( @@ -449,7 +446,6 @@ test("Admins can set team read key and then use it to create and read private tr ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); let childContent = expectMap(childObject.getCurrentContent()); @@ -521,7 +517,6 @@ test("Admins can set team read key and then writers can use it to create and rea ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); const childObjectAsWriter = childObject.testWithDifferentAccount( @@ -613,7 +608,6 @@ test("Admins can set team read key and then use it to create private transaction ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); expectMap(childObject.getCurrentContent()).edit((editable) => { @@ -705,7 +699,6 @@ test("Admins can set team read key and then use it to create private transaction ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); expectMap(childObject.getCurrentContent()).edit((editable) => { @@ -818,7 +811,6 @@ test("Admins can set team read key, make a private transaction in an owned objec ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); let childContent = expectMap(childObject.getCurrentContent()); @@ -898,7 +890,6 @@ test("Admins can set team read key, make a private transaction in an owned objec ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); const teamContent = expectTeamContent(team.getCurrentContent()); @@ -1044,7 +1035,6 @@ test("Admins can set team read rey, make a private transaction in an owned objec ruleset: { type: "ownedByTeam", team: team.id }, meta: null, ...createdNowUnique(), - publicNickname: "childObject", }); const teamContent = expectTeamContent(team.getCurrentContent()); diff --git a/src/permissions.ts b/src/permissions.ts index 1a2e3a391..948d4b558 100644 --- a/src/permissions.ts +++ b/src/permissions.ts @@ -354,7 +354,6 @@ export class Team { }, meta: meta || null, ...createdNowUnique(), - publicNickname: "map", }) .getCurrentContent() as CoMap; } diff --git a/src/sync.test.ts b/src/sync.test.ts index 874fd4bdd..eb01be4a9 100644 --- a/src/sync.test.ts +++ b/src/sync.test.ts @@ -68,7 +68,6 @@ test("Node replies with initial tx and header to empty subscribe", async () => { meta: null, createdAt: map.coValue.header.createdAt, uniqueness: map.coValue.header.uniqueness, - publicNickname: "map", }, newContent: { [node.ownSessionID]: { @@ -1062,7 +1061,7 @@ test("When a peer's outgoing/writable stream closes, we remove the peer", async }); test("If we start loading a coValue before connecting to a peer that has it, it will load it once we connect", async () => { - const [admin, session] = randomAnonymousAccountAndSessionID(); + const [admin, session] = randomAnonymousAccountAndSessionID(); const node1 = new LocalNode(admin, session); diff --git a/src/testUtils.ts b/src/testUtils.ts index 9102e1b58..1264798a5 100644 --- a/src/testUtils.ts +++ b/src/testUtils.ts @@ -23,7 +23,6 @@ export function newTeam() { ruleset: { type: "team", initialAdmin: admin.id }, meta: null, ...createdNowUnique(), - publicNickname: "team", }); const teamContent = expectTeamContent(team.getCurrentContent());