mirror of
				https://github.com/maxgoedjen/secretive.git
				synced 2025-10-31 15:30:57 +00:00 
			
		
		
		
	Remove pending.
This commit is contained in:
		
							parent
							
								
									80a2bd42a3
								
							
						
					
					
						commit
						971f831a2f
					
				| @ -17,7 +17,6 @@ extension SecureEnclave { | ||||
|         public let name = NSLocalizedString("Secure Enclave", comment: "Secure Enclave") | ||||
|         @Published public private(set) var secrets: [Secret] = [] | ||||
| 
 | ||||
|         private var pendingAuthenticationContext: PersistentAuthenticationContext? = nil | ||||
|         private var persistedAuthenticationContexts: [Secret: PersistentAuthenticationContext] = [:] | ||||
| 
 | ||||
|         public init() { | ||||
| @ -103,7 +102,6 @@ extension SecureEnclave { | ||||
|             } else { | ||||
|                 let newContext = LAContext() | ||||
|                 newContext.localizedCancelTitle = "Deny" | ||||
|                 pendingAuthenticationContext = PersistentAuthenticationContext(secret: secret, context: newContext, expiration: Date(timeIntervalSinceNow: Constants.authenticationPersistenceOptInWindow)) | ||||
|                 context = newContext | ||||
|             } | ||||
|             context.localizedReason = "sign a request from \"\(provenance.origin.displayName)\" using secret \"\(secret.name)\"" | ||||
| @ -144,17 +142,11 @@ extension SecureEnclave { | ||||
|             let newContext = LAContext() | ||||
|             newContext.localizedCancelTitle = "Deny" | ||||
|             newContext.localizedReason = "sign requests without reprompting" | ||||
|             newContext.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometricsOrWatch, localizedReason: newContext.localizedReason) { x, y in | ||||
|                 print(x, y) | ||||
|             newContext.evaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometricsOrWatch, localizedReason: newContext.localizedReason) { [weak self] success, _ in | ||||
|                 let context = PersistentAuthenticationContext(secret: secret, context: newContext, expiration: Date(timeIntervalSinceNow: duration)) | ||||
|                 self?.persistedAuthenticationContexts[secret] = context | ||||
|             } | ||||
| 
 | ||||
|             guard let pending = pendingAuthenticationContext, | ||||
|                   secret == pending.secret, | ||||
|                   pending.valid | ||||
|             else { throw AuthenticationPersistenceExpiredError() } | ||||
|             let rewrapped = PersistentAuthenticationContext(secret: secret, context: newContext, expiration: Date(timeIntervalSinceNow: duration)) | ||||
|             persistedAuthenticationContexts[secret] = rewrapped | ||||
|             pendingAuthenticationContext = nil | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| @ -224,8 +216,6 @@ extension SecureEnclave { | ||||
|         public let error: SecurityError? | ||||
|     } | ||||
| 
 | ||||
|     public struct AuthenticationPersistenceExpiredError: Error {} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| extension SecureEnclave { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user