Skip to content

Commit e8ad3da

Browse files
committed
fix: merge develop
2 parents 5616f14 + e970a15 commit e8ad3da

File tree

51 files changed

+941
-900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+941
-900
lines changed

src/core/__fixtures__/agent/multiSigFixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ const linkedContacts = [
861861
];
862862

863863
const queuedIdentifier: QueuedGroupCreation & { initiator: true } = {
864-
name: "1.2.0.3:0:Identifier 2",
864+
name: "1.2.0.2:0:Identifier 2",
865865
data: inceptionDataFix,
866866
initiator: true,
867867
groupConnections: linkedContacts,

src/core/agent/agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ class Agent {
353353
}
354354

355355
async syncWithKeria() {
356-
await this.connections.syncKeriaContacts();
357356
await this.identifiers.syncKeriaIdentifiers();
357+
await this.connections.syncKeriaContacts();
358358
await this.credentials.syncKeriaCredentials();
359359

360360
await this.basicStorage.createOrUpdateBasicRecord(

src/core/agent/services/identifierService.test.ts

Lines changed: 57 additions & 57 deletions
Large diffs are not rendered by default.

src/core/agent/services/multiSigService.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ describe("Creation of multi-sig", () => {
378378
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
379379
content: {
380380
queued: [
381-
{ ...queuedIdentifier, name: "1.2.0.3:0:different identifier" },
381+
{ ...queuedIdentifier, name: "1.2.0.2:0:different identifier" },
382382
],
383383
},
384384
})
@@ -390,12 +390,12 @@ describe("Creation of multi-sig", () => {
390390
queued: [
391391
{
392392
...queuedIdentifier,
393-
name: "1.2.0.3:0:different identifier",
393+
name: "1.2.0.2:0:different identifier",
394394
threshold: { signingThreshold: 2, rotationThreshold: 1 },
395395
},
396396
{
397397
...queuedIdentifier,
398-
name: "1.2.0.3:0:Identifier 2",
398+
name: "1.2.0.2:0:Identifier 2",
399399
threshold: { signingThreshold: 2, rotationThreshold: 1 },
400400
},
401401
],
@@ -423,7 +423,7 @@ describe("Creation of multi-sig", () => {
423423

424424
expectAllWitnessIntroductions();
425425
expect(identifierCreateIcpDataMock).toBeCalledWith(
426-
"1.2.0.3:0:Identifier 2",
426+
"1.2.0.2:0:Identifier 2",
427427
{
428428
algo: "group",
429429
mhab: getMemberIdentifierResponse,
@@ -446,10 +446,10 @@ describe("Creation of multi-sig", () => {
446446
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
447447
content: {
448448
queued: [
449-
{ ...queuedIdentifier, name: "1.2.0.3:0:different identifier" },
449+
{ ...queuedIdentifier, name: "1.2.0.2:0:different identifier" },
450450
{
451451
...queuedIdentifier,
452-
name: "1.2.0.3:0:Identifier 2",
452+
name: "1.2.0.2:0:Identifier 2",
453453
},
454454
],
455455
},
@@ -526,7 +526,7 @@ describe("Creation of multi-sig", () => {
526526
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
527527
content: {
528528
queued: [
529-
{ ...queuedIdentifier, name: "1.2.0.3:0:different identifier" },
529+
{ ...queuedIdentifier, name: "1.2.0.2:0:different identifier" },
530530
],
531531
},
532532
})
@@ -624,7 +624,7 @@ describe("Creation of multi-sig", () => {
624624
queued: [
625625
{
626626
...queuedIdentifier,
627-
name: "1.2.0.3:0:Identifier 2",
627+
name: "1.2.0.2:0:Identifier 2",
628628
},
629629
],
630630
},
@@ -744,7 +744,7 @@ describe("Creation of multi-sig", () => {
744744
queued: [
745745
{
746746
...queuedIdentifier,
747-
name: "1.2.0.3:0:Identifier 2",
747+
name: "1.2.0.2:0:Identifier 2",
748748
},
749749
],
750750
},
@@ -898,7 +898,7 @@ describe("Creation of multi-sig", () => {
898898
new BasicRecord({
899899
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
900900
content: {
901-
queued: [{ ...queuedJoin, name: "1.2.0.3:0:different identifier" }],
901+
queued: [{ ...queuedJoin, name: "1.2.0.2:0:different identifier" }],
902902
},
903903
})
904904
);
@@ -907,8 +907,8 @@ describe("Creation of multi-sig", () => {
907907
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
908908
content: {
909909
queued: [
910-
{ ...queuedJoin, name: "1.2.0.3:0:different identifier" },
911-
{ ...queuedJoin, name: "1.2.0.3:0:Identifier 2" },
910+
{ ...queuedJoin, name: "1.2.0.2:0:different identifier" },
911+
{ ...queuedJoin, name: "1.2.0.2:0:Identifier 2" },
912912
],
913913
},
914914
})
@@ -930,7 +930,7 @@ describe("Creation of multi-sig", () => {
930930
await multiSigService.joinGroup("id", "d");
931931

932932
expect(identifierCreateIcpDataMock).toBeCalledWith(
933-
"1.2.0.3:0:Identifier 2",
933+
"1.2.0.2:0:Identifier 2",
934934
{
935935
algo: "group",
936936
mhab: getMemberIdentifierResponse,
@@ -1027,7 +1027,7 @@ describe("Creation of multi-sig", () => {
10271027
expect.objectContaining({
10281028
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
10291029
content: {
1030-
queued: [{ ...queuedJoin, name: "1.2.0.3:0:different identifier" }],
1030+
queued: [{ ...queuedJoin, name: "1.2.0.2:0:different identifier" }],
10311031
},
10321032
})
10331033
);
@@ -1082,7 +1082,7 @@ describe("Creation of multi-sig", () => {
10821082
new BasicRecord({
10831083
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
10841084
content: {
1085-
queued: [{ ...queuedJoin, name: "1.2.0.3:0:Identifier 2" }],
1085+
queued: [{ ...queuedJoin, name: "1.2.0.2:0:Identifier 2" }],
10861086
},
10871087
})
10881088
);
@@ -1185,7 +1185,7 @@ describe("Creation of multi-sig", () => {
11851185
new BasicRecord({
11861186
id: MiscRecordId.MULTISIG_IDENTIFIERS_PENDING_CREATION,
11871187
content: {
1188-
queued: [{ ...queuedJoin, name: "1.2.0.3:0:Identifier 2" }],
1188+
queued: [{ ...queuedJoin, name: "1.2.0.2:0:Identifier 2" }],
11891189
},
11901190
})
11911191
);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { CloudMigration } from "./cloudMigrations.types";
22
import { CLOUD_V1201 } from "./v1.2.0.1-connections-account-based";
3-
import { CLOUD_V1203 } from "./v1.2.0.3-group-scoped-username-clould";
3+
import { CLOUD_V1202 } from "./v1.2.0.2-group-scoped-username-clould";
44

55
// Cloud migrations (KERIA storage only)
66
const CLOUD_MIGRATIONS: CloudMigration[] = [
77
CLOUD_V1201, // Convert connections to account-based model
8-
CLOUD_V1203, // Add group scoped username
8+
CLOUD_V1202, // Add group scoped username
99
];
1010

1111
const LATEST_CONTACT_VERSION = "1.2.0.1";
12-
const LATEST_IDENTIFIER_VERSION = "1.2.0.3";
12+
const LATEST_IDENTIFIER_VERSION = "1.2.0.2";
1313

1414
export { CLOUD_MIGRATIONS, LATEST_CONTACT_VERSION, LATEST_IDENTIFIER_VERSION };

src/core/storage/sqliteStorage/cloudMigrations/v1.2.0.3-group-scoped-username-clould.ts renamed to src/core/storage/sqliteStorage/cloudMigrations/v1.2.0.2-group-scoped-username-clould.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { formatToV1_2_0_3, parseHabName } from "../../../utils/habName";
1+
2+
import { formatToV1_2_0_2, parseHabName } from "../../../utils/habName";
23
import { logger } from "../../../../utils/logger/Logger";
34
import { CloudMigration } from "./cloudMigrations.types";
45

5-
const migrationVersion = "1.2.0.3";
6+
const migrationVersion = "1.2.0.2";
67

7-
export const CLOUD_V1203: CloudMigration = {
8+
export const CLOUD_V1202: CloudMigration = {
89
version: migrationVersion,
910
cloudMigrationStatements: async (signifyClient) => {
1011
logger.info(`Starting cloud migration for v${migrationVersion}...`);
@@ -48,7 +49,7 @@ export const CLOUD_V1203: CloudMigration = {
4849
`[v${migrationVersion}] Updating cloud identifier: ${currentName} (${identifier.prefix})`
4950
);
5051

51-
const newName = formatToV1_2_0_3({
52+
const newName = formatToV1_2_0_2({
5253
...parts,
5354
groupMetadata: parts.groupMetadata,
5455
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { LocalMigration } from "./migrations.types";
22
import { DATA_V001 } from "./v0.0.1-init_sql";
33
import { DATA_V1201 } from "./v1.2.0.1-connections-per-account";
4+
import { DATA_V1202 } from "./v1.2.0.2-group-scoped-username";
45
import { DATA_V1200 } from "./v1.2.0.0-peer_connection_account_migration";
56

67
// Local migrations (SQLite database only)
78
const LOCAL_MIGRATIONS: LocalMigration[] = [
89
DATA_V001, // SQL migration for database initialization
910
DATA_V1200, // TS migration for peer connection account migration
1011
DATA_V1201, // TS migration for connections per account (local part only)
12+
DATA_V1202, // TS migration for identifier group-scoped username (v1.2.0.2)
1113
];
1214

1315
export { LOCAL_MIGRATIONS };

src/core/storage/sqliteStorage/migrations/v1.2.0.3-group-scoped-username.ts renamed to src/core/storage/sqliteStorage/migrations/v1.2.0.2-group-scoped-username.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { logger } from "../../../../utils/logger/Logger";
33
import { MigrationType, LocalMigration } from "./migrations.types";
44
import { createInsertItemTagsStatements } from "./migrationUtils";
55

6-
const migrationVersion = "1.2.0.3";
6+
const migrationVersion = "1.2.0.2";
77

8-
export const MIGRATION_V1203: LocalMigration = {
8+
export const DATA_V1202: LocalMigration = {
99
version: migrationVersion,
1010
type: MigrationType.TS,
1111
migrationStatements: async (session: SQLiteDBConnection) => {

src/core/storage/sqliteStorage/sqliteSession.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { SqliteStorage } from "./sqliteStorage";
1010
import { BasicRecord } from "../../agent/records/basicRecord";
1111
import { Agent } from "../../agent/agent";
1212
import { MiscRecordId } from "../../agent/agent.types";
13+
import { OnlineOnly } from "../../agent/services/utils";
1314

1415
class SqliteSession {
1516
static readonly VERSION_DATABASE_KEY = "VERSION_DATABASE_KEY";
@@ -119,17 +120,14 @@ class SqliteSession {
119120
* Executes cloud migrations when connecting to KERIA
120121
* Should be called on normal startup or recovery when KERIA connection is established
121122
*/
123+
@OnlineOnly
122124
async executeCloudMigrationsOnConnection(): Promise<void> {
123125
const isKeriaConfigured = await this.isKeriaConfigured();
124126
if (!isKeriaConfigured) {
125127
logger.info("Skipping cloud migrations - KERIA not configured");
126128
return;
127129
}
128130

129-
if (!Agent.isOnline) {
130-
await this.temporaryKeriaConnection();
131-
}
132-
133131
const cloudMigrationManager = new CloudMigrationManager(
134132
Agent.agent.client,
135133
this.getCloudVersion.bind(this),
@@ -163,13 +161,6 @@ class SqliteSession {
163161
);
164162
return !!connectUrlRecord?.content?.url;
165163
}
166-
167-
private async temporaryKeriaConnection(): Promise<void> {
168-
const connectUrlRecord = await this.basicStorageService.findById(
169-
MiscRecordId.KERIA_CONNECT_URL
170-
);
171-
await Agent.agent.start(connectUrlRecord?.content?.url as string);
172-
}
173164
}
174165

175166
export { SqliteSession };

src/core/utils/habName.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parseHabName, formatToV1_2_0_3 } from "./habName";
1+
import { parseHabName, formatToV1_2_0_2 } from "./habName";
22

33
describe("habName", () => {
44
describe("parseHabName", () => {
@@ -69,12 +69,12 @@ describe("habName", () => {
6969
expect(result).toEqual(expect.objectContaining(expected));
7070
});
7171

72-
// Tests for new format names (1.2.0.3:theme:groupInitiator:groupId:userName:displayName)
72+
// Tests for new format names (1.2.0.2:theme:groupInitiator:groupId:userName:displayName)
7373
test.each([
7474
{
75-
name: "1.2.0.3:XX:1:groupId789:user123:MyNewGroup",
75+
name: "1.2.0.2:XX:1:groupId789:user123:MyNewGroup",
7676
expected: {
77-
version: "1.2.0.3",
77+
version: "1.2.0.2",
7878
displayName: "MyNewGroup",
7979
theme: "XX",
8080
groupMetadata: {
@@ -85,9 +85,9 @@ describe("habName", () => {
8585
},
8686
},
8787
{
88-
name: "1.2.0.3:XX:1:gr@up!d:us$er%name:Group Name",
88+
name: "1.2.0.2:XX:1:gr@up!d:us$er%name:Group Name",
8989
expected: {
90-
version: "1.2.0.3",
90+
version: "1.2.0.2",
9191
displayName: "Group Name",
9292
theme: "XX",
9393
groupMetadata: {
@@ -98,9 +98,9 @@ describe("habName", () => {
9898
},
9999
},
100100
{
101-
name: "1.2.0.3:XX:1:group-with-hyphens:user123:MyNewGroup",
101+
name: "1.2.0.2:XX:1:group-with-hyphens:user123:MyNewGroup",
102102
expected: {
103-
version: "1.2.0.3",
103+
version: "1.2.0.2",
104104
displayName: "MyNewGroup",
105105
theme: "XX",
106106
groupMetadata: {
@@ -111,9 +111,9 @@ describe("habName", () => {
111111
},
112112
},
113113
{
114-
name: "1.2.0.3:XX:MyNewWallet", // Non-group member in new format
114+
name: "1.2.0.2:XX:MyNewWallet", // Non-group member in new format
115115
expected: {
116-
version: "1.2.0.3",
116+
version: "1.2.0.2",
117117
displayName: "MyNewWallet",
118118
theme: "XX",
119119
},
@@ -136,7 +136,7 @@ describe("habName", () => {
136136
"Invalid old format name: Expected 2 or 3 parts separated by colons (theme:groupPart:displayName or theme:displayName)",
137137
},
138138
{
139-
name: "1.2.0.3:XX:1:groupId789:user123", // Invalid number of parts for new format (5 parts)
139+
name: "1.2.0.2:XX:1:groupId789:user123", // Invalid number of parts for new format (5 parts)
140140
errorMessage:
141141
"Invalid new format name: Expected 3 or 6 parts separated by colons (version:theme:displayName or version:theme:groupInitiator:groupId:userName:displayName).",
142142
},
@@ -153,7 +153,7 @@ describe("habName", () => {
153153
errorMessage: "Invalid old format name: groupId cannot be empty.",
154154
},
155155
{
156-
name: "1.2.0.3:XX:1::user123:MyGroup", // Empty groupId for new format
156+
name: "1.2.0.2:XX:1::user123:MyGroup", // Empty groupId for new format
157157
errorMessage: "Invalid new format name: groupId cannot be empty.",
158158
},
159159
])(
@@ -171,7 +171,7 @@ describe("habName", () => {
171171
displayName: "FormattedWallet",
172172
theme: "XX",
173173
},
174-
expected: "1.2.0.3:XX:FormattedWallet", // Non-group member format
174+
expected: "1.2.0.2:XX:FormattedWallet", // Non-group member format
175175
},
176176
{
177177
parts: {
@@ -183,40 +183,40 @@ describe("habName", () => {
183183
userName: "formattedUser",
184184
},
185185
},
186-
expected: "1.2.0.3:XX:1:groupXYZ:formattedUser:FormattedGroup",
186+
expected: "1.2.0.2:XX:1:groupXYZ:formattedUser:FormattedGroup",
187187
},
188188
{
189189
parts: {
190190
displayName: "",
191191
theme: "XX",
192192
},
193-
expected: "1.2.0.3:XX:",
193+
expected: "1.2.0.2:XX:",
194194
},
195195
{
196196
parts: {
197197
displayName: "Group !@#$%^&*()",
198198
theme: "XX",
199199
},
200-
expected: "1.2.0.3:XX:Group !@#$%^&*()",
200+
expected: "1.2.0.2:XX:Group !@#$%^&*()",
201201
},
202202
{
203203
parts: {
204204
displayName: "Group 🚀",
205205
theme: "XX",
206206
},
207-
expected: "1.2.0.3:XX:Group 🚀",
207+
expected: "1.2.0.2:XX:Group 🚀",
208208
},
209209
{
210210
parts: {
211211
displayName: "Display:Name:With:Colons",
212212
theme: "XX",
213213
},
214-
expected: "1.2.0.3:XX:Display:Name:With:Colons",
214+
expected: "1.2.0.2:XX:Display:Name:With:Colons",
215215
},
216216
])(
217-
"should format hab name parts correctly to v1.2.0.3 format: %s",
217+
"should format hab name parts correctly to v1.2.0.2 format: %s",
218218
({ parts, expected }) => {
219-
const result = formatToV1_2_0_3(parts);
219+
const result = formatToV1_2_0_2(parts);
220220
expect(result).toBe(expected);
221221
}
222222
);

0 commit comments

Comments
 (0)