mirror of
				https://github.com/maxgoedjen/secretive.git
				synced 2025-10-30 23:10:57 +00:00 
			
		
		
		
	Fix tests
This commit is contained in:
		
							parent
							
								
									dafec7b624
								
							
						
					
					
						commit
						e4695ac3c6
					
				| @ -48,7 +48,7 @@ extension Stub { | |||||||
|             print("Public Key OpenSSH: \(OpenSSHKeyWriter().openSSHString(secret: secret))") |             print("Public Key OpenSSH: \(OpenSSHKeyWriter().openSSHString(secret: secret))") | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public func sign(data: Data, with secret: Secret, for provenance: SigningRequestProvenance) throws -> Data { |         public func sign(data: Data, with secret: Secret, for provenance: SigningRequestProvenance) throws -> SignedData { | ||||||
|             guard !shouldThrow else { |             guard !shouldThrow else { | ||||||
|                 throw NSError(domain: "test", code: 0, userInfo: nil) |                 throw NSError(domain: "test", code: 0, userInfo: nil) | ||||||
|             } |             } | ||||||
| @ -67,7 +67,10 @@ extension Stub { | |||||||
|             default: |             default: | ||||||
|                 fatalError() |                 fatalError() | ||||||
|             } |             } | ||||||
|             return SecKeyCreateSignature(privateKey, signatureAlgorithm, data as CFData, nil)! as Data |             return SignedData(data: SecKeyCreateSignature(privateKey, signatureAlgorithm, data as CFData, nil)! as Data, requiredAuthentication: false) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         public func persistAuthentication(secret: Stub.Secret, forDuration duration: TimeInterval) throws { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -10,14 +10,14 @@ struct StubWitness { | |||||||
| 
 | 
 | ||||||
| extension StubWitness: SigningWitness { | extension StubWitness: SigningWitness { | ||||||
| 
 | 
 | ||||||
|     func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws { | func speakNowOrForeverHoldYourPeace(forAccessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance) throws { | ||||||
|         let objection = speakNow(secret, provenance) |         let objection = speakNow(secret, provenance) | ||||||
|         if objection { |         if objection { | ||||||
|             throw TheresMyChance() |             throw TheresMyChance() | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     func witness(accessTo secret: AnySecret, by provenance: SigningRequestProvenance) throws { | func witness(accessTo secret: AnySecret, from store: AnySecretStore, by provenance: SigningRequestProvenance, requiredAuthentication: Bool) throws { | ||||||
|         witness(secret, provenance) |         witness(secret, provenance) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,6 +1,13 @@ | |||||||
| import Foundation | import Foundation | ||||||
| 
 | 
 | ||||||
| public struct SignedData { | public struct SignedData { | ||||||
|  | 
 | ||||||
|     public let data: Data |     public let data: Data | ||||||
|     public let requiredAuthentication: Bool |     public let requiredAuthentication: Bool | ||||||
|  | 
 | ||||||
|  |     public init(data: Data, requiredAuthentication: Bool) { | ||||||
|  |         self.data = data | ||||||
|  |         self.requiredAuthentication = requiredAuthentication | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -35,8 +35,11 @@ extension Preview { | |||||||
|             self.secrets.append(contentsOf: new) |             self.secrets.append(contentsOf: new) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         func sign(data: Data, with secret: Preview.Secret, for provenance: SigningRequestProvenance) throws -> Data { |         func sign(data: Data, with secret: Preview.Secret, for provenance: SigningRequestProvenance) throws -> SignedData { | ||||||
|             return data |             return SignedData(data: data, requiredAuthentication: false) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         func persistAuthentication(secret: Preview.Secret, forDuration duration: TimeInterval) throws { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user