diff --git a/swift-secure-enclave-tool.swift b/swift-secure-enclave-tool.swift index 0eeafe3..80f37d9 100644 --- a/swift-secure-enclave-tool.swift +++ b/swift-secure-enclave-tool.swift @@ -149,21 +149,21 @@ if (CommandLine.arguments.count == 1) { exitWith("err:require one argument") } -let action = CommandLine.arguments[1]; +let command = CommandLine.arguments[1]; -if (action == "is_support_secure_enclave") { +if (command == "is_support_secure_enclave") { exitWith("ok:\(isSupportSecureEnclave())") } -if (action == "generate_secure_enclave_p256_ecsign_keypair") { +if (command == "generate_secure_enclave_p256_ecsign_keypair") { exitWith(generateSecureEnclaveP256KeyPair(sign: true)) } -if (action == "generate_secure_enclave_p256_ecdh_keypair") { +if (command == "generate_secure_enclave_p256_ecdh_keypair") { exitWith(generateSecureEnclaveP256KeyPair(sign: false)) } -if (action == "recover_secure_enclave_p256_ecsign_public_key") { +if (command == "recover_secure_enclave_p256_ecsign_public_key") { if (CommandLine.arguments.count != 3) { exitWith("err:require two arguments") } @@ -172,7 +172,7 @@ if (action == "recover_secure_enclave_p256_ecsign_public_key") { exitWith(response) } -if (action == "recover_secure_enclave_p256_ecdh_public_key") { +if (command == "recover_secure_enclave_p256_ecdh_public_key") { if (CommandLine.arguments.count != 3) { exitWith("err:require two arguments") } @@ -181,7 +181,7 @@ if (action == "recover_secure_enclave_p256_ecdh_public_key") { exitWith(response) } -if (action == "compute_secure_enclave_p256_ecsign") { +if (command == "compute_secure_enclave_p256_ecsign") { if (CommandLine.arguments.count != 4) { exitWith("err:require three arguments") } @@ -192,7 +192,7 @@ if (action == "compute_secure_enclave_p256_ecsign") { exitWith(response) } -if (action == "compute_secure_enclave_p256_ecdh") { +if (command == "compute_secure_enclave_p256_ecdh") { if (CommandLine.arguments.count != 4) { exitWith("err:require three arguments") } @@ -203,8 +203,8 @@ if (action == "compute_secure_enclave_p256_ecdh") { exitWith(response) } -if (action == "version") { +if (command == "version") { exitWith("ok:1.0.0-20250118") } -exitWith("err:invalid action") +exitWith("err:invalid command")