diff --git a/swift-secure-enclave-tool.swift b/swift-secure-enclave-tool.swift index 612a640..55a33b7 100644 --- a/swift-secure-enclave-tool.swift +++ b/swift-secure-enclave-tool.swift @@ -134,7 +134,7 @@ func computeSecureEnclaveP256Ecdh(privateKeyDataRepresentation: String, ephemera } } -func exitWith(response: String) { +func exitWith(_ response: String) { print(response); if (response.hasPrefix("ok:")) { exit(0) @@ -145,66 +145,65 @@ func exitWith(response: String) { if (CommandLine.arguments.count == 1) { - exitWith(response: "err:require one argument") + exitWith("err:require one argument") } let action = CommandLine.arguments[1]; if (action == "is_support_secure_enclave") { - exitWith(response: "ok:\(isSupportSecureEnclave())") + exitWith("ok:\(isSupportSecureEnclave())") } if (action == "generate_secure_enclave_p256_ecsign_keypair") { - exitWith(response: generateSecureEnclaveP256KeyPair(sign: true)) + exitWith(generateSecureEnclaveP256KeyPair(sign: true)) } if (action == "generate_secure_enclave_p256_ecdh_keypair") { - exitWith(response: generateSecureEnclaveP256KeyPair(sign: false)) + exitWith(generateSecureEnclaveP256KeyPair(sign: false)) } if (action == "recover_secure_enclave_p256_ecsign_public_key") { if (CommandLine.arguments.count != 3) { - exitWith(response: "err:require two arguments") + exitWith("err:require two arguments") } let response = recoverSecureEnclaveP256PublicKey( privateKeyDataRepresentation: CommandLine.arguments[2], sign: true); - exitWith(response: response) + exitWith(response) } if (action == "recover_secure_enclave_p256_ecdh_public_key") { if (CommandLine.arguments.count != 3) { - exitWith(response: "err:require two arguments") + exitWith("err:require two arguments") } let response = recoverSecureEnclaveP256PublicKey( privateKeyDataRepresentation: CommandLine.arguments[2], sign: false); - exitWith(response: response) + exitWith(response) } if (action == "compute_secure_enclave_p256_ecsign") { if (CommandLine.arguments.count != 4) { - exitWith(response: "err:require three arguments") + exitWith("err:require three arguments") } let response = computeSecureEnclaveP256Ecsign( privateKeyDataRepresentation: CommandLine.arguments[2], content: CommandLine.arguments[3] ); - exitWith(response: response) + exitWith(response) } if (action == "compute_secure_enclave_p256_ecdh") { if (CommandLine.arguments.count != 4) { - exitWith(response: "err:require three arguments") + exitWith("err:require three arguments") } let response = computeSecureEnclaveP256Ecdh( privateKeyDataRepresentation: CommandLine.arguments[2], ephemeraPublicKey: CommandLine.arguments[3] ); - exitWith(response: response) + exitWith(response) } if (action == "version") { - exitWith(response: "ok:1.0.0-20250118") + exitWith("ok:1.0.0-20250118") } -print("err:unknown action") -exit(1) \ No newline at end of file +exitWith("err:unknown action")