@@ -604,6 +604,7 @@ protocol AppSettingsStore: AnyObject {
604604 ///
605605 func twoFactorToken( email: String ) -> String ?
606606
607+
607608 /// Gets the username generation options for a user ID.
608609 ///
609610 /// - Parameter userId: The user ID associated with the username generation options.
@@ -639,6 +640,12 @@ protocol AppSettingsStore: AnyObject {
639640 /// - Returns: The userId `String` of the active account
640641 ///
641642 func activeAccountIdPublisher( ) -> AnyPublisher < String ? , Never >
643+
644+ /// A publisher for whether an unlock passkey is enabled.
645+ ///
646+ /// - Returns: The userId `String` of the active account
647+ func unlockPasskeyPublisher( ) -> AnyPublisher < [ String : Bool ] , Never >
648+
642649}
643650
644651// MARK: - DefaultAppSettingsStore
@@ -653,6 +660,9 @@ class DefaultAppSettingsStore {
653660
654661 /// A subject containing a `String?` for the userId of the active account.
655662 lazy var activeAccountIdSubject = CurrentValueSubject < String ? , Never > ( state? . activeUserId)
663+
664+ /// A subject containing a userId and flag for the presence of the unlock passkey for logged in accounts.
665+ let unlockPasskeySubject = CurrentValueSubject < [ String : Bool ] , Never > ( [ : ] )
656666
657667 /// The bundleId used to set values that are bundleId dependent.
658668 var bundleId : String {
@@ -1279,6 +1289,9 @@ extension DefaultAppSettingsStore: AppSettingsStore, ConfigSettingsStore {
12791289
12801290 func setUnlockOtherDevices( _ unlockOtherDevices: Bool , userId: String ) {
12811291 store ( unlockOtherDevices, for: . unlockOtherDevices( userId: userId) )
1292+ var curVal = unlockPasskeySubject. value
1293+ curVal [ userId] = unlockOtherDevices
1294+ unlockPasskeySubject. send ( curVal)
12821295 }
12831296
12841297 func setTimeoutAction( key: SessionTimeoutAction , userId: String ) {
@@ -1305,6 +1318,10 @@ extension DefaultAppSettingsStore: AppSettingsStore, ConfigSettingsStore {
13051318 store ( siriAndShortcutsAccess, for: . siriAndShortcutsAccess( userId: userId) )
13061319 }
13071320
1321+ func shouldTrustDevice( userId: String ) -> Bool ? {
1322+ fetch ( for: . shouldTrustDevice( userId: userId) )
1323+ }
1324+
13081325 func siriAndShortcutsAccess( userId: String ) -> Bool {
13091326 fetch ( for: . siriAndShortcutsAccess( userId: userId) )
13101327 }
@@ -1345,11 +1362,13 @@ extension DefaultAppSettingsStore: AppSettingsStore, ConfigSettingsStore {
13451362 store ( attempts, for: . unsuccessfulUnlockAttempts( userId: userId) )
13461363 }
13471364
1365+ // MARK: Publishers
1366+
13481367 func activeAccountIdPublisher( ) -> AnyPublisher < String ? , Never > {
13491368 activeAccountIdSubject. eraseToAnyPublisher ( )
13501369 }
1351-
1352- func shouldTrustDevice ( userId : String ) -> Bool ? {
1353- fetch ( for : . shouldTrustDevice ( userId : userId ) )
1370+
1371+ func unlockPasskeyPublisher ( ) -> AnyPublisher < [ String : Bool ] , Never > {
1372+ unlockPasskeySubject . eraseToAnyPublisher ( )
13541373 }
13551374}
0 commit comments