@oxy.so/core 7.28.0 → 7.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/crypto/index.js +19 -1
  2. package/dist/cjs/crypto/keyManager.js +106 -106
  3. package/dist/cjs/crypto/keychainGroupMigration.js +353 -0
  4. package/dist/cjs/crypto/keychainItems.js +70 -0
  5. package/dist/cjs/crypto/organizationKeys.js +80 -72
  6. package/dist/cjs/crypto/secureStoreOptions.js +2 -0
  7. package/dist/cjs/session/index.js +11 -1
  8. package/dist/cjs/utils/keychainAccessGroups.js +248 -0
  9. package/dist/esm/crypto/index.js +3 -0
  10. package/dist/esm/crypto/keyManager.js +63 -63
  11. package/dist/esm/crypto/keychainGroupMigration.js +348 -0
  12. package/dist/esm/crypto/keychainItems.js +61 -0
  13. package/dist/esm/crypto/organizationKeys.js +54 -46
  14. package/dist/esm/crypto/secureStoreOptions.js +1 -0
  15. package/dist/esm/session/index.js +3 -0
  16. package/dist/esm/utils/keychainAccessGroups.js +231 -0
  17. package/dist/types/crypto/index.d.ts +4 -0
  18. package/dist/types/crypto/keyManager.d.ts +9 -1
  19. package/dist/types/crypto/keychainGroupMigration.d.ts +27 -0
  20. package/dist/types/crypto/keychainItems.d.ts +41 -0
  21. package/dist/types/crypto/organizationKeys.d.ts +11 -9
  22. package/dist/types/crypto/secureStoreOptions.d.ts +15 -0
  23. package/dist/types/session/index.d.ts +2 -0
  24. package/dist/types/utils/keychainAccessGroups.d.ts +104 -0
  25. package/package.json +2 -2
  26. package/src/crypto/index.ts +29 -0
  27. package/src/crypto/keyManager.ts +84 -99
  28. package/src/crypto/keychainGroupMigration.ts +440 -0
  29. package/src/crypto/keychainItems.ts +73 -0
  30. package/src/crypto/organizationKeys.ts +72 -57
  31. package/src/crypto/secureStoreOptions.ts +32 -0
  32. package/src/session/index.ts +11 -0
  33. package/src/utils/keychainAccessGroups.ts +308 -0
  34. package/src/types/expo-secure-store.d.ts +0 -21
@@ -0,0 +1,353 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runKeychainGroupMigration = runKeychainGroupMigration;
4
+ exports.ensureKeychainGroupsMigrated = ensureKeychainGroupsMigrated;
5
+ exports.resetKeychainGroupMigrationForTests = resetKeychainGroupMigrationForTests;
6
+ /**
7
+ * Commons, iOS: move every identity item out of the shared keychain group
8
+ * into the group it belongs to (docs/identity/ios-keychain-access-groups.md
9
+ * "Migrating existing items", ADR 0062).
10
+ *
11
+ * Before the split Commons listed one access group, the shared one, so every
12
+ * item it wrote landed there — the root key, both phrases, organization keys.
13
+ * Each item is moved by VERIFY-BEFORE-DELETE:
14
+ *
15
+ * 1. read it from the shared group (an explicit `accessGroup`);
16
+ * 2. write it to its new group;
17
+ * 3. read it back from there and check it: a pair must be healthy (the
18
+ * public key derives from the private one), any value byte-identical;
19
+ * 4. only then delete it from the shared group.
20
+ *
21
+ * INVARIANT: at every instant each item has at least one readable copy, and a
22
+ * copy is never overwritten with a different value. A failure at any step
23
+ * leaves the shared copy where it is; the next run (the next accessor call
24
+ * for a thrown read, the next launch otherwise) resumes from whatever state
25
+ * the last one reached:
26
+ *
27
+ * - shared only → copy, verify, delete;
28
+ * - shared and new, equal → (a crash after the copy) verify, delete;
29
+ * - new only → done;
30
+ * - shared and new DIFFER → `conflict`: both stay. The new group was written
31
+ * after the split, so it is current, but the shared copy may be a replaced
32
+ * key that still receives money, and no step here may destroy one.
33
+ * - a pair that is not healthy → `unhealthy`: left in place, never moved.
34
+ *
35
+ * Every read the rest of the SDK makes goes through `keychainReadPlan` (its
36
+ * group, then the shared group), so it finds an item wherever this run left it.
37
+ * `ensureKeychainGroupsMigrated` is awaited by every KeyManager and
38
+ * organization-key storage access in Commons, so no write of theirs can
39
+ * interleave with a copy here (a copy racing a rotation could otherwise put
40
+ * the replaced key back).
41
+ *
42
+ * Nothing is logged but item labels and outcomes; never a value.
43
+ */
44
+ const secp256k1_1 = require("@oxy.so/protocol/secp256k1");
45
+ const protocol_1 = require("@oxy.so/protocol");
46
+ const logger_1 = require("../logger");
47
+ const keychainAccessGroups_1 = require("../utils/keychainAccessGroups");
48
+ const keychainItems_1 = require("./keychainItems");
49
+ const slot = (key, item, service, deviceOnly = true) => ({
50
+ key,
51
+ service,
52
+ group: (0, keychainAccessGroups_1.keychainGroupFor)(item),
53
+ deviceOnly,
54
+ });
55
+ function isHealthyPair(privateKey, publicKey) {
56
+ if (!privateKey || !publicKey)
57
+ return false;
58
+ try {
59
+ return ((0, secp256k1_1.deriveSecp256k1PublicKey)((0, secp256k1_1.normalizeSecp256k1PrivateKey)(privateKey)) ===
60
+ (0, secp256k1_1.normalizeSecp256k1PublicKey)(publicKey));
61
+ }
62
+ catch {
63
+ return false;
64
+ }
65
+ }
66
+ class Deferred extends Error {
67
+ }
68
+ class Mover {
69
+ constructor(store, access) {
70
+ this.store = store;
71
+ this.access = access;
72
+ }
73
+ options(s, group, write = false) {
74
+ return {
75
+ ...(s.service ? { keychainService: s.service } : {}),
76
+ accessGroup: (0, keychainAccessGroups_1.keychainAccessGroupValue)(this.access, group),
77
+ ...(write && s.deviceOnly
78
+ ? { keychainAccessible: this.store.WHEN_UNLOCKED_THIS_DEVICE_ONLY }
79
+ : {}),
80
+ };
81
+ }
82
+ /** A read that throws means the keychain is unavailable: the whole run defers. */
83
+ async read(s, group) {
84
+ try {
85
+ return (await this.store.getItemAsync(s.key, this.options(s, group))) ?? null;
86
+ }
87
+ catch (error) {
88
+ throw new Deferred(error instanceof Error ? error.message : 'keychain read threw');
89
+ }
90
+ }
91
+ /**
92
+ * Write `value` where the new group had nothing, then read it back; `true`
93
+ * only when the new group holds exactly `value`. A copy that reads back as
94
+ * something else is removed again (best effort), because reads look in the
95
+ * new group FIRST and must not find it there.
96
+ */
97
+ async copy(s, value, replacing = false) {
98
+ try {
99
+ await this.store.setItemAsync(s.key, value, this.options(s, s.group, true));
100
+ if ((await this.store.getItemAsync(s.key, this.options(s, s.group))) === value) {
101
+ return true;
102
+ }
103
+ }
104
+ catch {
105
+ return false;
106
+ }
107
+ if (replacing) {
108
+ // A merge overwrote what was there; keep whatever is there now.
109
+ return false;
110
+ }
111
+ try {
112
+ await this.store.deleteItemAsync(s.key, this.options(s, s.group));
113
+ }
114
+ catch {
115
+ // The next run reads it as a conflict and leaves both; the shared copy is intact.
116
+ }
117
+ return false;
118
+ }
119
+ async deleteShared(s) {
120
+ try {
121
+ await this.store.deleteItemAsync(s.key, this.options(s, 'shared'));
122
+ return true;
123
+ }
124
+ catch {
125
+ return false;
126
+ }
127
+ }
128
+ async moveValue(unit) {
129
+ const { slot: s } = unit;
130
+ const shared = await this.read(s, 'shared');
131
+ if (shared === null)
132
+ return 'absent';
133
+ const target = await this.read(s, s.group);
134
+ let keep = target ?? shared;
135
+ if (target !== null && target !== shared) {
136
+ const merged = unit.merge?.(shared, target) ?? null;
137
+ if (merged === null)
138
+ return 'conflict';
139
+ keep = merged;
140
+ }
141
+ if (target !== keep && !(await this.copy(s, keep, target !== null)))
142
+ return 'failed';
143
+ // Verify the copy that is about to become the only one.
144
+ if ((await this.read(s, s.group)) !== keep)
145
+ return 'failed';
146
+ return (await this.deleteShared(s)) ? 'moved' : 'failed';
147
+ }
148
+ async movePair(unit) {
149
+ const halves = [unit.privateSlot, unit.publicSlot];
150
+ // A half whose group IS the shared group stays: it is read, never moved.
151
+ const movable = halves.filter((h) => h.group !== 'shared');
152
+ const shared = await Promise.all(halves.map((h) => this.read(h, 'shared')));
153
+ if (movable.every((h) => shared[halves.indexOf(h)] === null))
154
+ return 'absent';
155
+ const target = await Promise.all(halves.map((h, i) => (h.group === 'shared' ? shared[i] : this.read(h, h.group))));
156
+ for (const h of movable) {
157
+ const i = halves.indexOf(h);
158
+ if (shared[i] !== null && target[i] !== null && shared[i] !== target[i])
159
+ return 'conflict';
160
+ }
161
+ const finalPair = halves.map((_, i) => target[i] ?? shared[i]);
162
+ if (!isHealthyPair(finalPair[0], finalPair[1]))
163
+ return 'unhealthy';
164
+ for (const h of movable) {
165
+ const i = halves.indexOf(h);
166
+ const value = shared[i];
167
+ if (value !== null && target[i] === null && !(await this.copy(h, value)))
168
+ return 'failed';
169
+ }
170
+ const readBack = await Promise.all(halves.map((h, i) => (h.group === 'shared' ? shared[i] : this.read(h, h.group))));
171
+ if (readBack.some((v, i) => v !== finalPair[i]) || !isHealthyPair(readBack[0], readBack[1])) {
172
+ return 'failed';
173
+ }
174
+ for (const h of movable) {
175
+ if (shared[halves.indexOf(h)] !== null && !(await this.deleteShared(h)))
176
+ return 'failed';
177
+ }
178
+ return 'moved';
179
+ }
180
+ move(unit) {
181
+ return unit.kind === 'pair' ? this.movePair(unit) : this.moveValue(unit);
182
+ }
183
+ }
184
+ /** The personal items, in the order they move. */
185
+ function personalUnits() {
186
+ const v2 = (key, service, deviceOnly) => slot(key, 'identity-secret', service, deviceOnly);
187
+ const legacy = (key, deviceOnly) => slot(key, 'identity-secret', undefined, deviceOnly);
188
+ return [
189
+ {
190
+ label: 'primary',
191
+ kind: 'pair',
192
+ privateSlot: v2(keychainItems_1.V2_STORAGE_KEYS.PRIVATE_KEY, keychainItems_1.V2_PRIMARY_KEYCHAIN_SERVICE, true),
193
+ publicSlot: v2(keychainItems_1.V2_STORAGE_KEYS.PUBLIC_KEY, keychainItems_1.V2_PRIMARY_KEYCHAIN_SERVICE, false),
194
+ },
195
+ {
196
+ label: 'backup',
197
+ kind: 'pair',
198
+ privateSlot: v2(keychainItems_1.V2_STORAGE_KEYS.BACKUP_PRIVATE_KEY, keychainItems_1.V2_BACKUP_KEYCHAIN_SERVICE, true),
199
+ publicSlot: v2(keychainItems_1.V2_STORAGE_KEYS.BACKUP_PUBLIC_KEY, keychainItems_1.V2_BACKUP_KEYCHAIN_SERVICE, false),
200
+ },
201
+ {
202
+ label: 'backup-timestamp',
203
+ kind: 'value',
204
+ slot: v2(keychainItems_1.V2_STORAGE_KEYS.BACKUP_TIMESTAMP, keychainItems_1.V2_BACKUP_KEYCHAIN_SERVICE, false),
205
+ },
206
+ {
207
+ label: 'legacy-primary',
208
+ kind: 'pair',
209
+ privateSlot: legacy(keychainItems_1.STORAGE_KEYS.PRIVATE_KEY, true),
210
+ publicSlot: legacy(keychainItems_1.STORAGE_KEYS.PUBLIC_KEY, false),
211
+ },
212
+ {
213
+ label: 'legacy-backup',
214
+ kind: 'pair',
215
+ privateSlot: legacy(keychainItems_1.STORAGE_KEYS.BACKUP_PRIVATE_KEY, true),
216
+ publicSlot: legacy(keychainItems_1.STORAGE_KEYS.BACKUP_PUBLIC_KEY, false),
217
+ },
218
+ {
219
+ label: 'legacy-backup-timestamp',
220
+ kind: 'value',
221
+ slot: legacy(keychainItems_1.STORAGE_KEYS.BACKUP_TIMESTAMP, false),
222
+ },
223
+ {
224
+ label: 'phrase',
225
+ kind: 'value',
226
+ slot: slot(keychainItems_1.RECOVERY_MNEMONIC_STORAGE_KEY, 'identity-secret', keychainItems_1.RECOVERY_MNEMONIC_KEYCHAIN_SERVICE),
227
+ },
228
+ {
229
+ // The private key moves to the wallet group; its public key stays shared.
230
+ label: 'shared-slot',
231
+ kind: 'pair',
232
+ privateSlot: slot(keychainItems_1.STORAGE_KEYS.SHARED_PRIVATE_KEY, 'spending-key'),
233
+ publicSlot: slot(keychainItems_1.STORAGE_KEYS.SHARED_PUBLIC_KEY, 'shared', undefined, false),
234
+ },
235
+ ];
236
+ }
237
+ const INDEX_SLOT = slot(keychainItems_1.ORGANIZATION_INDEX_STORAGE_KEY, 'identity-secret', keychainItems_1.ORGANIZATION_INDEX_KEYCHAIN_SERVICE, false);
238
+ /** Union of two indexes; never drops an id either side lists. */
239
+ function mergeIndexes(shared, target) {
240
+ return (0, keychainItems_1.serializeOrganizationIndex)([
241
+ ...(0, keychainItems_1.parseOrganizationIndex)(shared),
242
+ ...(0, keychainItems_1.parseOrganizationIndex)(target),
243
+ ]);
244
+ }
245
+ /** Run the migration once. Exported for tests; production code awaits the gate. */
246
+ async function runKeychainGroupMigration() {
247
+ let access;
248
+ try {
249
+ access = await (0, keychainAccessGroups_1.resolveKeychainAccess)();
250
+ }
251
+ catch {
252
+ return { state: 'deferred', items: {} };
253
+ }
254
+ if (access.mode !== 'grouped' || access.role !== 'holder') {
255
+ return { state: 'not-applicable', items: {} };
256
+ }
257
+ let store;
258
+ try {
259
+ store = await (0, protocol_1.loadSecureStore)();
260
+ }
261
+ catch {
262
+ return { state: 'deferred', items: {} };
263
+ }
264
+ const mover = new Mover(store, access);
265
+ const items = {};
266
+ try {
267
+ for (const unit of personalUnits()) {
268
+ items[unit.label] = await mover.move(unit);
269
+ }
270
+ // Organizations: every id either copy of the index names.
271
+ const ids = new Set([
272
+ ...(0, keychainItems_1.parseOrganizationIndex)(await mover.read(INDEX_SLOT, 'shared')),
273
+ ...(0, keychainItems_1.parseOrganizationIndex)(await mover.read(INDEX_SLOT, INDEX_SLOT.group)),
274
+ ]);
275
+ let n = 0;
276
+ for (const accountId of [...ids].sort()) {
277
+ n += 1;
278
+ items[`organization-${n}`] = await mover.move({
279
+ label: `organization-${n}`,
280
+ kind: 'pair',
281
+ privateSlot: slot((0, keychainItems_1.organizationPrivateKeyName)(accountId), 'spending-key'),
282
+ publicSlot: slot((0, keychainItems_1.organizationPublicKeyName)(accountId), 'spending-key', undefined, false),
283
+ });
284
+ items[`organization-${n}-phrase`] = await mover.move({
285
+ label: `organization-${n}-phrase`,
286
+ kind: 'value',
287
+ slot: slot((0, keychainItems_1.organizationMnemonicName)(accountId), 'identity-secret', keychainItems_1.ORGANIZATION_MNEMONIC_KEYCHAIN_SERVICE),
288
+ });
289
+ }
290
+ // The index last: it is how a later run finds the organizations above.
291
+ items['organization-index'] = await mover.move({
292
+ label: 'organization-index',
293
+ kind: 'value',
294
+ slot: INDEX_SLOT,
295
+ merge: mergeIndexes,
296
+ });
297
+ }
298
+ catch (error) {
299
+ if (error instanceof Deferred) {
300
+ return { state: 'deferred', items };
301
+ }
302
+ throw error;
303
+ }
304
+ const settled = Object.values(items).every((o) => o === 'absent' || o === 'moved');
305
+ const report = {
306
+ state: settled ? 'complete' : 'incomplete',
307
+ items,
308
+ };
309
+ if (!settled) {
310
+ logger_1.logger.warn('Keychain access-group migration left items in the shared group', {
311
+ component: 'KeychainGroupMigration',
312
+ items: Object.entries(items)
313
+ .filter(([, o]) => o !== 'absent' && o !== 'moved')
314
+ .map(([label, o]) => `${label}:${o}`)
315
+ .join(','),
316
+ });
317
+ }
318
+ return report;
319
+ }
320
+ let settledReport = null;
321
+ let inFlight = null;
322
+ /**
323
+ * The gate every Commons identity-storage access awaits. One run per process
324
+ * (`complete`, `incomplete` and `not-applicable` are kept; `incomplete` is
325
+ * retried on the next launch); a `deferred` run is forgotten, so the next
326
+ * access tries again once the keychain unlocks. Concurrent callers share one
327
+ * run. Never throws.
328
+ */
329
+ function ensureKeychainGroupsMigrated() {
330
+ if (settledReport) {
331
+ return Promise.resolve(settledReport);
332
+ }
333
+ if (!inFlight) {
334
+ inFlight = runKeychainGroupMigration()
335
+ .catch((error) => {
336
+ logger_1.logger.warn('Keychain access-group migration threw; retrying on the next access', { component: 'KeychainGroupMigration' }, error);
337
+ return { state: 'deferred', items: {} };
338
+ })
339
+ .then((report) => {
340
+ if (report.state !== 'deferred') {
341
+ settledReport = report;
342
+ }
343
+ inFlight = null;
344
+ return report;
345
+ });
346
+ }
347
+ return inFlight;
348
+ }
349
+ /** Forget the memoized run. Tests only. @internal */
350
+ function resetKeychainGroupMigrationForTests() {
351
+ settledReport = null;
352
+ inFlight = null;
353
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /**
3
+ * The names of every identity item `KeyManager` and `./organizationKeys` keep
4
+ * in `expo-secure-store`, in one place so the access-group migration
5
+ * (`./keychainGroupMigration`) moves exactly what those modules read. Values
6
+ * are stable on-device identifiers: renaming one strands what is stored.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.organizationMnemonicName = exports.organizationPublicKeyName = exports.organizationPrivateKeyName = exports.ORGANIZATION_INDEX_STORAGE_KEY = exports.ORGANIZATION_INDEX_KEYCHAIN_SERVICE = exports.ORGANIZATION_MNEMONIC_KEYCHAIN_SERVICE = exports.ORGANIZATION_ANDROID_KEYCHAIN_SERVICE = exports.RECOVERY_MNEMONIC_STORAGE_KEY = exports.RECOVERY_MNEMONIC_KEYCHAIN_SERVICE = exports.V2_STORAGE_KEYS = exports.V2_BACKUP_KEYCHAIN_SERVICE = exports.V2_PRIMARY_KEYCHAIN_SERVICE = exports.STORAGE_KEYS = void 0;
10
+ exports.isOrganizationAccountId = isOrganizationAccountId;
11
+ exports.parseOrganizationIndex = parseOrganizationIndex;
12
+ exports.serializeOrganizationIndex = serializeOrganizationIndex;
13
+ /** Legacy (pre-v2) and shared-slot keys; the legacy ones have no keychain service. */
14
+ exports.STORAGE_KEYS = {
15
+ PRIVATE_KEY: 'oxy_identity_private_key',
16
+ PUBLIC_KEY: 'oxy_identity_public_key',
17
+ BACKUP_PRIVATE_KEY: 'oxy_identity_backup_private_key',
18
+ BACKUP_PUBLIC_KEY: 'oxy_identity_backup_public_key',
19
+ BACKUP_TIMESTAMP: 'oxy_identity_backup_timestamp',
20
+ // The personal key's cross-app slot: the private key in the wallet group, the
21
+ // public key in the shared group (iOS only), no keychain service.
22
+ SHARED_PRIVATE_KEY: 'oxy_shared_identity_private_key',
23
+ SHARED_PUBLIC_KEY: 'oxy_shared_identity_public_key',
24
+ };
25
+ exports.V2_PRIMARY_KEYCHAIN_SERVICE = 'oxy_identity';
26
+ exports.V2_BACKUP_KEYCHAIN_SERVICE = 'oxy_identity_backup';
27
+ exports.V2_STORAGE_KEYS = {
28
+ PRIVATE_KEY: 'oxy_identity_private_key_v2',
29
+ PUBLIC_KEY: 'oxy_identity_public_key_v2',
30
+ BACKUP_PRIVATE_KEY: 'oxy_identity_backup_private_key_v2',
31
+ BACKUP_PUBLIC_KEY: 'oxy_identity_backup_public_key_v2',
32
+ BACKUP_TIMESTAMP: 'oxy_identity_backup_timestamp_v2',
33
+ };
34
+ exports.RECOVERY_MNEMONIC_KEYCHAIN_SERVICE = 'oxy_identity_mnemonic';
35
+ exports.RECOVERY_MNEMONIC_STORAGE_KEY = 'oxy_identity_mnemonic_v1';
36
+ /** Organization keys (ADR 0061 D6). On iOS the pair has no keychain service. */
37
+ exports.ORGANIZATION_ANDROID_KEYCHAIN_SERVICE = 'oxy_org_identity';
38
+ exports.ORGANIZATION_MNEMONIC_KEYCHAIN_SERVICE = 'oxy_org_identity_mnemonic';
39
+ exports.ORGANIZATION_INDEX_KEYCHAIN_SERVICE = 'oxy_org_identity_index';
40
+ exports.ORGANIZATION_INDEX_STORAGE_KEY = 'oxy_org_identity_index_v1';
41
+ const organizationPrivateKeyName = (accountId) => `oxy_org_identity_private_key.${accountId}`;
42
+ exports.organizationPrivateKeyName = organizationPrivateKeyName;
43
+ const organizationPublicKeyName = (accountId) => `oxy_org_identity_public_key.${accountId}`;
44
+ exports.organizationPublicKeyName = organizationPublicKeyName;
45
+ const organizationMnemonicName = (accountId) => `oxy_org_identity_mnemonic.${accountId}`;
46
+ exports.organizationMnemonicName = organizationMnemonicName;
47
+ /** Same set the server's account ids come from: a legacy 24-hex id or a lowercase uuid. */
48
+ const ACCOUNT_ID = /^(?:[0-9a-f]{24}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/;
49
+ /** Whether `value` is an account id an organization key can be stored under. */
50
+ function isOrganizationAccountId(value) {
51
+ return ACCOUNT_ID.test(value);
52
+ }
53
+ /** The account ids in a stored organization index; anything malformed is skipped. */
54
+ function parseOrganizationIndex(raw) {
55
+ if (!raw)
56
+ return [];
57
+ try {
58
+ const parsed = JSON.parse(raw);
59
+ return Array.isArray(parsed)
60
+ ? parsed.filter((id) => typeof id === 'string' && isOrganizationAccountId(id))
61
+ : [];
62
+ }
63
+ catch {
64
+ return [];
65
+ }
66
+ }
67
+ /** The stored form of an organization index: unique, sorted. */
68
+ function serializeOrganizationIndex(ids) {
69
+ return JSON.stringify([...new Set(ids)].sort());
70
+ }