@oxy.so/services 14.7.0 → 14.9.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 (28) hide show
  1. package/android/src/main/java/so/oxy/identity/OxyIdentityModule.kt +78 -10
  2. package/ios/OxyIdentityModule.swift +76 -7
  3. package/lib/commonjs/ui/session/nativeSecureStorage.js +14 -3
  4. package/lib/commonjs/ui/session/nativeSecureStorage.js.map +1 -1
  5. package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js +30 -18
  6. package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js.map +1 -1
  7. package/lib/module/ui/session/nativeSecureStorage.js +14 -4
  8. package/lib/module/ui/session/nativeSecureStorage.js.map +1 -1
  9. package/lib/module/ui/session/sharedDeviceCredentialStore.js +31 -19
  10. package/lib/module/ui/session/sharedDeviceCredentialStore.js.map +1 -1
  11. package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts +1 -1
  12. package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts.map +1 -1
  13. package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts +4 -4
  14. package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -1
  15. package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts +24 -0
  16. package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts.map +1 -1
  17. package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts +1 -1
  18. package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts.map +1 -1
  19. package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts +4 -4
  20. package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -1
  21. package/lib/typescript/module/ui/utils/identityCrypto.d.ts +24 -0
  22. package/lib/typescript/module/ui/utils/identityCrypto.d.ts.map +1 -1
  23. package/package.json +4 -4
  24. package/src/ui/session/__tests__/sharedDeviceCredentialStore.test.ts +54 -12
  25. package/src/ui/session/nativeSecureStorage.ts +24 -7
  26. package/src/ui/session/sharedDeviceCredentialStore.ts +34 -18
  27. package/lib/typescript/types/expo-secure-store.d.ts +0 -29
  28. package/src/types/expo-secure-store.d.ts +0 -29
@@ -31,6 +31,9 @@ import expo.modules.kotlin.modules.ModuleDefinition
31
31
  * | `describeOrganization(accountId)` | `describe` + `accountId` | `{ v, publicKey, accountId }` |
32
32
  * | `deriveOrganizationScopedSeed(info, accountId)` | `deriveScopedSeed` + `accountId` | `{ seed, accountId }` |
33
33
  * | `signOrganizationSocialReceive(index, digest, accountId)` | `signSocialReceive` + `accountId` | `{ signature, publicKey, accountId }` |
34
+ * | `listRetiredKeys(accountId?)` | `listRetiredKeys` (+ `accountId`) | `{ publicKeys, accountId? }` |
35
+ * | `deriveRetiredScopedSeed(info, publicKey, accountId?)` | `deriveScopedSeed` + `keyPublicKey` (+ `accountId`) | `{ seed, keyPublicKey, accountId? }` |
36
+ * | `signRetiredSocialReceive(index, digest, publicKey, accountId?)` | `signSocialReceive` + `keyPublicKey` (+ `accountId`) | `{ signature, publicKey, keyPublicKey, accountId? }` |
34
37
  *
35
38
  * The organization functions (ADR 0061 D6) ask for an organization key Commons
36
39
  * holds, by the organization's account id. Commons echoes `accountId` in its
@@ -38,6 +41,15 @@ import expo.modules.kotlin.modules.ModuleDefinition
38
41
  * that predates organization keys ignores the extra and answers for the
39
42
  * PERSONAL identity, which must never be taken for an organization's.
40
43
  *
44
+ * The retired functions (Commons protocol 4) reach a key the person, or the
45
+ * organization with `accountId`, rotated away from, by its public key: for
46
+ * spending the coins still at its addresses, never for signing in. Commons
47
+ * echoes the `keyPublicKey` it answered with, and an answer without that echo,
48
+ * or whose `accountId` is not the one asked for (absent for the person), is
49
+ * `null`: a Commons before protocol 4 ignores the extra and answers with the
50
+ * CURRENT key, which must never be taken for a retired one. `listRetiredKeys`
51
+ * resolves the retired public keys of that scope, minus the current one.
52
+ *
41
53
  * Every failure — Commons not installed, no identity, the caller refused, an
42
54
  * exception — resolves `null`, and the JS side (`@oxy.so/protocol`'s
43
55
  * `loadCommonsIdentityBridge`) narrows whatever does come back. Plain scalars in,
@@ -94,9 +106,9 @@ class OxyIdentityModule : Module() {
94
106
  }
95
107
 
96
108
  AsyncFunction("describeOrganization") { accountId: String ->
97
- ask(METHOD_DESCRIBE, organizationExtras(accountId)) { bundle ->
109
+ ask(METHOD_DESCRIBE, scopeExtras(accountId)) { bundle ->
98
110
  val publicKey = bundle.getString(KEY_PUBLIC_KEY)
99
- if (publicKey.isNullOrEmpty() || !echoes(bundle, accountId)) null
111
+ if (publicKey.isNullOrEmpty() || !echoesScope(bundle, accountId)) null
100
112
  else mapOf(
101
113
  KEY_VERSION to bundle.getInt(KEY_VERSION),
102
114
  KEY_PUBLIC_KEY to publicKey,
@@ -106,23 +118,23 @@ class OxyIdentityModule : Module() {
106
118
  }
107
119
 
108
120
  AsyncFunction("deriveOrganizationScopedSeed") { info: String, accountId: String ->
109
- val extras = organizationExtras(accountId).apply { putString(KEY_INFO, info) }
121
+ val extras = scopeExtras(accountId).apply { putString(KEY_INFO, info) }
110
122
  ask(METHOD_DERIVE_SCOPED_SEED, extras) { bundle ->
111
123
  val seed = bundle.getString(KEY_SEED)
112
- if (seed.isNullOrEmpty() || !echoes(bundle, accountId)) null
124
+ if (seed.isNullOrEmpty() || !echoesScope(bundle, accountId)) null
113
125
  else mapOf(KEY_SEED to seed, KEY_ACCOUNT_ID to accountId)
114
126
  }
115
127
  }
116
128
 
117
129
  AsyncFunction("signOrganizationSocialReceive") { index: Int, digest: String, accountId: String ->
118
- val extras = organizationExtras(accountId).apply {
130
+ val extras = scopeExtras(accountId).apply {
119
131
  putInt(KEY_INDEX, index)
120
132
  putString(KEY_DIGEST, digest)
121
133
  }
122
134
  ask(METHOD_SIGN_SOCIAL_RECEIVE, extras) { bundle ->
123
135
  val signature = bundle.getString(KEY_SIGNATURE)
124
136
  val publicKey = bundle.getString(KEY_PUBLIC_KEY)
125
- if (signature.isNullOrEmpty() || publicKey.isNullOrEmpty() || !echoes(bundle, accountId)) null
137
+ if (signature.isNullOrEmpty() || publicKey.isNullOrEmpty() || !echoesScope(bundle, accountId)) null
126
138
  else mapOf(
127
139
  KEY_SIGNATURE to signature,
128
140
  KEY_PUBLIC_KEY to publicKey,
@@ -130,15 +142,68 @@ class OxyIdentityModule : Module() {
130
142
  )
131
143
  }
132
144
  }
145
+
146
+ AsyncFunction("listRetiredKeys") { accountId: String? ->
147
+ ask(METHOD_LIST_RETIRED_KEYS, scopeExtras(accountId)) { bundle ->
148
+ val publicKeys = bundle.getStringArrayList(KEY_PUBLIC_KEYS)
149
+ if (publicKeys == null || !echoesScope(bundle, accountId)) null
150
+ else scoped(accountId, KEY_PUBLIC_KEYS to publicKeys.toList())
151
+ }
152
+ }
153
+
154
+ AsyncFunction("deriveRetiredScopedSeed") { info: String, publicKey: String, accountId: String? ->
155
+ val extras = retiredExtras(publicKey, accountId).apply { putString(KEY_INFO, info) }
156
+ ask(METHOD_DERIVE_SCOPED_SEED, extras) { bundle ->
157
+ val seed = bundle.getString(KEY_SEED)
158
+ if (seed.isNullOrEmpty() || !echoesRetired(bundle, publicKey, accountId)) null
159
+ else scoped(accountId, KEY_SEED to seed, KEY_KEY_PUBLIC_KEY to publicKey)
160
+ }
161
+ }
162
+
163
+ AsyncFunction("signRetiredSocialReceive") { index: Int, digest: String, publicKey: String, accountId: String? ->
164
+ val extras = retiredExtras(publicKey, accountId).apply {
165
+ putInt(KEY_INDEX, index)
166
+ putString(KEY_DIGEST, digest)
167
+ }
168
+ ask(METHOD_SIGN_SOCIAL_RECEIVE, extras) { bundle ->
169
+ val signature = bundle.getString(KEY_SIGNATURE)
170
+ val childPublicKey = bundle.getString(KEY_PUBLIC_KEY)
171
+ if (
172
+ signature.isNullOrEmpty() ||
173
+ childPublicKey.isNullOrEmpty() ||
174
+ !echoesRetired(bundle, publicKey, accountId)
175
+ ) null
176
+ else scoped(
177
+ accountId,
178
+ KEY_SIGNATURE to signature,
179
+ KEY_PUBLIC_KEY to childPublicKey,
180
+ KEY_KEY_PUBLIC_KEY to publicKey,
181
+ )
182
+ }
183
+ }
133
184
  }
134
185
 
135
- private fun organizationExtras(accountId: String): Bundle =
136
- Bundle().apply { putString(KEY_ACCOUNT_ID, accountId) }
186
+ private fun scopeExtras(accountId: String?): Bundle =
187
+ Bundle().apply { if (accountId != null) putString(KEY_ACCOUNT_ID, accountId) }
188
+
189
+ private fun retiredExtras(publicKey: String, accountId: String?): Bundle =
190
+ scopeExtras(accountId).apply { putString(KEY_KEY_PUBLIC_KEY, publicKey) }
137
191
 
138
- /** Whether Commons answered for the organization asked for, not for the person. */
139
- private fun echoes(bundle: Bundle, accountId: String): Boolean =
192
+ /**
193
+ * Whether Commons answered for the scope asked for: that organization, or,
194
+ * with no `accountId`, the person (an answer without the echo).
195
+ */
196
+ private fun echoesScope(bundle: Bundle, accountId: String?): Boolean =
140
197
  bundle.getString(KEY_ACCOUNT_ID) == accountId
141
198
 
199
+ /** Whether Commons answered with the retired key asked for, in the scope asked for. */
200
+ private fun echoesRetired(bundle: Bundle, publicKey: String, accountId: String?): Boolean =
201
+ bundle.getString(KEY_KEY_PUBLIC_KEY) == publicKey && echoesScope(bundle, accountId)
202
+
203
+ /** [fields], plus the `accountId` echo when the request named one. */
204
+ private fun scoped(accountId: String?, vararg fields: Pair<String, Any>): Map<String, Any> =
205
+ if (accountId == null) mapOf(*fields) else mapOf(*fields, KEY_ACCOUNT_ID to accountId)
206
+
142
207
  /**
143
208
  * Call [method] on the first Commons authority that answers, and read the
144
209
  * answer with [read]. An authority that is absent, refuses, or throws is
@@ -160,6 +225,7 @@ class OxyIdentityModule : Module() {
160
225
  private const val METHOD_PROVE_IDENTITY = "proveIdentity"
161
226
  private const val METHOD_DERIVE_SCOPED_SEED = "deriveScopedSeed"
162
227
  private const val METHOD_SIGN_SOCIAL_RECEIVE = "signSocialReceive"
228
+ private const val METHOD_LIST_RETIRED_KEYS = "listRetiredKeys"
163
229
 
164
230
  private const val KEY_VERSION = "v"
165
231
  private const val KEY_PUBLIC_KEY = "publicKey"
@@ -171,6 +237,8 @@ class OxyIdentityModule : Module() {
171
237
  private const val KEY_INDEX = "index"
172
238
  private const val KEY_DIGEST = "digest"
173
239
  private const val KEY_ACCOUNT_ID = "accountId"
240
+ private const val KEY_KEY_PUBLIC_KEY = "keyPublicKey"
241
+ private const val KEY_PUBLIC_KEYS = "publicKeys"
174
242
 
175
243
  /**
176
244
  * Commons hosts its identity at "${applicationId}.identity": the prod app
@@ -1,15 +1,25 @@
1
1
  import ExpoModulesCore
2
+ import Security
2
3
 
3
4
  /**
4
- * iOS stub of the Commons identity bridge.
5
+ * iOS side of the Commons identity bridge.
5
6
  *
6
- * On Apple platforms the Oxy identity is shared through the Keychain Access
7
- * Group `group.so.oxy.shared`, which `@oxy.so/core`'s `KeyManager` reads
8
- * directly; there is no Commons provider to call. Every function resolves `nil`,
9
- * so `loadCommonsIdentityBridge()` answers "Commons could not help" and
10
- * `KeyManager`'s iOS branches keep using the keychain group.
7
+ * On Apple platforms the identity crosses apps through keychain access groups
8
+ * (docs/identity/ios-keychain-access-groups.md): Commons alone holds
9
+ * `<TEAM>.so.oxy.identity`, Commons and the Peable wallet hold
10
+ * `<TEAM>.so.oxy.wallet`, and every Oxy app holds `<TEAM>.group.so.oxy.shared`.
11
+ * `@oxy.so/core`'s `KeyManager` reads them directly; there is no Commons
12
+ * process to call, so every identity function resolves `nil` and
13
+ * `loadCommonsIdentityBridge()` answers "Commons could not help".
14
+ *
15
+ * The one real function is `keychainDefaultAccessGroup`: JavaScript cannot see
16
+ * the entitlements or the team prefix `$(AppIdentifierPrefix)` expands to, and
17
+ * `kSecAttrAccessGroup` must equal an entitlement value exactly.
11
18
  */
12
19
  public class OxyIdentityModule: Module {
20
+ /// The probe item: per app (its account is the bundle id), never a secret.
21
+ private static let probeService = "so.oxy.keychain-probe"
22
+
13
23
  public func definition() -> ModuleDefinition {
14
24
  Name("OxyIdentity")
15
25
 
@@ -29,7 +39,7 @@ public class OxyIdentityModule: Module {
29
39
  return nil
30
40
  }
31
41
 
32
- // Organization keys (ADR 0061 D6) are in the same keychain group on iOS.
42
+ // Organization keys (ADR 0061 D6) are in the keychain groups on iOS too.
33
43
  AsyncFunction("describeOrganization") { (_ accountId: String) -> [String: String]? in
34
44
  return nil
35
45
  }
@@ -41,5 +51,64 @@ public class OxyIdentityModule: Module {
41
51
  AsyncFunction("signOrganizationSocialReceive") { (_ index: Int, _ digest: String, _ accountId: String) -> [String: String]? in
42
52
  return nil
43
53
  }
54
+
55
+ /// The access group an item written WITHOUT `kSecAttrAccessGroup` lands in:
56
+ /// the first entry of `keychain-access-groups`, team prefix included. Apple
57
+ /// defines that as the app's default group, so it is also how `KeyManager`
58
+ /// learns which holder this binary is (Commons lists the identity group
59
+ /// first, the Peable wallet the wallet group, every other app the shared one).
60
+ ///
61
+ /// Any earlier probe item is deleted first, in every group this app can
62
+ /// reach: one written by a build with different entitlements sits in that
63
+ /// build's default group and would answer for it.
64
+ AsyncFunction("keychainDefaultAccessGroup") { () throws -> String in
65
+ let account = Bundle.main.bundleIdentifier ?? "app"
66
+ let match: [String: Any] = [
67
+ kSecClass as String: kSecClassGenericPassword,
68
+ kSecAttrService as String: OxyIdentityModule.probeService,
69
+ kSecAttrAccount as String: account,
70
+ ]
71
+ let deleted = SecItemDelete(match as CFDictionary)
72
+ if deleted != errSecSuccess && deleted != errSecItemNotFound {
73
+ throw KeychainProbeException(deleted)
74
+ }
75
+
76
+ var add = match
77
+ add[kSecValueData as String] = Data("probe".utf8)
78
+ add[kSecAttrAccessible as String] = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
79
+ add[kSecReturnAttributes as String] = kCFBooleanTrue
80
+ var result: CFTypeRef?
81
+ let added = SecItemAdd(add as CFDictionary, &result)
82
+ guard added == errSecSuccess else {
83
+ throw KeychainProbeException(added)
84
+ }
85
+ guard
86
+ let attributes = result as? [String: Any],
87
+ let group = attributes[kSecAttrAccessGroup as String] as? String
88
+ else {
89
+ throw KeychainProbeException(errSecInternalError)
90
+ }
91
+ return group
92
+ }
93
+
94
+ // Retired keys (Commons protocol 4): iOS reads them from the wallet group
95
+ // directly, like the current key.
96
+ AsyncFunction("listRetiredKeys") { (_ accountId: String?) -> [String: Any]? in
97
+ return nil
98
+ }
99
+
100
+ AsyncFunction("deriveRetiredScopedSeed") { (_ info: String, _ publicKey: String, _ accountId: String?) -> [String: String]? in
101
+ return nil
102
+ }
103
+
104
+ AsyncFunction("signRetiredSocialReceive") { (_ index: Int, _ digest: String, _ publicKey: String, _ accountId: String?) -> [String: String]? in
105
+ return nil
106
+ }
107
+ }
108
+ }
109
+
110
+ internal final class KeychainProbeException: GenericException<OSStatus> {
111
+ override var reason: String {
112
+ "The keychain refused the access-group probe (OSStatus \(param))"
44
113
  }
45
114
  }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createNativeSecureKeyValueStorage = createNativeSecureKeyValueStorage;
7
+ var _session = require("@oxy.so/core/session");
7
8
  var _storageHelpers = require("../utils/storageHelpers.js");
8
9
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
9
10
  * The native secure key/value seam every durable `@oxy.so/core` store in this
@@ -26,6 +27,16 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
26
27
  * evaluates the constant, so Metro resolved it anyway) and only hid it from the
27
28
  * gates that read this source.
28
29
  */
30
+ /**
31
+ * Where this app's own items go on iOS (`ownKeychainItemPlan`,
32
+ * docs/identity/ios-keychain-access-groups.md): in Commons and the Peable
33
+ * wallet, whose default keychain group the access-group split changed, the
34
+ * default group explicitly and first; in every other app the calls it always
35
+ * made. Android and web: no options.
36
+ */
37
+ async function ownItemPlan() {
38
+ return (0, _session.ownKeychainItemPlan)(await (0, _session.resolveKeychainAccess)());
39
+ }
29
40
  let secureStorePromise = null;
30
41
 
31
42
  /**
@@ -73,14 +84,14 @@ function createNativeSecureKeyValueStorage() {
73
84
  getItem: async key => {
74
85
  const secure = await loadSecureStore();
75
86
  if (secure) {
76
- return secure.getItemAsync(key);
87
+ return (0, _session.readThroughPlan)(secure, key, {}, (await ownItemPlan()).read);
77
88
  }
78
89
  return (await getAsyncStorage()).getItem(key);
79
90
  },
80
91
  setItem: async (key, value) => {
81
92
  const secure = await loadSecureStore();
82
93
  if (secure) {
83
- await secure.setItemAsync(key, value);
94
+ await secure.setItemAsync(key, value, (await ownItemPlan()).write);
84
95
  return;
85
96
  }
86
97
  await (await getAsyncStorage()).setItem(key, value);
@@ -88,7 +99,7 @@ function createNativeSecureKeyValueStorage() {
88
99
  removeItem: async key => {
89
100
  const secure = await loadSecureStore();
90
101
  if (secure) {
91
- await secure.deleteItemAsync(key);
102
+ await (0, _session.deleteThroughPlan)(secure, key, {}, (await ownItemPlan()).delete);
92
103
  return;
93
104
  }
94
105
  await (await getAsyncStorage()).removeItem(key);
@@ -1 +1 @@
1
- {"version":3,"names":["_storageHelpers","require","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","secureStorePromise","importSecureStore","mod","Promise","resolve","then","getItemAsync","setItemAsync","deleteItemAsync","bind","loadSecureStore","createNativeSecureKeyValueStorage","asyncStorage","getAsyncStorage","createPlatformStorage","getItem","key","secure","setItem","value","removeItem"],"sourceRoot":"../../../../src","sources":["ui/session/nativeSecureStorage.ts"],"m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AA,CAAOF,GAAG,EAAEG,KAAK,KAAK;MAC7B,MAAMF,MAAM,GAAG,MAAMP,eAAe,CAAC,CAAC;MACtC,IAAIO,MAAM,EAAE;QACV,MAAMA,MAAM,CAACV,YAAY,CAACS,GAAG,EAAEG,KAAK,CAAC;QACrC;MACF;MACA,MAAM,CAAC,MAAMN,eAAe,CAAC,CAAC,EAAEK,OAAO,CAACF,GAAG,EAAEG,KAAK,CAAC;IACrD,CAAC;IACDC,UAAU,EAAE,MAAOJ,GAAG,IAAK;MACzB,MAAMC,MAAM,GAAG,MAAMP,eAAe,CAAC,CAAC;MACtC,IAAIO,MAAM,EAAE;QACV,MAAMA,MAAM,CAACT,eAAe,CAACQ,GAAG,CAAC;QACjC;MACF;MACA,MAAM,CAAC,MAAMH,eAAe,CAAC,CAAC,EAAEO,UAAU,CAACJ,GAAG,CAAC;IACjD;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_session","require","_storageHelpers","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownItemPlan","ownKeychainItemPlan","resolveKeychainAccess","secureStorePromise","importSecureStore","mod","Promise","resolve","then","getItemAsync","setItemAsync","deleteItemAsync","bind","loadSecureStore","createNativeSecureKeyValueStorage","asyncStorage","getAsyncStorage","createPlatformStorage","getItem","key","secure","readThroughPlan","read","setItem","value","write","removeItem","deleteThroughPlan","delete"],"sourceRoot":"../../../../src","sources":["ui/session/nativeSecureStorage.ts"],"mappings":";;;;;;AAqBA,IAAAA,QAAA,GAAAC,OAAA;AAOA,IAAAC,eAAA,GAAAD,OAAA;AAAgE,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,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,GAAG,EAAEK,KAAK,KAAK;MAC7B,MAAMJ,MAAM,GAAG,MAAMP,eAAe,CAAC,CAAC;MACtC,IAAIO,MAAM,EAAE;QACV,MAAMA,MAAM,CAACV,YAAY,CAACS,GAAG,EAAEK,KAAK,EAAE,CAAC,MAAMxB,WAAW,CAAC,CAAC,EAAEyB,KAAK,CAAC;QAClE;MACF;MACA,MAAM,CAAC,MAAMT,eAAe,CAAC,CAAC,EAAEO,OAAO,CAACJ,GAAG,EAAEK,KAAK,CAAC;IACrD,CAAC;IACDE,UAAU,EAAE,MAAOP,GAAG,IAAK;MACzB,MAAMC,MAAM,GAAG,MAAMP,eAAe,CAAC,CAAC;MACtC,IAAIO,MAAM,EAAE;QACV,MAAM,IAAAO,0BAAiB,EAACP,MAAM,EAAED,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,MAAMnB,WAAW,CAAC,CAAC,EAAE4B,MAAM,CAAC;QACtE;MACF;MACA,MAAM,CAAC,MAAMZ,eAAe,CAAC,CAAC,EAAEU,UAAU,CAACP,GAAG,CAAC;IACjD;EACF,CAAC;AACH","ignoreList":[]}
@@ -16,15 +16,15 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
16
16
  * module owns only where the bytes live, which is genuinely different per
17
17
  * platform:
18
18
  *
19
- * - **iOS** — one `expo-secure-store` item in the approved Keychain Access Group
20
- * `group.so.oxy.shared`, under its OWN `keychainService`
21
- * ({@link IOS_DEVICE_SESSION_KEYCHAIN_SERVICE}). Every identity slot uses a
22
- * different service (`oxy_identity`, `oxy_identity_backup`,
23
- * `oxy_identity_mnemonic`) and the legacy cross-app identity keypair uses the
24
- * same group with NO service at all — so this item cannot alias any of them.
25
- * That separation is the point of the whole phase: the group-shared identity
26
- * key and the group-shared device-session credential are different secrets
27
- * with different blast radii and must not be conflated.
19
+ * - **iOS** — one `expo-secure-store` item in the keychain access group every
20
+ * Oxy app holds, `<TEAM>.group.so.oxy.shared`, under its OWN
21
+ * `keychainService` ({@link IOS_DEVICE_SESSION_KEYCHAIN_SERVICE}). The
22
+ * `accessGroup` is the full team-prefixed value `@oxy.so/core` resolves
23
+ * (`resolveKeychainAccess`, docs/identity/ios-keychain-access-groups.md):
24
+ * Commons' DEFAULT group is the identity group, so without it Commons would
25
+ * write this item where no sibling can read it. Identity keys never share
26
+ * this group (they are in the identity and wallet groups), and this item's
27
+ * service aliases none of theirs.
28
28
  * - **Android** — the signature-protected `OxyDeviceSession` broker (its own
29
29
  * EncryptedSharedPreferences file, its own ContentProvider, its own
30
30
  * `signature`-level permission). It carries a session credential; it can NOT
@@ -48,9 +48,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
48
48
  * fail and why the `unavailable` verdict exists at all.
49
49
  */
50
50
  /**
51
- * The iOS Keychain Access Group every official Oxy app declares in its
52
- * entitlements. Shared with the identity slots — the group is the app-group
53
- * boundary, not the secret's identity.
51
+ * The keychain access group (after the team prefix) every Oxy app declares.
52
+ * The value passed to the keychain is `<TEAM>.` + this; see
53
+ * {@link sharedGroupOptions}.
54
54
  */
55
55
  const IOS_KEYCHAIN_ACCESS_GROUP = exports.IOS_KEYCHAIN_ACCESS_GROUP = 'group.so.oxy.shared';
56
56
 
@@ -137,11 +137,22 @@ function parseStoredCredential(raw) {
137
137
  * two is what would let a locked phone look like a device that never had a
138
138
  * session.
139
139
  */
140
- function createKeychainGroupCredentialStore() {
141
- const readOptions = {
140
+ /**
141
+ * The options of the credential item: its own service, and the shared group's
142
+ * full `accessGroup` (none on a native build whose module predates the probe,
143
+ * whose one shared group is its default anyway). Throws while the keychain
144
+ * cannot say which groups this app holds, which reads as `unavailable`.
145
+ */
146
+ async function sharedGroupOptions() {
147
+ const accessGroup = (0, _session.keychainAccessGroupValue)(await (0, _session.resolveKeychainAccess)(), 'shared');
148
+ return {
142
149
  keychainService: IOS_DEVICE_SESSION_KEYCHAIN_SERVICE,
143
- keychainAccessGroup: IOS_KEYCHAIN_ACCESS_GROUP
150
+ ...(accessGroup ? {
151
+ accessGroup
152
+ } : {})
144
153
  };
154
+ }
155
+ function createKeychainGroupCredentialStore() {
145
156
  return {
146
157
  read: async () => {
147
158
  const store = await loadKeychainGroupStore();
@@ -152,7 +163,7 @@ function createKeychainGroupCredentialStore() {
152
163
  }
153
164
  let raw;
154
165
  try {
155
- raw = await store.getItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, readOptions);
166
+ raw = await store.getItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, await sharedGroupOptions());
156
167
  } catch (error) {
157
168
  return {
158
169
  state: 'unavailable',
@@ -185,6 +196,7 @@ function createKeychainGroupCredentialStore() {
185
196
  }
186
197
  const value = JSON.stringify(credential);
187
198
  try {
199
+ const readOptions = await sharedGroupOptions();
188
200
  await store.setItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, value, {
189
201
  ...readOptions,
190
202
  keychainAccessible: store.WHEN_UNLOCKED_THIS_DEVICE_ONLY
@@ -204,7 +216,7 @@ function createKeychainGroupCredentialStore() {
204
216
  return;
205
217
  }
206
218
  try {
207
- await store.deleteItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, readOptions);
219
+ await store.deleteItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, await sharedGroupOptions());
208
220
  } catch {
209
221
  // Best-effort: the slot is a join point, not a source of truth.
210
222
  }
@@ -298,7 +310,7 @@ function createBrokerCredentialStore() {
298
310
  *
299
311
  * The branch is on the PLATFORM, not on which module happens to load, because
300
312
  * `expo-secure-store` loads perfectly well on Android — it would just quietly
301
- * ignore `keychainAccessGroup` and read a package-private item, which looks
313
+ * ignore `accessGroup` and read a package-private item, which looks
302
314
  * exactly like an empty shared slot. This is the same iOS-vs-Android split
303
315
  * `KeyManager` makes for the shared identity, for the same reason.
304
316
  *
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_expoModulesCore","_session","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","IOS_KEYCHAIN_ACCESS_GROUP","exports","IOS_DEVICE_SESSION_KEYCHAIN_SERVICE","SHARED_DEVICE_SESSION_STORAGE_KEY","keychainStorePromise","importKeychainGroupStore","mod","Promise","resolve","then","getItemAsync","setItemAsync","deleteItemAsync","WHEN_UNLOCKED_THIS_DEVICE_ONLY","bind","loadKeychainGroupStore","parseStoredCredential","raw","parsed","JSON","parse","candidate","deviceId","length","deviceSecret","createKeychainGroupCredentialStore","readOptions","keychainService","keychainAccessGroup","read","store","state","error","cause","credential","Error","publish","value","stringify","keychainAccessible","clear","brokerModule","loadBrokerModule","undefined","native","requireOptionalNativeModule","write","createBrokerCredentialStore","broker","normalizeSharedDeviceSessionRead","createPlatformSharedDeviceCredentialStore","Platform","OS"],"sourceRoot":"../../../../src","sources":["ui/session/sharedDeviceCredentialStore.ts"],"mappings":";;;;;;;AAuCA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAK8B,SAAAG,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,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Native","require","_expoModulesCore","_session","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","IOS_KEYCHAIN_ACCESS_GROUP","exports","IOS_DEVICE_SESSION_KEYCHAIN_SERVICE","SHARED_DEVICE_SESSION_STORAGE_KEY","keychainStorePromise","importKeychainGroupStore","mod","Promise","resolve","then","getItemAsync","setItemAsync","deleteItemAsync","WHEN_UNLOCKED_THIS_DEVICE_ONLY","bind","loadKeychainGroupStore","parseStoredCredential","raw","parsed","JSON","parse","candidate","deviceId","length","deviceSecret","sharedGroupOptions","accessGroup","keychainAccessGroupValue","resolveKeychainAccess","keychainService","createKeychainGroupCredentialStore","read","store","state","error","cause","credential","Error","publish","value","stringify","readOptions","keychainAccessible","clear","brokerModule","loadBrokerModule","undefined","native","requireOptionalNativeModule","write","createBrokerCredentialStore","broker","normalizeSharedDeviceSessionRead","createPlatformSharedDeviceCredentialStore","Platform","OS"],"sourceRoot":"../../../../src","sources":["ui/session/sharedDeviceCredentialStore.ts"],"mappings":";;;;;;;AAuCA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAO8B,SAAAG,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAA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F;MACA,IAAI;QACF,MAAMA,MAAM,CAACR,KAAK,CAAC,CAAC;MACtB,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASU,yCAAyCA,CAAA,EAAuC;EAC9F,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,IAAI;EACb;EACA,OAAOD,qBAAQ,CAACC,EAAE,KAAK,KAAK,GACxBzB,kCAAkC,CAAC,CAAC,GACpCoB,2BAA2B,CAAC,CAAC;AACnC","ignoreList":[]}
@@ -21,8 +21,18 @@
21
21
  * evaluates the constant, so Metro resolved it anyway) and only hid it from the
22
22
  * gates that read this source.
23
23
  */
24
-
24
+ import { deleteThroughPlan, ownKeychainItemPlan, readThroughPlan, resolveKeychainAccess } from '@oxy.so/core/session';
25
25
  import { createPlatformStorage } from "../utils/storageHelpers.js";
26
+ /**
27
+ * Where this app's own items go on iOS (`ownKeychainItemPlan`,
28
+ * docs/identity/ios-keychain-access-groups.md): in Commons and the Peable
29
+ * wallet, whose default keychain group the access-group split changed, the
30
+ * default group explicitly and first; in every other app the calls it always
31
+ * made. Android and web: no options.
32
+ */
33
+ async function ownItemPlan() {
34
+ return ownKeychainItemPlan(await resolveKeychainAccess());
35
+ }
26
36
  let secureStorePromise = null;
27
37
 
28
38
  /**
@@ -70,14 +80,14 @@ export function createNativeSecureKeyValueStorage() {
70
80
  getItem: async key => {
71
81
  const secure = await loadSecureStore();
72
82
  if (secure) {
73
- return secure.getItemAsync(key);
83
+ return readThroughPlan(secure, key, {}, (await ownItemPlan()).read);
74
84
  }
75
85
  return (await getAsyncStorage()).getItem(key);
76
86
  },
77
87
  setItem: async (key, value) => {
78
88
  const secure = await loadSecureStore();
79
89
  if (secure) {
80
- await secure.setItemAsync(key, value);
90
+ await secure.setItemAsync(key, value, (await ownItemPlan()).write);
81
91
  return;
82
92
  }
83
93
  await (await getAsyncStorage()).setItem(key, value);
@@ -85,7 +95,7 @@ export function createNativeSecureKeyValueStorage() {
85
95
  removeItem: async key => {
86
96
  const secure = await loadSecureStore();
87
97
  if (secure) {
88
- await secure.deleteItemAsync(key);
98
+ await deleteThroughPlan(secure, key, {}, (await ownItemPlan()).delete);
89
99
  return;
90
100
  }
91
101
  await (await getAsyncStorage()).removeItem(key);
@@ -1 +1 @@
1
- {"version":3,"names":["createPlatformStorage","secureStorePromise","importSecureStore","mod","getItemAsync","setItemAsync","deleteItemAsync","bind","loadSecureStore","createNativeSecureKeyValueStorage","asyncStorage","getAsyncStorage","getItem","key","secure","setItem","value","removeItem"],"sourceRoot":"../../../../src","sources":["ui/session/nativeSecureStorage.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,qBAAqB,QAAQ,4BAAyB;AAQ/D,IAAIC,kBAA0D,GAAG,IAAI;;AAErE;AACA;AACA;AACA;AACA,eAAeC,iBAAiBA,CAAA,EAAoC;EAClE,IAAIC,GAA6B;EACjC,IAAI;IACFA,GAAG,GAAI,MAAM,MAAM,CAAC,mBAAmB,CAAyC;EAClF,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;EACA,IACE,OAAOA,GAAG,CAACC,YAAY,KAAK,UAAU,IACtC,OAAOD,GAAG,CAACE,YAAY,KAAK,UAAU,IACtC,OAAOF,GAAG,CAACG,eAAe,KAAK,UAAU,EACzC;IACA,OAAO;MACLF,YAAY,EAAED,GAAG,CAACC,YAAY,CAACG,IAAI,CAACJ,GAAG,CAAC;MACxCE,YAAY,EAAEF,GAAG,CAACE,YAAY,CAACE,IAAI,CAACJ,GAAG,CAAC;MACxCG,eAAe,EAAEH,GAAG,CAACG,eAAe,CAACC,IAAI,CAACJ,GAAG;IAC/C,CAAC;EACH;EACA,OAAO,IAAI;AACb;AA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F,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["deleteThroughPlan","ownKeychainItemPlan","readThroughPlan","resolveKeychainAccess","createPlatformStorage","ownItemPlan","secureStorePromise","importSecureStore","mod","getItemAsync","setItemAsync","deleteItemAsync","bind","loadSecureStore","createNativeSecureKeyValueStorage","asyncStorage","getAsyncStorage","getItem","key","secure","read","setItem","value","write","removeItem","delete"],"sourceRoot":"../../../../src","sources":["ui/session/nativeSecureStorage.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAEEA,iBAAiB,EACjBC,mBAAmB,EACnBC,eAAe,EACfC,qBAAqB,QAChB,sBAAsB;AAC7B,SAASC,qBAAqB,QAAQ,4BAAyB;AAQ/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,WAAWA,CAAA,EAAG;EAC3B,OAAOJ,mBAAmB,CAAC,MAAME,qBAAqB,CAAC,CAAC,CAAC;AAC3D;AAEA,IAAIG,kBAA0D,GAAG,IAAI;;AAErE;AACA;AACA;AACA;AACA,eAAeC,iBAAiBA,CAAA,EAAoC;EAClE,IAAIC,GAA6B;EACjC,IAAI;IACFA,GAAG,GAAI,MAAM,MAAM,CAAC,mBAAmB,CAAyC;EAClF,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;EACA,IACE,OAAOA,GAAG,CAACC,YAAY,KAAK,UAAU,IACtC,OAAOD,GAAG,CAACE,YAAY,KAAK,UAAU,IACtC,OAAOF,GAAG,CAACG,eAAe,KAAK,UAAU,EACzC;IACA,OAAO;MACLF,YAAY,EAAED,GAAG,CAACC,YAAY,CAACG,IAAI,CAACJ,GAAG,CAAC;MACxCE,YAAY,EAAEF,GAAG,CAACE,YAAY,CAACE,IAAI,CAACJ,GAAG,CAAC;MACxCG,eAAe,EAAEH,GAAG,CAACG,eAAe,CAACC,IAAI,CAACJ,GAAG;IAC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,IAAIM,MAAM,EAAE;QACV,MAAMnB,iBAAiB,CAACmB,MAAM,EAAED,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,MAAMb,WAAW,CAAC,CAAC,EAAEoB,MAAM,CAAC;QACtE;MACF;MACA,MAAM,CAAC,MAAMT,eAAe,CAAC,CAAC,EAAEQ,UAAU,CAACN,GAAG,CAAC;IACjD;EACF,CAAC;AACH","ignoreList":[]}
@@ -8,15 +8,15 @@
8
8
  * module owns only where the bytes live, which is genuinely different per
9
9
  * platform:
10
10
  *
11
- * - **iOS** — one `expo-secure-store` item in the approved Keychain Access Group
12
- * `group.so.oxy.shared`, under its OWN `keychainService`
13
- * ({@link IOS_DEVICE_SESSION_KEYCHAIN_SERVICE}). Every identity slot uses a
14
- * different service (`oxy_identity`, `oxy_identity_backup`,
15
- * `oxy_identity_mnemonic`) and the legacy cross-app identity keypair uses the
16
- * same group with NO service at all — so this item cannot alias any of them.
17
- * That separation is the point of the whole phase: the group-shared identity
18
- * key and the group-shared device-session credential are different secrets
19
- * with different blast radii and must not be conflated.
11
+ * - **iOS** — one `expo-secure-store` item in the keychain access group every
12
+ * Oxy app holds, `<TEAM>.group.so.oxy.shared`, under its OWN
13
+ * `keychainService` ({@link IOS_DEVICE_SESSION_KEYCHAIN_SERVICE}). The
14
+ * `accessGroup` is the full team-prefixed value `@oxy.so/core` resolves
15
+ * (`resolveKeychainAccess`, docs/identity/ios-keychain-access-groups.md):
16
+ * Commons' DEFAULT group is the identity group, so without it Commons would
17
+ * write this item where no sibling can read it. Identity keys never share
18
+ * this group (they are in the identity and wallet groups), and this item's
19
+ * service aliases none of theirs.
20
20
  * - **Android** — the signature-protected `OxyDeviceSession` broker (its own
21
21
  * EncryptedSharedPreferences file, its own ContentProvider, its own
22
22
  * `signature`-level permission). It carries a session credential; it can NOT
@@ -41,12 +41,12 @@
41
41
  */
42
42
  import { Platform } from 'react-native';
43
43
  import { requireOptionalNativeModule } from 'expo-modules-core';
44
- import { normalizeSharedDeviceSessionRead } from '@oxy.so/core/session';
44
+ import { keychainAccessGroupValue, normalizeSharedDeviceSessionRead, resolveKeychainAccess } from '@oxy.so/core/session';
45
45
 
46
46
  /**
47
- * The iOS Keychain Access Group every official Oxy app declares in its
48
- * entitlements. Shared with the identity slots — the group is the app-group
49
- * boundary, not the secret's identity.
47
+ * The keychain access group (after the team prefix) every Oxy app declares.
48
+ * The value passed to the keychain is `<TEAM>.` + this; see
49
+ * {@link sharedGroupOptions}.
50
50
  */
51
51
  export const IOS_KEYCHAIN_ACCESS_GROUP = 'group.so.oxy.shared';
52
52
 
@@ -133,11 +133,22 @@ function parseStoredCredential(raw) {
133
133
  * two is what would let a locked phone look like a device that never had a
134
134
  * session.
135
135
  */
136
- function createKeychainGroupCredentialStore() {
137
- const readOptions = {
136
+ /**
137
+ * The options of the credential item: its own service, and the shared group's
138
+ * full `accessGroup` (none on a native build whose module predates the probe,
139
+ * whose one shared group is its default anyway). Throws while the keychain
140
+ * cannot say which groups this app holds, which reads as `unavailable`.
141
+ */
142
+ async function sharedGroupOptions() {
143
+ const accessGroup = keychainAccessGroupValue(await resolveKeychainAccess(), 'shared');
144
+ return {
138
145
  keychainService: IOS_DEVICE_SESSION_KEYCHAIN_SERVICE,
139
- keychainAccessGroup: IOS_KEYCHAIN_ACCESS_GROUP
146
+ ...(accessGroup ? {
147
+ accessGroup
148
+ } : {})
140
149
  };
150
+ }
151
+ function createKeychainGroupCredentialStore() {
141
152
  return {
142
153
  read: async () => {
143
154
  const store = await loadKeychainGroupStore();
@@ -148,7 +159,7 @@ function createKeychainGroupCredentialStore() {
148
159
  }
149
160
  let raw;
150
161
  try {
151
- raw = await store.getItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, readOptions);
162
+ raw = await store.getItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, await sharedGroupOptions());
152
163
  } catch (error) {
153
164
  return {
154
165
  state: 'unavailable',
@@ -181,6 +192,7 @@ function createKeychainGroupCredentialStore() {
181
192
  }
182
193
  const value = JSON.stringify(credential);
183
194
  try {
195
+ const readOptions = await sharedGroupOptions();
184
196
  await store.setItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, value, {
185
197
  ...readOptions,
186
198
  keychainAccessible: store.WHEN_UNLOCKED_THIS_DEVICE_ONLY
@@ -200,7 +212,7 @@ function createKeychainGroupCredentialStore() {
200
212
  return;
201
213
  }
202
214
  try {
203
- await store.deleteItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, readOptions);
215
+ await store.deleteItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, await sharedGroupOptions());
204
216
  } catch {
205
217
  // Best-effort: the slot is a join point, not a source of truth.
206
218
  }
@@ -294,7 +306,7 @@ function createBrokerCredentialStore() {
294
306
  *
295
307
  * The branch is on the PLATFORM, not on which module happens to load, because
296
308
  * `expo-secure-store` loads perfectly well on Android — it would just quietly
297
- * ignore `keychainAccessGroup` and read a package-private item, which looks
309
+ * ignore `accessGroup` and read a package-private item, which looks
298
310
  * exactly like an empty shared slot. This is the same iOS-vs-Android split
299
311
  * `KeyManager` makes for the shared identity, for the same reason.
300
312
  *
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","requireOptionalNativeModule","normalizeSharedDeviceSessionRead","IOS_KEYCHAIN_ACCESS_GROUP","IOS_DEVICE_SESSION_KEYCHAIN_SERVICE","SHARED_DEVICE_SESSION_STORAGE_KEY","keychainStorePromise","importKeychainGroupStore","mod","getItemAsync","setItemAsync","deleteItemAsync","WHEN_UNLOCKED_THIS_DEVICE_ONLY","bind","loadKeychainGroupStore","parseStoredCredential","raw","parsed","JSON","parse","candidate","deviceId","length","deviceSecret","createKeychainGroupCredentialStore","readOptions","keychainService","keychainAccessGroup","read","store","state","error","cause","credential","Error","publish","value","stringify","keychainAccessible","clear","brokerModule","loadBrokerModule","undefined","native","write","createBrokerCredentialStore","broker","createPlatformSharedDeviceCredentialStore","OS"],"sourceRoot":"../../../../src","sources":["ui/session/sharedDeviceCredentialStore.ts"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IAAuB;MAC/C,MAAMa,MAAM,GAAGL,gBAAgB,CAAC,CAAC;MACjC,IAAI,CAACK,MAAM,EAAE;QACX,OAAO,KAAK;MACd;MACA,IAAI;QACF;QACA,OAAO,MAAMA,MAAM,CAACF,KAAK,CAACX,UAAU,CAACZ,QAAQ,EAAEY,UAAU,CAACV,YAAY,CAAC;MACzE,CAAC,CAAC,MAAM;QACN,OAAO,KAAK;MACd;IACF,CAAC;IAEDgB,KAAK,EAAE,MAAAA,CAAA,KAA2B;MAChC,MAAMO,MAAM,GAAGL,gBAAgB,CAAC,CAAC;MACjC,IAAI,CAACK,MAAM,EAAE;QACX;MACF;MACA,IAAI;QACF,MAAMA,MAAM,CAACP,KAAK,CAAC,CAAC;MACtB,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,yCAAyCA,CAAA,EAAuC;EAC9F,IAAI/C,QAAQ,CAACgD,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,IAAI;EACb;EACA,OAAOhD,QAAQ,CAACgD,EAAE,KAAK,KAAK,GACxBxB,kCAAkC,CAAC,CAAC,GACpCqB,2BAA2B,CAAC,CAAC;AACnC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","requireOptionalNativeModule","keychainAccessGroupValue","normalizeSharedDeviceSessionRead","resolveKeychainAccess","IOS_KEYCHAIN_ACCESS_GROUP","IOS_DEVICE_SESSION_KEYCHAIN_SERVICE","SHARED_DEVICE_SESSION_STORAGE_KEY","keychainStorePromise","importKeychainGroupStore","mod","getItemAsync","setItemAsync","deleteItemAsync","WHEN_UNLOCKED_THIS_DEVICE_ONLY","bind","loadKeychainGroupStore","parseStoredCredential","raw","parsed","JSON","parse","candidate","deviceId","length","deviceSecret","sharedGroupOptions","accessGroup","keychainService","createKeychainGroupCredentialStore","read","store","state","error","cause","credential","Error","publish","value","stringify","readOptions","keychainAccessible","clear","brokerModule","loadBrokerModule","undefined","native","write","createBrokerCredentialStore","broker","createPlatformSharedDeviceCredentialStore","OS"],"sourceRoot":"../../../../src","sources":["ui/session/sharedDeviceCredentialStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,2BAA2B,QAAQ,mBAAmB;AAE/D,SACEC,wBAAwB,EACxBC,gCAAgC,EAChCC,qBAAqB,QAIhB,sBAAsB;;AAE7B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAG,qBAAqB;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mCAAmC,GAAG,oBAAoB;;AAEvE;AACA,OAAO,MAAMC,iCAAiC,GAAG,8BAA8B;;AAE/E;AACA;AACA;AACA;AACA;AACA;;AAQA,IAAIC,oBAA+D,GAAG,IAAI;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,wBAAwBA,CAAA,EAAuC;EAC5E,IAAIC,GAAgC;EACpC,IAAI;IACFA,GAAG,GAAI,MAAM,MAAM,CAAC,mBAAmB,CAA4C;EACrF,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;EACA,IACE,OAAOA,GAAG,CAACC,YAAY,KAAK,UAAU,IACtC,OAAOD,GAAG,CAACE,YAAY,KAAK,UAAU,IACtC,OAAOF,GAAG,CAACG,eAAe,KAAK,UAAU,IACzC,OAAOH,GAAG,CAACI,8BAA8B,KAAK,QAAQ,EACtD;IACA,OAAO;MACLH,YAAY,EAAED,GAAG,CAACC,YAAY,CAACI,IAAI,CAACL,GAAG,CAAC;MACxCE,YAAY,EAAEF,GAAG,CAACE,YA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CAAC,GACpCmB,2BAA2B,CAAC,CAAC;AACnC","ignoreList":[]}
@@ -19,7 +19,7 @@
19
19
  * evaluates the constant, so Metro resolved it anyway) and only hid it from the
20
20
  * gates that read this source.
21
21
  */
22
- import type { NativeKeyValueStorage } from '@oxy.so/core/session';
22
+ import { type NativeKeyValueStorage } from '@oxy.so/core/session';
23
23
  /**
24
24
  * A native `NativeKeyValueStorage` that prefers `expo-secure-store` (encrypted
25
25
  * at rest) and falls back to AsyncStorage when SecureStore is not installed.
@@ -1 +1 @@
1
- {"version":3,"file":"nativeSecureStorage.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/nativeSecureStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AA2ClE;;;;;GAKG;AACH,wBAAgB,iCAAiC,IAAI,qBAAqB,CAiCzE"}
1
+ {"version":3,"file":"nativeSecureStorage.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/nativeSecureStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,KAAK,qBAAqB,EAK3B,MAAM,sBAAsB,CAAC;AAsD9B;;;;;GAKG;AACH,wBAAgB,iCAAiC,IAAI,qBAAqB,CAiCzE"}
@@ -1,8 +1,8 @@
1
1
  import { type SharedDeviceCredentialStore } from '@oxy.so/core/session';
2
2
  /**
3
- * The iOS Keychain Access Group every official Oxy app declares in its
4
- * entitlements. Shared with the identity slots — the group is the app-group
5
- * boundary, not the secret's identity.
3
+ * The keychain access group (after the team prefix) every Oxy app declares.
4
+ * The value passed to the keychain is `<TEAM>.` + this; see
5
+ * {@link sharedGroupOptions}.
6
6
  */
7
7
  export declare const IOS_KEYCHAIN_ACCESS_GROUP = "group.so.oxy.shared";
8
8
  /**
@@ -20,7 +20,7 @@ export declare const SHARED_DEVICE_SESSION_STORAGE_KEY = "oxy_shared_device_sess
20
20
  *
21
21
  * The branch is on the PLATFORM, not on which module happens to load, because
22
22
  * `expo-secure-store` loads perfectly well on Android — it would just quietly
23
- * ignore `keychainAccessGroup` and read a package-private item, which looks
23
+ * ignore `accessGroup` and read a package-private item, which looks
24
24
  * exactly like an empty shared slot. This is the same iOS-vs-Android split
25
25
  * `KeyManager` makes for the shared identity, for the same reason.
26
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AAyCA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,uBAAuB,CAAC;AAExE,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAqPhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yCAAyC,IAAI,2BAA2B,GAAG,IAAI,CAO9F"}
1
+ {"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AA0CA,OAAO,EAML,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,uBAAuB,CAAC;AAExE,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAkQhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yCAAyC,IAAI,2BAA2B,GAAG,IAAI,CAO9F"}
@@ -26,6 +26,30 @@ export declare const loadIdentityCrypto: () => Promise<{
26
26
  syncOrganizationKeys: typeof import("@oxy.so/core/crypto").syncOrganizationKeys;
27
27
  isOrganizationAccountId: typeof import("@oxy.so/core/crypto").isOrganizationAccountId;
28
28
  isHealthyOrganizationKeyPair: typeof import("@oxy.so/core/crypto").isHealthyOrganizationKeyPair;
29
+ KEYCHAIN_ACCESS_GROUPS: {
30
+ readonly identity: "so.oxy.identity";
31
+ readonly wallet: "so.oxy.wallet";
32
+ readonly shared: "group.so.oxy.shared";
33
+ };
34
+ KeychainAccessUnavailableError: typeof import("@oxy.so/core/session").KeychainAccessUnavailableError;
35
+ keychainGroupFor: typeof import("@oxy.so/core/crypto").keychainGroupFor;
36
+ mayHoldKeychainItem: typeof import("@oxy.so/core/crypto").mayHoldKeychainItem;
37
+ resolveKeychainAccess: typeof import("@oxy.so/core/session").resolveKeychainAccess;
38
+ keychainAccessGroupValue: typeof import("@oxy.so/core/session").keychainAccessGroupValue;
39
+ keychainReadPlan: typeof import("@oxy.so/core/crypto").keychainReadPlan;
40
+ keychainDeletePlan: typeof import("@oxy.so/core/crypto").keychainDeletePlan;
41
+ keychainWriteOption: typeof import("@oxy.so/core/crypto").keychainWriteOption;
42
+ ownKeychainItemPlan: typeof import("@oxy.so/core/session").ownKeychainItemPlan;
43
+ readThroughPlan: typeof import("@oxy.so/core/session").readThroughPlan;
44
+ deleteThroughPlan: typeof import("@oxy.so/core/session").deleteThroughPlan;
45
+ groupedKeychainStore: typeof import("@oxy.so/core/crypto").groupedKeychainStore;
46
+ ensureKeychainGroupsMigrated: typeof import("@oxy.so/core/crypto").ensureKeychainGroupsMigrated;
47
+ retireIdentityKey: typeof import("@oxy.so/core/crypto").retireIdentityKey;
48
+ listRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").listRetiredIdentityKeys;
49
+ forgetRetiredIdentityKey: typeof import("@oxy.so/core/crypto").forgetRetiredIdentityKey;
50
+ forgetRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").forgetRetiredIdentityKeys;
51
+ syncRetiredKeys: typeof import("@oxy.so/core/crypto").syncRetiredKeys;
52
+ retiredKeyFromPhrase: typeof import("@oxy.so/core/crypto").retiredKeyFromPhrase;
29
53
  SignatureService: typeof import("@oxy.so/core/crypto").SignatureService;
30
54
  RecoveryPhraseService: typeof import("@oxy.so/core/crypto").RecoveryPhraseService;
31
55
  BACKUP_KDF_ENCRYPTION_INFO: "oxy-backup-encryption-key";
@@ -1 +1 @@
1
- {"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
1
+ {"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
@@ -19,7 +19,7 @@
19
19
  * evaluates the constant, so Metro resolved it anyway) and only hid it from the
20
20
  * gates that read this source.
21
21
  */
22
- import type { NativeKeyValueStorage } from '@oxy.so/core/session';
22
+ import { type NativeKeyValueStorage } from '@oxy.so/core/session';
23
23
  /**
24
24
  * A native `NativeKeyValueStorage` that prefers `expo-secure-store` (encrypted
25
25
  * at rest) and falls back to AsyncStorage when SecureStore is not installed.
@@ -1 +1 @@
1
- {"version":3,"file":"nativeSecureStorage.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/nativeSecureStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AA2ClE;;;;;GAKG;AACH,wBAAgB,iCAAiC,IAAI,qBAAqB,CAiCzE"}
1
+ {"version":3,"file":"nativeSecureStorage.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/nativeSecureStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,KAAK,qBAAqB,EAK3B,MAAM,sBAAsB,CAAC;AAsD9B;;;;;GAKG;AACH,wBAAgB,iCAAiC,IAAI,qBAAqB,CAiCzE"}
@@ -1,8 +1,8 @@
1
1
  import { type SharedDeviceCredentialStore } from '@oxy.so/core/session';
2
2
  /**
3
- * The iOS Keychain Access Group every official Oxy app declares in its
4
- * entitlements. Shared with the identity slots — the group is the app-group
5
- * boundary, not the secret's identity.
3
+ * The keychain access group (after the team prefix) every Oxy app declares.
4
+ * The value passed to the keychain is `<TEAM>.` + this; see
5
+ * {@link sharedGroupOptions}.
6
6
  */
7
7
  export declare const IOS_KEYCHAIN_ACCESS_GROUP = "group.so.oxy.shared";
8
8
  /**
@@ -20,7 +20,7 @@ export declare const SHARED_DEVICE_SESSION_STORAGE_KEY = "oxy_shared_device_sess
20
20
  *
21
21
  * The branch is on the PLATFORM, not on which module happens to load, because
22
22
  * `expo-secure-store` loads perfectly well on Android — it would just quietly
23
- * ignore `keychainAccessGroup` and read a package-private item, which looks
23
+ * ignore `accessGroup` and read a package-private item, which looks
24
24
  * exactly like an empty shared slot. This is the same iOS-vs-Android split
25
25
  * `KeyManager` makes for the shared identity, for the same reason.
26
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AAyCA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,uBAAuB,CAAC;AAExE,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAqPhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yCAAyC,IAAI,2BAA2B,GAAG,IAAI,CAO9F"}
1
+ {"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AA0CA,OAAO,EAML,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,uBAAuB,CAAC;AAExE,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AAkQhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yCAAyC,IAAI,2BAA2B,GAAG,IAAI,CAO9F"}
@@ -26,6 +26,30 @@ export declare const loadIdentityCrypto: () => Promise<{
26
26
  syncOrganizationKeys: typeof import("@oxy.so/core/crypto").syncOrganizationKeys;
27
27
  isOrganizationAccountId: typeof import("@oxy.so/core/crypto").isOrganizationAccountId;
28
28
  isHealthyOrganizationKeyPair: typeof import("@oxy.so/core/crypto").isHealthyOrganizationKeyPair;
29
+ KEYCHAIN_ACCESS_GROUPS: {
30
+ readonly identity: "so.oxy.identity";
31
+ readonly wallet: "so.oxy.wallet";
32
+ readonly shared: "group.so.oxy.shared";
33
+ };
34
+ KeychainAccessUnavailableError: typeof import("@oxy.so/core/session").KeychainAccessUnavailableError;
35
+ keychainGroupFor: typeof import("@oxy.so/core/crypto").keychainGroupFor;
36
+ mayHoldKeychainItem: typeof import("@oxy.so/core/crypto").mayHoldKeychainItem;
37
+ resolveKeychainAccess: typeof import("@oxy.so/core/session").resolveKeychainAccess;
38
+ keychainAccessGroupValue: typeof import("@oxy.so/core/session").keychainAccessGroupValue;
39
+ keychainReadPlan: typeof import("@oxy.so/core/crypto").keychainReadPlan;
40
+ keychainDeletePlan: typeof import("@oxy.so/core/crypto").keychainDeletePlan;
41
+ keychainWriteOption: typeof import("@oxy.so/core/crypto").keychainWriteOption;
42
+ ownKeychainItemPlan: typeof import("@oxy.so/core/session").ownKeychainItemPlan;
43
+ readThroughPlan: typeof import("@oxy.so/core/session").readThroughPlan;
44
+ deleteThroughPlan: typeof import("@oxy.so/core/session").deleteThroughPlan;
45
+ groupedKeychainStore: typeof import("@oxy.so/core/crypto").groupedKeychainStore;
46
+ ensureKeychainGroupsMigrated: typeof import("@oxy.so/core/crypto").ensureKeychainGroupsMigrated;
47
+ retireIdentityKey: typeof import("@oxy.so/core/crypto").retireIdentityKey;
48
+ listRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").listRetiredIdentityKeys;
49
+ forgetRetiredIdentityKey: typeof import("@oxy.so/core/crypto").forgetRetiredIdentityKey;
50
+ forgetRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").forgetRetiredIdentityKeys;
51
+ syncRetiredKeys: typeof import("@oxy.so/core/crypto").syncRetiredKeys;
52
+ retiredKeyFromPhrase: typeof import("@oxy.so/core/crypto").retiredKeyFromPhrase;
29
53
  SignatureService: typeof import("@oxy.so/core/crypto").SignatureService;
30
54
  RecoveryPhraseService: typeof import("@oxy.so/core/crypto").RecoveryPhraseService;
31
55
  BACKUP_KDF_ENCRYPTION_INFO: "oxy-backup-encryption-key";
@@ -1 +1 @@
1
- {"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
1
+ {"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/services",
3
- "version": "14.7.0",
3
+ "version": "14.9.0",
4
4
  "description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -176,14 +176,14 @@
176
176
  "delete-dts.js": "find ./lib/commonjs ./lib/module \\( -name '*.d.js*' -o -name '*.d.ts' \\) -delete"
177
177
  },
178
178
  "dependencies": {
179
- "@oxy.so/contracts": "^6.11.0",
179
+ "@oxy.so/contracts": "^6.12.0",
180
180
  "color": "^5.0.3",
181
181
  "@peable.to/sdk": "^4.0.0"
182
182
  },
183
183
  "devDependencies": {
184
184
  "@expo/app-integrity": "~58.0.2",
185
185
  "@expo/vector-icons": "^15.1.1",
186
- "@oxy.so/core": "7.28.0",
186
+ "@oxy.so/core": "7.30.0",
187
187
  "@react-native-async-storage/async-storage": "^3.1.1",
188
188
  "@react-native-community/netinfo": "^12.0.1",
189
189
  "@react-native/babel-preset": "^0.88.1",
@@ -236,7 +236,7 @@
236
236
  "@expo/app-integrity": ">=0.1.10 <59.0.0",
237
237
  "@expo/vector-icons": "^15.0.3",
238
238
  "@oxy.so/bloom": ">=11.1.0",
239
- "@oxy.so/core": "^7.13.0",
239
+ "@oxy.so/core": "^7.30.0",
240
240
  "@react-native-async-storage/async-storage": ">=2.0.0 <4.0.0",
241
241
  "@react-native-community/netinfo": ">=11.4.1 <13.0.0",
242
242
  "@tanstack/query-async-storage-persister": "^5.101",
@@ -8,7 +8,7 @@
8
8
  * explicit status. Collapsing either failure into "absent" is what would let a
9
9
  * locked device look like one that never had a session.
10
10
  */
11
- import type { SharedDeviceCredentialStore } from '@oxy.so/core/session';
11
+ import type { KeychainAccess, SharedDeviceCredentialStore } from '@oxy.so/core/session';
12
12
 
13
13
  const CRED = { deviceId: 'dev-shared', deviceSecret: 'ds-shared' };
14
14
  const STORAGE_KEY = 'oxy_shared_device_session_v1';
@@ -85,9 +85,19 @@ function loadStore(
85
85
  seams: {
86
86
  secureStore?: ReturnType<typeof makeSecureStoreMock>;
87
87
  broker?: BrokerModule | null;
88
+ /** What `resolveKeychainAccess` answers (an Error: throws); default: a build without the probe. */
89
+ access?: KeychainAccess | Error;
88
90
  } = {},
89
91
  ): SharedDeviceCredentialStore | null {
90
92
  jest.resetModules();
93
+ const access: KeychainAccess | Error = seams.access ?? { mode: 'ungrouped' };
94
+ jest.doMock('@oxy.so/core/session', () => ({
95
+ ...jest.requireActual('@oxy.so/core/session'),
96
+ resolveKeychainAccess: async () => {
97
+ if (access instanceof Error) throw access;
98
+ return access;
99
+ },
100
+ }));
91
101
  jest.doMock('expo-modules-core', () => ({
92
102
  requireOptionalNativeModule: () => seams.broker ?? null,
93
103
  requireNativeModule: () => {
@@ -115,6 +125,7 @@ function loadStore(
115
125
  }
116
126
 
117
127
  afterEach(() => {
128
+ jest.dontMock('@oxy.so/core/session');
118
129
  jest.dontMock('expo-modules-core');
119
130
  jest.dontMock('expo-secure-store');
120
131
  jest.resetModules();
@@ -182,22 +193,53 @@ describe('iOS keychain-group slot', () => {
182
193
  expect((await store?.read())?.state).toBe('unavailable');
183
194
  });
184
195
 
185
- test('reads and writes carry the dedicated service AND the access group', async () => {
196
+ test('reads and writes carry the dedicated service AND the team-prefixed shared group', async () => {
197
+ // Commons: its DEFAULT group is the identity group, so an item written
198
+ // without the explicit shared group would be invisible to every sibling.
186
199
  const secureStore = makeSecureStoreMock();
187
- const store = loadStore('ios', { secureStore });
200
+ const store = loadStore('ios', {
201
+ secureStore,
202
+ access: {
203
+ mode: 'grouped',
204
+ prefix: 'ABCDE12345.',
205
+ defaultGroup: 'ABCDE12345.so.oxy.identity',
206
+ role: 'holder',
207
+ },
208
+ });
188
209
  await store?.publish(CRED);
210
+ await store?.read();
211
+ await store?.clear();
189
212
 
190
- // Without `keychainAccessGroup` the item is package-private and no sibling
191
- // app can ever join. Without the dedicated `keychainService` it shares the
192
- // legacy shared-IDENTITY namespace inside the group — the exact conflation
193
- // this phase exists to end.
213
+ // `accessGroup` is expo-secure-store's real option (`keychainAccessGroup`
214
+ // never was) and must equal the entitlement value exactly. Without the
215
+ // dedicated `keychainService` the item would share a namespace with others.
194
216
  for (const call of secureStore.calls) {
195
- expect(call.options).toMatchObject({
196
- keychainService: 'oxy_device_session',
197
- keychainAccessGroup: 'group.so.oxy.shared',
198
- });
217
+ expect(call.options).toEqual(
218
+ expect.objectContaining({
219
+ keychainService: 'oxy_device_session',
220
+ accessGroup: 'ABCDE12345.group.so.oxy.shared',
221
+ }),
222
+ );
199
223
  }
200
- expect(secureStore.calls.length).toBeGreaterThan(0);
224
+ expect(secureStore.calls.length).toBeGreaterThan(2);
225
+ });
226
+
227
+ test('a build without the keychain probe names no group (its one group is its default)', async () => {
228
+ const secureStore = makeSecureStoreMock();
229
+ const store = loadStore('ios', { secureStore });
230
+ await store?.publish(CRED);
231
+ for (const call of secureStore.calls) {
232
+ expect(call.options).toMatchObject({ keychainService: 'oxy_device_session' });
233
+ expect(call.options).not.toHaveProperty('accessGroup');
234
+ expect(call.options).not.toHaveProperty('keychainAccessGroup');
235
+ }
236
+ });
237
+
238
+ test('a keychain that cannot name its groups yet reads as unavailable, never absent', async () => {
239
+ const secureStore = makeSecureStoreMock();
240
+ const locked = loadStore('ios', { secureStore, access: new Error('locked') });
241
+ expect((await locked?.read())?.state).toBe('unavailable');
242
+ await expect(locked?.publish(CRED)).resolves.toBe(false);
201
243
  });
202
244
 
203
245
  test('the item is written device-only so it never rides an OS backup to a new handset', async () => {
@@ -19,13 +19,30 @@
19
19
  * evaluates the constant, so Metro resolved it anyway) and only hid it from the
20
20
  * gates that read this source.
21
21
  */
22
- import type { NativeKeyValueStorage } from '@oxy.so/core/session';
22
+ import {
23
+ type NativeKeyValueStorage,
24
+ deleteThroughPlan,
25
+ ownKeychainItemPlan,
26
+ readThroughPlan,
27
+ resolveKeychainAccess,
28
+ } from '@oxy.so/core/session';
23
29
  import { createPlatformStorage } from '../utils/storageHelpers';
24
30
 
25
31
  interface SecureStoreLike {
26
- getItemAsync(key: string): Promise<string | null>;
27
- setItemAsync(key: string, value: string): Promise<void>;
28
- deleteItemAsync(key: string): Promise<void>;
32
+ getItemAsync(key: string, options?: object): Promise<string | null>;
33
+ setItemAsync(key: string, value: string, options?: object): Promise<void>;
34
+ deleteItemAsync(key: string, options?: object): Promise<void>;
35
+ }
36
+
37
+ /**
38
+ * Where this app's own items go on iOS (`ownKeychainItemPlan`,
39
+ * docs/identity/ios-keychain-access-groups.md): in Commons and the Peable
40
+ * wallet, whose default keychain group the access-group split changed, the
41
+ * default group explicitly and first; in every other app the calls it always
42
+ * made. Android and web: no options.
43
+ */
44
+ async function ownItemPlan() {
45
+ return ownKeychainItemPlan(await resolveKeychainAccess());
29
46
  }
30
47
 
31
48
  let secureStorePromise: Promise<SecureStoreLike | null> | null = null;
@@ -80,14 +97,14 @@ export function createNativeSecureKeyValueStorage(): NativeKeyValueStorage {
80
97
  getItem: async (key) => {
81
98
  const secure = await loadSecureStore();
82
99
  if (secure) {
83
- return secure.getItemAsync(key);
100
+ return readThroughPlan(secure, key, {}, (await ownItemPlan()).read);
84
101
  }
85
102
  return (await getAsyncStorage()).getItem(key);
86
103
  },
87
104
  setItem: async (key, value) => {
88
105
  const secure = await loadSecureStore();
89
106
  if (secure) {
90
- await secure.setItemAsync(key, value);
107
+ await secure.setItemAsync(key, value, (await ownItemPlan()).write);
91
108
  return;
92
109
  }
93
110
  await (await getAsyncStorage()).setItem(key, value);
@@ -95,7 +112,7 @@ export function createNativeSecureKeyValueStorage(): NativeKeyValueStorage {
95
112
  removeItem: async (key) => {
96
113
  const secure = await loadSecureStore();
97
114
  if (secure) {
98
- await secure.deleteItemAsync(key);
115
+ await deleteThroughPlan(secure, key, {}, (await ownItemPlan()).delete);
99
116
  return;
100
117
  }
101
118
  await (await getAsyncStorage()).removeItem(key);
@@ -6,15 +6,15 @@
6
6
  * module owns only where the bytes live, which is genuinely different per
7
7
  * platform:
8
8
  *
9
- * - **iOS** — one `expo-secure-store` item in the approved Keychain Access Group
10
- * `group.so.oxy.shared`, under its OWN `keychainService`
11
- * ({@link IOS_DEVICE_SESSION_KEYCHAIN_SERVICE}). Every identity slot uses a
12
- * different service (`oxy_identity`, `oxy_identity_backup`,
13
- * `oxy_identity_mnemonic`) and the legacy cross-app identity keypair uses the
14
- * same group with NO service at all — so this item cannot alias any of them.
15
- * That separation is the point of the whole phase: the group-shared identity
16
- * key and the group-shared device-session credential are different secrets
17
- * with different blast radii and must not be conflated.
9
+ * - **iOS** — one `expo-secure-store` item in the keychain access group every
10
+ * Oxy app holds, `<TEAM>.group.so.oxy.shared`, under its OWN
11
+ * `keychainService` ({@link IOS_DEVICE_SESSION_KEYCHAIN_SERVICE}). The
12
+ * `accessGroup` is the full team-prefixed value `@oxy.so/core` resolves
13
+ * (`resolveKeychainAccess`, docs/identity/ios-keychain-access-groups.md):
14
+ * Commons' DEFAULT group is the identity group, so without it Commons would
15
+ * write this item where no sibling can read it. Identity keys never share
16
+ * this group (they are in the identity and wallet groups), and this item's
17
+ * service aliases none of theirs.
18
18
  * - **Android** — the signature-protected `OxyDeviceSession` broker (its own
19
19
  * EncryptedSharedPreferences file, its own ContentProvider, its own
20
20
  * `signature`-level permission). It carries a session credential; it can NOT
@@ -39,17 +39,20 @@
39
39
  */
40
40
  import { Platform } from 'react-native';
41
41
  import { requireOptionalNativeModule } from 'expo-modules-core';
42
+ import type { SecureStoreOptions } from 'expo-secure-store';
42
43
  import {
44
+ keychainAccessGroupValue,
43
45
  normalizeSharedDeviceSessionRead,
46
+ resolveKeychainAccess,
44
47
  type SharedDeviceCredential,
45
48
  type SharedDeviceCredentialRead,
46
49
  type SharedDeviceCredentialStore,
47
50
  } from '@oxy.so/core/session';
48
51
 
49
52
  /**
50
- * The iOS Keychain Access Group every official Oxy app declares in its
51
- * entitlements. Shared with the identity slots — the group is the app-group
52
- * boundary, not the secret's identity.
53
+ * The keychain access group (after the team prefix) every Oxy app declares.
54
+ * The value passed to the keychain is `<TEAM>.` + this; see
55
+ * {@link sharedGroupOptions}.
53
56
  */
54
57
  export const IOS_KEYCHAIN_ACCESS_GROUP = 'group.so.oxy.shared';
55
58
 
@@ -150,12 +153,21 @@ function parseStoredCredential(raw: string | null): SharedDeviceCredential | nul
150
153
  * two is what would let a locked phone look like a device that never had a
151
154
  * session.
152
155
  */
153
- function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
154
- const readOptions = {
156
+ /**
157
+ * The options of the credential item: its own service, and the shared group's
158
+ * full `accessGroup` (none on a native build whose module predates the probe,
159
+ * whose one shared group is its default anyway). Throws while the keychain
160
+ * cannot say which groups this app holds, which reads as `unavailable`.
161
+ */
162
+ async function sharedGroupOptions(): Promise<SecureStoreOptions> {
163
+ const accessGroup = keychainAccessGroupValue(await resolveKeychainAccess(), 'shared');
164
+ return {
155
165
  keychainService: IOS_DEVICE_SESSION_KEYCHAIN_SERVICE,
156
- keychainAccessGroup: IOS_KEYCHAIN_ACCESS_GROUP,
166
+ ...(accessGroup ? { accessGroup } : {}),
157
167
  };
168
+ }
158
169
 
170
+ function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
159
171
  return {
160
172
  read: async (): Promise<SharedDeviceCredentialRead> => {
161
173
  const store = await loadKeychainGroupStore();
@@ -164,7 +176,10 @@ function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
164
176
  }
165
177
  let raw: string | null;
166
178
  try {
167
- raw = await store.getItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, readOptions);
179
+ raw = await store.getItemAsync(
180
+ SHARED_DEVICE_SESSION_STORAGE_KEY,
181
+ await sharedGroupOptions(),
182
+ );
168
183
  } catch (error) {
169
184
  return { state: 'unavailable', cause: error };
170
185
  }
@@ -190,6 +205,7 @@ function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
190
205
  }
191
206
  const value = JSON.stringify(credential);
192
207
  try {
208
+ const readOptions = await sharedGroupOptions();
193
209
  await store.setItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, value, {
194
210
  ...readOptions,
195
211
  keychainAccessible: store.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
@@ -210,7 +226,7 @@ function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
210
226
  return;
211
227
  }
212
228
  try {
213
- await store.deleteItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, readOptions);
229
+ await store.deleteItemAsync(SHARED_DEVICE_SESSION_STORAGE_KEY, await sharedGroupOptions());
214
230
  } catch {
215
231
  // Best-effort: the slot is a join point, not a source of truth.
216
232
  }
@@ -313,7 +329,7 @@ function createBrokerCredentialStore(): SharedDeviceCredentialStore {
313
329
  *
314
330
  * The branch is on the PLATFORM, not on which module happens to load, because
315
331
  * `expo-secure-store` loads perfectly well on Android — it would just quietly
316
- * ignore `keychainAccessGroup` and read a package-private item, which looks
332
+ * ignore `accessGroup` and read a package-private item, which looks
317
333
  * exactly like an empty shared slot. This is the same iOS-vs-Android split
318
334
  * `KeyManager` makes for the shared identity, for the same reason.
319
335
  *
@@ -1,29 +0,0 @@
1
- declare module 'expo-secure-store' {
2
- export interface SecureStoreOptions {
3
- keychainAccessible?:
4
- | 'WHEN_UNLOCKED'
5
- | 'AFTER_FIRST_UNLOCK'
6
- | 'WHEN_UNLOCKED_THIS_DEVICE_ONLY'
7
- | 'AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY'
8
- | 'WHEN_PASSCODE_SET_THIS_DEVICE_ONLY';
9
- requireAuthentication?: boolean;
10
- authenticationPrompt?: string;
11
- showModal?: boolean;
12
- keychainService?: string;
13
- }
14
-
15
- export const WHEN_UNLOCKED: 'WHEN_UNLOCKED';
16
- export const AFTER_FIRST_UNLOCK: 'AFTER_FIRST_UNLOCK';
17
- export const WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'WHEN_UNLOCKED_THIS_DEVICE_ONLY';
18
- export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: 'AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY';
19
- export const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: 'WHEN_PASSCODE_SET_THIS_DEVICE_ONLY';
20
-
21
- export function setItemAsync(
22
- key: string,
23
- value: string,
24
- options?: SecureStoreOptions,
25
- ): Promise<void>;
26
- export function getItemAsync(key: string, options?: SecureStoreOptions): Promise<string | null>;
27
- export function deleteItemAsync(key: string, options?: SecureStoreOptions): Promise<void>;
28
- export function isAvailableAsync(): Promise<boolean>;
29
- }
@@ -1,29 +0,0 @@
1
- declare module 'expo-secure-store' {
2
- export interface SecureStoreOptions {
3
- keychainAccessible?:
4
- | 'WHEN_UNLOCKED'
5
- | 'AFTER_FIRST_UNLOCK'
6
- | 'WHEN_UNLOCKED_THIS_DEVICE_ONLY'
7
- | 'AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY'
8
- | 'WHEN_PASSCODE_SET_THIS_DEVICE_ONLY';
9
- requireAuthentication?: boolean;
10
- authenticationPrompt?: string;
11
- showModal?: boolean;
12
- keychainService?: string;
13
- }
14
-
15
- export const WHEN_UNLOCKED: 'WHEN_UNLOCKED';
16
- export const AFTER_FIRST_UNLOCK: 'AFTER_FIRST_UNLOCK';
17
- export const WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'WHEN_UNLOCKED_THIS_DEVICE_ONLY';
18
- export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: 'AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY';
19
- export const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: 'WHEN_PASSCODE_SET_THIS_DEVICE_ONLY';
20
-
21
- export function setItemAsync(
22
- key: string,
23
- value: string,
24
- options?: SecureStoreOptions,
25
- ): Promise<void>;
26
- export function getItemAsync(key: string, options?: SecureStoreOptions): Promise<string | null>;
27
- export function deleteItemAsync(key: string, options?: SecureStoreOptions): Promise<void>;
28
- export function isAvailableAsync(): Promise<boolean>;
29
- }