 		
 		// Throw an error if an unexpected status was returned.
 		guard status == noErr || status == errSecItemNotFound else {
-			throw KeychainError.deleteFailure(status: status)
+			throw Keychain.Error.deleteFailure(status: status)
 		}
 	}
 	

			
			// Throw an error if an unexpected status was returned.
			guard status == noErr else {
				throw KeychainError.writeFailure(status: status)
			}
		}
		catch KeychainError.itemNotFound {

/// Simple wrapper around keychain for secure storage.
/// Adapted from https://developer.apple.com/library/content/samplecode/GenericKeychain/Listings/GenericKeychain_KeychainPasswordItem_swift.html

public final class Keychain {
	

    enum Error: Swift.Error {
	    case readFailure(status: OSStatus)
	    case writeFailure(status: OSStatus)
	    case deleteFailure(status: OSStatus)
	    case itemNotFound(service: String, account: String)
	    case itemHasNoData(service: String, account: String)
    }

	public static func write(data: Data, service: String, account: String) throws {
		
		do {
			// Check for an existing item in the keychain.
