@oxy.so/services 14.12.0 → 14.14.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.
- package/ios/OxyIdentityModule.swift +84 -1
- package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js +22 -2
- package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js.map +1 -1
- package/lib/module/ui/session/sharedDeviceCredentialStore.js +23 -3
- package/lib/module/ui/session/sharedDeviceCredentialStore.js.map +1 -1
- package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts +5 -0
- package/lib/typescript/commonjs/ui/utils/identityCrypto.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/identityCrypto.d.ts +5 -0
- package/lib/typescript/module/ui/utils/identityCrypto.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/ui/session/__tests__/sharedDeviceCredentialStore.test.ts +74 -7
- package/src/ui/session/sharedDeviceCredentialStore.ts +26 -5
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
|
+
#if !os(tvOS)
|
|
3
|
+
import LocalAuthentication
|
|
4
|
+
#endif
|
|
2
5
|
import Security
|
|
6
|
+
#if canImport(UIKit)
|
|
7
|
+
import UIKit
|
|
8
|
+
#endif
|
|
3
9
|
|
|
4
10
|
/**
|
|
5
11
|
* iOS side of the Commons identity bridge.
|
|
@@ -134,6 +140,65 @@ public class OxyIdentityModule: Module {
|
|
|
134
140
|
return group
|
|
135
141
|
}
|
|
136
142
|
|
|
143
|
+
/// Read one `expo-secure-store` item WITHOUT user interaction (round-5
|
|
144
|
+
/// review R5-9). expo-secure-store's own read tries `<service>:no-auth`,
|
|
145
|
+
/// then `<service>:auth` (an item stored with `requireAuthentication`,
|
|
146
|
+
/// which prompts for Face ID or the passcode), then the legacy `<service>`.
|
|
147
|
+
/// Any app in a shared access group can plant an `:auth` copy there, so
|
|
148
|
+
/// `@oxy.so/core` reads the shared group through this instead: the
|
|
149
|
+
/// `:no-auth` and legacy copies only, with an `LAContext` that refuses
|
|
150
|
+
/// interaction, so an item that needs the user answers `nil` and no prompt
|
|
151
|
+
/// is ever shown. The query matches expo-secure-store's (service, generic
|
|
152
|
+
/// and account attributes). "Not found" answers `nil`; any other status
|
|
153
|
+
/// throws.
|
|
154
|
+
///
|
|
155
|
+
/// `errSecInteractionNotAllowed` means one of two things, and they must not
|
|
156
|
+
/// be confused (security review R6-13): an item that needs the user (Face
|
|
157
|
+
/// ID: skipped, `nil`), or a LOCKED keychain (the device is locked and the
|
|
158
|
+
/// item is `WhenUnlocked`). A locked keychain is not "absent": answering
|
|
159
|
+
/// `nil` there let Commons' access-group migration settle its one-shot
|
|
160
|
+
/// record while the shared copies it could not see stayed where every Oxy
|
|
161
|
+
/// app can read them. So while protected data is unavailable the read
|
|
162
|
+
/// THROWS, and the caller defers.
|
|
163
|
+
AsyncFunction("readKeychainItemWithoutInteraction") {
|
|
164
|
+
(_ key: String, _ service: String?, _ accessGroup: String) throws -> String? in
|
|
165
|
+
let base = service ?? "app"
|
|
166
|
+
let encodedKey = Data(key.utf8)
|
|
167
|
+
for itemService in ["\(base):no-auth", base] {
|
|
168
|
+
var query: [String: Any] = [
|
|
169
|
+
kSecClass as String: kSecClassGenericPassword,
|
|
170
|
+
kSecAttrService as String: itemService,
|
|
171
|
+
kSecAttrGeneric as String: encodedKey,
|
|
172
|
+
kSecAttrAccount as String: encodedKey,
|
|
173
|
+
kSecAttrAccessGroup as String: accessGroup,
|
|
174
|
+
kSecMatchLimit as String: kSecMatchLimitOne,
|
|
175
|
+
kSecReturnData as String: true,
|
|
176
|
+
]
|
|
177
|
+
#if !os(tvOS)
|
|
178
|
+
let context = LAContext()
|
|
179
|
+
context.interactionNotAllowed = true
|
|
180
|
+
query[kSecUseAuthenticationContext as String] = context
|
|
181
|
+
#endif
|
|
182
|
+
var item: CFTypeRef?
|
|
183
|
+
let status = SecItemCopyMatching(query as CFDictionary, &item)
|
|
184
|
+
switch status {
|
|
185
|
+
case errSecSuccess:
|
|
186
|
+
guard let data = item as? Data else { return nil }
|
|
187
|
+
return String(data: data, encoding: .utf8)
|
|
188
|
+
case errSecItemNotFound:
|
|
189
|
+
continue
|
|
190
|
+
case errSecInteractionNotAllowed, errSecAuthFailed:
|
|
191
|
+
if !OxyIdentityModule.protectedDataAvailable() {
|
|
192
|
+
throw KeychainProbeException(errSecInteractionNotAllowed)
|
|
193
|
+
}
|
|
194
|
+
continue
|
|
195
|
+
default:
|
|
196
|
+
throw KeychainProbeException(status)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return nil
|
|
200
|
+
}
|
|
201
|
+
|
|
137
202
|
// Retired keys (Commons protocol 4): iOS reads them from the wallet group
|
|
138
203
|
// directly, like the current key.
|
|
139
204
|
AsyncFunction("listRetiredKeys") { (_ accountId: String?) -> [String: Any]? in
|
|
@@ -150,8 +215,26 @@ public class OxyIdentityModule: Module {
|
|
|
150
215
|
}
|
|
151
216
|
}
|
|
152
217
|
|
|
218
|
+
extension OxyIdentityModule {
|
|
219
|
+
/// Whether the keychain's data-protection class keys are available, i.e. the
|
|
220
|
+
/// device is not locked (R6-13). `UIApplication` is main-thread only; module
|
|
221
|
+
/// functions run on a background queue, so the main queue is asked
|
|
222
|
+
/// synchronously (it never waits on this queue). Where UIKit is absent the
|
|
223
|
+
/// answer is `true`: there is no lock state to tell apart.
|
|
224
|
+
static func protectedDataAvailable() -> Bool {
|
|
225
|
+
#if canImport(UIKit) && !os(watchOS)
|
|
226
|
+
if Thread.isMainThread {
|
|
227
|
+
return UIApplication.shared.isProtectedDataAvailable
|
|
228
|
+
}
|
|
229
|
+
return DispatchQueue.main.sync { UIApplication.shared.isProtectedDataAvailable }
|
|
230
|
+
#else
|
|
231
|
+
return true
|
|
232
|
+
#endif
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
153
236
|
internal final class KeychainProbeException: GenericException<OSStatus> {
|
|
154
237
|
override var reason: String {
|
|
155
|
-
"The keychain refused the
|
|
238
|
+
"The keychain refused the request (OSStatus \(param))"
|
|
156
239
|
}
|
|
157
240
|
}
|
|
@@ -152,6 +152,26 @@ async function sharedGroupOptions() {
|
|
|
152
152
|
} : {})
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Read the credential item WITHOUT user interaction (security review R6-16).
|
|
158
|
+
* Every Oxy app can write the shared group, so any of them can plant an
|
|
159
|
+
* `oxy_device_session:auth` copy (an item stored with `requireAuthentication`);
|
|
160
|
+
* expo-secure-store's own read tries that copy and would show a Face ID prompt
|
|
161
|
+
* in every Oxy app at cold boot. `readSharedWithoutInteraction` reads only the
|
|
162
|
+
* `:no-auth` and legacy copies, with interaction refused; a native module that
|
|
163
|
+
* predates it reads through expo-secure-store as before. A locked keychain
|
|
164
|
+
* still THROWS (services' native read since 14.14.0), which is `unavailable`.
|
|
165
|
+
*/
|
|
166
|
+
async function readSharedItem(store, options) {
|
|
167
|
+
const {
|
|
168
|
+
accessGroup,
|
|
169
|
+
...rest
|
|
170
|
+
} = options;
|
|
171
|
+
return (0, _session.readSharedWithoutInteraction)(store, SHARED_DEVICE_SESSION_STORAGE_KEY, rest, accessGroup ? {
|
|
172
|
+
accessGroup
|
|
173
|
+
} : {});
|
|
174
|
+
}
|
|
155
175
|
function createKeychainGroupCredentialStore() {
|
|
156
176
|
return {
|
|
157
177
|
read: async () => {
|
|
@@ -163,7 +183,7 @@ function createKeychainGroupCredentialStore() {
|
|
|
163
183
|
}
|
|
164
184
|
let raw;
|
|
165
185
|
try {
|
|
166
|
-
raw = await store
|
|
186
|
+
raw = await readSharedItem(store, await sharedGroupOptions());
|
|
167
187
|
} catch (error) {
|
|
168
188
|
return {
|
|
169
189
|
state: 'unavailable',
|
|
@@ -205,7 +225,7 @@ function createKeychainGroupCredentialStore() {
|
|
|
205
225
|
// landed under the access group (a missing entitlement is the usual
|
|
206
226
|
// cause), and a phantom credential would send a fresh install into a mint
|
|
207
227
|
// that can never succeed.
|
|
208
|
-
return (await store
|
|
228
|
+
return (await readSharedItem(store, readOptions)) === value;
|
|
209
229
|
} catch {
|
|
210
230
|
return false;
|
|
211
231
|
}
|
|
@@ -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","sharedGroupOptions","accessGroup","keychainAccessGroupValue","resolveKeychainAccess","keychainService","
|
|
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","sharedGroupOptions","accessGroup","keychainAccessGroupValue","resolveKeychainAccess","keychainService","readSharedItem","store","options","rest","readSharedWithoutInteraction","createKeychainGroupCredentialStore","read","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;AAQ8B,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,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,C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CAAyCA,CAAA,EAAuC;EAC9F,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,IAAI;EACb;EACA,OAAOD,qBAAQ,CAACC,EAAE,KAAK,KAAK,GACxBxB,kCAAkC,CAAC,CAAC,GACpCmB,2BAA2B,CAAC,CAAC;AACnC","ignoreList":[]}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
*/
|
|
42
42
|
import { Platform } from 'react-native';
|
|
43
43
|
import { requireOptionalNativeModule } from 'expo-modules-core';
|
|
44
|
-
import { keychainAccessGroupValue, normalizeSharedDeviceSessionRead, resolveKeychainAccess } from '@oxy.so/core/session';
|
|
44
|
+
import { keychainAccessGroupValue, normalizeSharedDeviceSessionRead, readSharedWithoutInteraction, resolveKeychainAccess } from '@oxy.so/core/session';
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The keychain access group (after the team prefix) every Oxy app declares.
|
|
@@ -148,6 +148,26 @@ async function sharedGroupOptions() {
|
|
|
148
148
|
} : {})
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Read the credential item WITHOUT user interaction (security review R6-16).
|
|
154
|
+
* Every Oxy app can write the shared group, so any of them can plant an
|
|
155
|
+
* `oxy_device_session:auth` copy (an item stored with `requireAuthentication`);
|
|
156
|
+
* expo-secure-store's own read tries that copy and would show a Face ID prompt
|
|
157
|
+
* in every Oxy app at cold boot. `readSharedWithoutInteraction` reads only the
|
|
158
|
+
* `:no-auth` and legacy copies, with interaction refused; a native module that
|
|
159
|
+
* predates it reads through expo-secure-store as before. A locked keychain
|
|
160
|
+
* still THROWS (services' native read since 14.14.0), which is `unavailable`.
|
|
161
|
+
*/
|
|
162
|
+
async function readSharedItem(store, options) {
|
|
163
|
+
const {
|
|
164
|
+
accessGroup,
|
|
165
|
+
...rest
|
|
166
|
+
} = options;
|
|
167
|
+
return readSharedWithoutInteraction(store, SHARED_DEVICE_SESSION_STORAGE_KEY, rest, accessGroup ? {
|
|
168
|
+
accessGroup
|
|
169
|
+
} : {});
|
|
170
|
+
}
|
|
151
171
|
function createKeychainGroupCredentialStore() {
|
|
152
172
|
return {
|
|
153
173
|
read: async () => {
|
|
@@ -159,7 +179,7 @@ function createKeychainGroupCredentialStore() {
|
|
|
159
179
|
}
|
|
160
180
|
let raw;
|
|
161
181
|
try {
|
|
162
|
-
raw = await store
|
|
182
|
+
raw = await readSharedItem(store, await sharedGroupOptions());
|
|
163
183
|
} catch (error) {
|
|
164
184
|
return {
|
|
165
185
|
state: 'unavailable',
|
|
@@ -201,7 +221,7 @@ function createKeychainGroupCredentialStore() {
|
|
|
201
221
|
// landed under the access group (a missing entitlement is the usual
|
|
202
222
|
// cause), and a phantom credential would send a fresh install into a mint
|
|
203
223
|
// that can never succeed.
|
|
204
|
-
return (await store
|
|
224
|
+
return (await readSharedItem(store, readOptions)) === value;
|
|
205
225
|
} catch {
|
|
206
226
|
return false;
|
|
207
227
|
}
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
1
|
+
{"version":3,"names":["Platform","requireOptionalNativeModule","keychainAccessGroupValue","normalizeSharedDeviceSessionRead","readSharedWithoutInteraction","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","readSharedItem","store","options","rest","createKeychainGroupCredentialStore","read","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,4BAA4B,EAC5BC,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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F,CAAC;IAEDoB,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,IAAItD,QAAQ,CAACuD,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,IAAI;EACb;EACA,OAAOvD,QAAQ,CAACuD,EAAE,KAAK,KAAK,GACxBrB,kCAAkC,CAAC,CAAC,GACpCkB,2BAA2B,CAAC,CAAC;AACnC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AA0CA,OAAO,
|
|
1
|
+
{"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AA0CA,OAAO,EAOL,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;AAsRhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yCAAyC,IAAI,2BAA2B,GAAG,IAAI,CAO9F"}
|
|
@@ -24,8 +24,10 @@ export declare const loadIdentityCrypto: () => Promise<{
|
|
|
24
24
|
listOrganizationKeys: typeof import("@oxy.so/core/crypto").listOrganizationKeys;
|
|
25
25
|
deleteOrganizationKey: typeof import("@oxy.so/core/crypto").deleteOrganizationKey;
|
|
26
26
|
syncOrganizationKeys: typeof import("@oxy.so/core/crypto").syncOrganizationKeys;
|
|
27
|
+
adoptOrganizationKeyFromRing: typeof import("@oxy.so/core/crypto").adoptOrganizationKeyFromRing;
|
|
27
28
|
isOrganizationAccountId: typeof import("@oxy.so/core/crypto").isOrganizationAccountId;
|
|
28
29
|
isHealthyOrganizationKeyPair: typeof import("@oxy.so/core/crypto").isHealthyOrganizationKeyPair;
|
|
30
|
+
OrganizationKeyIndexUnreadableError: typeof import("@oxy.so/core/crypto").OrganizationKeyIndexUnreadableError;
|
|
29
31
|
KEYCHAIN_ACCESS_GROUPS: {
|
|
30
32
|
readonly identity: "so.oxy.identity";
|
|
31
33
|
readonly wallet: "so.oxy.wallet";
|
|
@@ -57,6 +59,9 @@ export declare const loadIdentityCrypto: () => Promise<{
|
|
|
57
59
|
exportRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").exportRetiredIdentityKeys;
|
|
58
60
|
claimRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").claimRetiredIdentityKeys;
|
|
59
61
|
countQuarantinedRetiredKeys: typeof import("@oxy.so/core/crypto").countQuarantinedRetiredKeys;
|
|
62
|
+
claimRetiredOrganizationKeys: typeof import("@oxy.so/core/crypto").claimRetiredOrganizationKeys;
|
|
63
|
+
listQuarantinedOrganizationKeys: typeof import("@oxy.so/core/crypto").listQuarantinedOrganizationKeys;
|
|
64
|
+
holdsRetiredRing: typeof import("@oxy.so/core/crypto").holdsRetiredRing;
|
|
60
65
|
unmirrorPersonalRetiredKeys: typeof import("@oxy.so/core/crypto").unmirrorPersonalRetiredKeys;
|
|
61
66
|
RetiredKeyRingUnreadableError: typeof import("@oxy.so/core/crypto").RetiredKeyRingUnreadableError;
|
|
62
67
|
SignatureService: typeof import("@oxy.so/core/crypto").SignatureService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AA0CA,OAAO,
|
|
1
|
+
{"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AA0CA,OAAO,EAOL,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;AAsRhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yCAAyC,IAAI,2BAA2B,GAAG,IAAI,CAO9F"}
|
|
@@ -24,8 +24,10 @@ export declare const loadIdentityCrypto: () => Promise<{
|
|
|
24
24
|
listOrganizationKeys: typeof import("@oxy.so/core/crypto").listOrganizationKeys;
|
|
25
25
|
deleteOrganizationKey: typeof import("@oxy.so/core/crypto").deleteOrganizationKey;
|
|
26
26
|
syncOrganizationKeys: typeof import("@oxy.so/core/crypto").syncOrganizationKeys;
|
|
27
|
+
adoptOrganizationKeyFromRing: typeof import("@oxy.so/core/crypto").adoptOrganizationKeyFromRing;
|
|
27
28
|
isOrganizationAccountId: typeof import("@oxy.so/core/crypto").isOrganizationAccountId;
|
|
28
29
|
isHealthyOrganizationKeyPair: typeof import("@oxy.so/core/crypto").isHealthyOrganizationKeyPair;
|
|
30
|
+
OrganizationKeyIndexUnreadableError: typeof import("@oxy.so/core/crypto").OrganizationKeyIndexUnreadableError;
|
|
29
31
|
KEYCHAIN_ACCESS_GROUPS: {
|
|
30
32
|
readonly identity: "so.oxy.identity";
|
|
31
33
|
readonly wallet: "so.oxy.wallet";
|
|
@@ -57,6 +59,9 @@ export declare const loadIdentityCrypto: () => Promise<{
|
|
|
57
59
|
exportRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").exportRetiredIdentityKeys;
|
|
58
60
|
claimRetiredIdentityKeys: typeof import("@oxy.so/core/crypto").claimRetiredIdentityKeys;
|
|
59
61
|
countQuarantinedRetiredKeys: typeof import("@oxy.so/core/crypto").countQuarantinedRetiredKeys;
|
|
62
|
+
claimRetiredOrganizationKeys: typeof import("@oxy.so/core/crypto").claimRetiredOrganizationKeys;
|
|
63
|
+
listQuarantinedOrganizationKeys: typeof import("@oxy.so/core/crypto").listQuarantinedOrganizationKeys;
|
|
64
|
+
holdsRetiredRing: typeof import("@oxy.so/core/crypto").holdsRetiredRing;
|
|
60
65
|
unmirrorPersonalRetiredKeys: typeof import("@oxy.so/core/crypto").unmirrorPersonalRetiredKeys;
|
|
61
66
|
RetiredKeyRingUnreadableError: typeof import("@oxy.so/core/crypto").RetiredKeyRingUnreadableError;
|
|
62
67
|
SignatureService: typeof import("@oxy.so/core/crypto").SignatureService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityCrypto.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/identityCrypto.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB
|
|
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.
|
|
3
|
+
"version": "14.14.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.
|
|
179
|
+
"@oxy.so/contracts": "^6.14.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.
|
|
186
|
+
"@oxy.so/core": "7.38.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": ">=17.15.0",
|
|
239
|
-
"@oxy.so/core": "^7.
|
|
239
|
+
"@oxy.so/core": "^7.37.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",
|
|
@@ -87,17 +87,40 @@ function loadStore(
|
|
|
87
87
|
broker?: BrokerModule | null;
|
|
88
88
|
/** What `resolveKeychainAccess` answers (an Error: throws); default: a build without the probe. */
|
|
89
89
|
access?: KeychainAccess | Error;
|
|
90
|
+
/**
|
|
91
|
+
* The OxyIdentity native read that never prompts (R6-16): `(key, service,
|
|
92
|
+
* group)`. Absent: a native module that predates it.
|
|
93
|
+
*/
|
|
94
|
+
nativeRead?: (
|
|
95
|
+
key: string,
|
|
96
|
+
service: string | undefined,
|
|
97
|
+
group: string,
|
|
98
|
+
) => Promise<string | null>;
|
|
90
99
|
} = {},
|
|
91
100
|
): SharedDeviceCredentialStore | null {
|
|
92
101
|
jest.resetModules();
|
|
93
102
|
const access: KeychainAccess | Error = seams.access ?? { mode: 'ungrouped' };
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
const nativeRead = seams.nativeRead;
|
|
104
|
+
jest.doMock('@oxy.so/core/session', () => {
|
|
105
|
+
const actual = jest.requireActual('@oxy.so/core/session');
|
|
106
|
+
return {
|
|
107
|
+
...actual,
|
|
108
|
+
resolveKeychainAccess: async () => {
|
|
109
|
+
if (access instanceof Error) throw access;
|
|
110
|
+
return access;
|
|
111
|
+
},
|
|
112
|
+
// Core's reader with the native read the module would load on a device.
|
|
113
|
+
readSharedWithoutInteraction: async (
|
|
114
|
+
store: { getItemAsync(key: string, options?: object): Promise<string | null> },
|
|
115
|
+
key: string,
|
|
116
|
+
options: { keychainService?: string },
|
|
117
|
+
shared: { accessGroup?: string },
|
|
118
|
+
) =>
|
|
119
|
+
nativeRead && shared.accessGroup
|
|
120
|
+
? nativeRead(key, options.keychainService, shared.accessGroup)
|
|
121
|
+
: actual.readSharedWithoutInteraction(store, key, options, shared),
|
|
122
|
+
};
|
|
123
|
+
});
|
|
101
124
|
jest.doMock('expo-modules-core', () => ({
|
|
102
125
|
requireOptionalNativeModule: () => seams.broker ?? null,
|
|
103
126
|
requireNativeModule: () => {
|
|
@@ -224,6 +247,50 @@ describe('iOS keychain-group slot', () => {
|
|
|
224
247
|
expect(secureStore.calls.length).toBeGreaterThan(2);
|
|
225
248
|
});
|
|
226
249
|
|
|
250
|
+
test('reads never prompt: they go through the non-interactive native read, not expo-secure-store (R6-16)', async () => {
|
|
251
|
+
// Any Oxy app can plant `oxy_device_session:auth` in the shared group;
|
|
252
|
+
// expo-secure-store's read would try it and show Face ID in every app.
|
|
253
|
+
const secureStore = makeSecureStoreMock();
|
|
254
|
+
const reads: Array<[string, string | undefined, string]> = [];
|
|
255
|
+
const store = loadStore('ios', {
|
|
256
|
+
secureStore,
|
|
257
|
+
access: {
|
|
258
|
+
mode: 'grouped',
|
|
259
|
+
prefix: 'ABCDE12345.',
|
|
260
|
+
defaultGroup: 'ABCDE12345.group.so.oxy.shared',
|
|
261
|
+
role: 'member',
|
|
262
|
+
},
|
|
263
|
+
nativeRead: async (key, service, group) => {
|
|
264
|
+
reads.push([key, service, group]);
|
|
265
|
+
return secureStore.items.get(key) ?? null;
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
await expect(store?.read()).resolves.toEqual({ state: 'absent' });
|
|
269
|
+
await expect(store?.publish(CRED)).resolves.toBe(true);
|
|
270
|
+
await expect(store?.read()).resolves.toEqual({ state: 'present', credential: CRED });
|
|
271
|
+
expect(reads).toEqual(
|
|
272
|
+
Array(3).fill([STORAGE_KEY, 'oxy_device_session', 'ABCDE12345.group.so.oxy.shared']),
|
|
273
|
+
);
|
|
274
|
+
// expo-secure-store only WROTE; it never read.
|
|
275
|
+
expect(secureStore.calls.map((call) => call.key)).toEqual([STORAGE_KEY]);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test('a locked keychain (the native read throws) is unavailable, never absent', async () => {
|
|
279
|
+
const store = loadStore('ios', {
|
|
280
|
+
secureStore: makeSecureStoreMock(),
|
|
281
|
+
access: {
|
|
282
|
+
mode: 'grouped',
|
|
283
|
+
prefix: 'ABCDE12345.',
|
|
284
|
+
defaultGroup: 'ABCDE12345.group.so.oxy.shared',
|
|
285
|
+
role: 'member',
|
|
286
|
+
},
|
|
287
|
+
nativeRead: async () => {
|
|
288
|
+
throw new Error('keychain locked');
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
expect((await store?.read())?.state).toBe('unavailable');
|
|
292
|
+
});
|
|
293
|
+
|
|
227
294
|
test('a build without the keychain probe names no group (its one group is its default)', async () => {
|
|
228
295
|
const secureStore = makeSecureStoreMock();
|
|
229
296
|
const store = loadStore('ios', { secureStore });
|
|
@@ -43,6 +43,7 @@ import type { SecureStoreOptions } from 'expo-secure-store';
|
|
|
43
43
|
import {
|
|
44
44
|
keychainAccessGroupValue,
|
|
45
45
|
normalizeSharedDeviceSessionRead,
|
|
46
|
+
readSharedWithoutInteraction,
|
|
46
47
|
resolveKeychainAccess,
|
|
47
48
|
type SharedDeviceCredential,
|
|
48
49
|
type SharedDeviceCredentialRead,
|
|
@@ -167,6 +168,29 @@ async function sharedGroupOptions(): Promise<SecureStoreOptions> {
|
|
|
167
168
|
};
|
|
168
169
|
}
|
|
169
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Read the credential item WITHOUT user interaction (security review R6-16).
|
|
173
|
+
* Every Oxy app can write the shared group, so any of them can plant an
|
|
174
|
+
* `oxy_device_session:auth` copy (an item stored with `requireAuthentication`);
|
|
175
|
+
* expo-secure-store's own read tries that copy and would show a Face ID prompt
|
|
176
|
+
* in every Oxy app at cold boot. `readSharedWithoutInteraction` reads only the
|
|
177
|
+
* `:no-auth` and legacy copies, with interaction refused; a native module that
|
|
178
|
+
* predates it reads through expo-secure-store as before. A locked keychain
|
|
179
|
+
* still THROWS (services' native read since 14.14.0), which is `unavailable`.
|
|
180
|
+
*/
|
|
181
|
+
async function readSharedItem(
|
|
182
|
+
store: KeychainGroupStore,
|
|
183
|
+
options: SecureStoreOptions,
|
|
184
|
+
): Promise<string | null> {
|
|
185
|
+
const { accessGroup, ...rest } = options;
|
|
186
|
+
return readSharedWithoutInteraction(
|
|
187
|
+
store,
|
|
188
|
+
SHARED_DEVICE_SESSION_STORAGE_KEY,
|
|
189
|
+
rest,
|
|
190
|
+
accessGroup ? { accessGroup } : {},
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
170
194
|
function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
|
|
171
195
|
return {
|
|
172
196
|
read: async (): Promise<SharedDeviceCredentialRead> => {
|
|
@@ -176,10 +200,7 @@ function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
|
|
|
176
200
|
}
|
|
177
201
|
let raw: string | null;
|
|
178
202
|
try {
|
|
179
|
-
raw = await store
|
|
180
|
-
SHARED_DEVICE_SESSION_STORAGE_KEY,
|
|
181
|
-
await sharedGroupOptions(),
|
|
182
|
-
);
|
|
203
|
+
raw = await readSharedItem(store, await sharedGroupOptions());
|
|
183
204
|
} catch (error) {
|
|
184
205
|
return { state: 'unavailable', cause: error };
|
|
185
206
|
}
|
|
@@ -214,7 +235,7 @@ function createKeychainGroupCredentialStore(): SharedDeviceCredentialStore {
|
|
|
214
235
|
// landed under the access group (a missing entitlement is the usual
|
|
215
236
|
// cause), and a phantom credential would send a fresh install into a mint
|
|
216
237
|
// that can never succeed.
|
|
217
|
-
return (await store
|
|
238
|
+
return (await readSharedItem(store, readOptions)) === value;
|
|
218
239
|
} catch {
|
|
219
240
|
return false;
|
|
220
241
|
}
|