@oxy.so/core 7.30.0 → 7.32.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 (40) hide show
  1. package/dist/cjs/api/identity.js +146 -23
  2. package/dist/cjs/crypto/identityMarker.js +15 -0
  3. package/dist/cjs/crypto/index.js +7 -2
  4. package/dist/cjs/crypto/keyManager.js +7 -10
  5. package/dist/cjs/crypto/keychainGroupMigration.js +327 -160
  6. package/dist/cjs/crypto/organizationKeys.js +33 -5
  7. package/dist/cjs/crypto/retiredKeys.js +80 -18
  8. package/dist/cjs/session/authStateStore.js +13 -0
  9. package/dist/cjs/session/index.js +5 -2
  10. package/dist/cjs/utils/keychainAccessGroups.js +208 -51
  11. package/dist/esm/api/identity.js +146 -23
  12. package/dist/esm/crypto/identityMarker.js +14 -0
  13. package/dist/esm/crypto/index.js +3 -3
  14. package/dist/esm/crypto/keyManager.js +9 -12
  15. package/dist/esm/crypto/keychainGroupMigration.js +327 -162
  16. package/dist/esm/crypto/organizationKeys.js +34 -6
  17. package/dist/esm/crypto/retiredKeys.js +76 -17
  18. package/dist/esm/session/authStateStore.js +12 -0
  19. package/dist/esm/session/index.js +1 -1
  20. package/dist/esm/utils/keychainAccessGroups.js +205 -51
  21. package/dist/types/api/identity.d.ts +36 -0
  22. package/dist/types/crypto/identityMarker.d.ts +8 -0
  23. package/dist/types/crypto/index.d.ts +4 -4
  24. package/dist/types/crypto/keychainGroupMigration.d.ts +28 -6
  25. package/dist/types/crypto/organizationKeys.d.ts +4 -2
  26. package/dist/types/crypto/retiredKeys.d.ts +30 -4
  27. package/dist/types/session/authStateStore.d.ts +9 -0
  28. package/dist/types/session/index.d.ts +2 -2
  29. package/dist/types/utils/keychainAccessGroups.d.ts +108 -26
  30. package/package.json +2 -2
  31. package/src/api/identity.ts +185 -40
  32. package/src/crypto/identityMarker.ts +15 -0
  33. package/src/crypto/index.ts +10 -1
  34. package/src/crypto/keyManager.ts +9 -15
  35. package/src/crypto/keychainGroupMigration.ts +396 -186
  36. package/src/crypto/organizationKeys.ts +38 -6
  37. package/src/crypto/retiredKeys.ts +87 -17
  38. package/src/session/authStateStore.ts +14 -0
  39. package/src/session/index.ts +8 -1
  40. package/src/utils/keychainAccessGroups.ts +276 -52
@@ -11,9 +11,9 @@ import { isDev, logger } from '../logger/index.js';
11
11
  import { deriveScopedSeedFromKey, signSocialReceiveDigest } from './identityDerivations.js';
12
12
  import { registerIdentitySignerStore } from './identitySigner.js';
13
13
  import { getOrganizationPrivateKey, isOrganizationAccountId } from './organizationKeys.js';
14
- import { forgetRetiredIdentityKeys, getRetiredPrivateKey, retiredKeyScope } from './retiredKeys.js';
14
+ import { getRetiredPrivateKey, retiredKeyScope } from './retiredKeys.js';
15
15
  import { groupedKeychainStore, resolveKeychainAccess, } from '../utils/keychainAccessGroups.js';
16
- import { ensureKeychainGroupsMigrated } from './keychainGroupMigration.js';
16
+ import { prepareKeychainAccess } from './keychainGroupMigration.js';
17
17
  import { RECOVERY_MNEMONIC_KEYCHAIN_SERVICE, RECOVERY_MNEMONIC_STORAGE_KEY, STORAGE_KEYS, V2_BACKUP_KEYCHAIN_SERVICE, V2_PRIMARY_KEYCHAIN_SERVICE, V2_STORAGE_KEYS, } from './keychainItems.js';
18
18
  import { clearIdentityMarker, readIdentityMarker, updateIdentityMarker, writeIdentityMarker, } from './identityMarker.js';
19
19
  import { DEVICE_BACKUP_VERSION, parseDeviceBackup, serializeDeviceBackup, } from './deviceBackup.js';
@@ -172,9 +172,7 @@ async function loadRawSecureStore() {
172
172
  async function keychainItemStore(item) {
173
173
  const raw = await loadRawSecureStore();
174
174
  const access = await resolveKeychainAccess();
175
- if (access.mode === 'grouped' && access.role === 'holder') {
176
- await ensureKeychainGroupsMigrated();
177
- }
175
+ await prepareKeychainAccess(access);
178
176
  return groupedKeychainStore(raw, access, item);
179
177
  }
180
178
  /** The store for the identity slots (primary, backup, legacy, phrase): Commons only on iOS. */
@@ -2050,13 +2048,12 @@ export class KeyManager {
2050
2048
  if (force) {
2051
2049
  await KeyManager._bestEffortDeleteBackupsAllGenerations(store);
2052
2050
  await KeyManager._clearSharedSlot(store);
2053
- // The person's retired keys go with the identity they belonged to.
2054
- try {
2055
- await forgetRetiredIdentityKeys();
2056
- }
2057
- catch (error) {
2058
- logger.warn('Failed to clear retired keys during delete', { component: 'KeyManager' }, error);
2059
- }
2051
+ // The retired ring is NOT cleared (R4-4): it is money under the person's
2052
+ // previous keys, and "Start over" or a forced delete must not cost it.
2053
+ // The same person restoring their identity finds it again; a different
2054
+ // identity on this phone cannot use it (each entry is checked against
2055
+ // that account's key history before use). Only deleting the Oxy ACCOUNT
2056
+ // clears it, explicitly (`forgetRetiredIdentityKeys`, Commons' flow).
2060
2057
  }
2061
2058
  // The device backup goes on EVERY delete, forced or not: it is restored
2062
2059
  // silently, so leaving it would bring a deleted identity back on the next