feat: updates

This commit is contained in:
2025-01-18 17:20:27 +08:00
parent c0870fe9d1
commit d4d7e8c8bd

View File

@@ -149,21 +149,21 @@ if (CommandLine.arguments.count == 1) {
exitWith("err:require one argument") 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())") exitWith("ok:\(isSupportSecureEnclave())")
} }
if (action == "generate_secure_enclave_p256_ecsign_keypair") { if (command == "generate_secure_enclave_p256_ecsign_keypair") {
exitWith(generateSecureEnclaveP256KeyPair(sign: true)) exitWith(generateSecureEnclaveP256KeyPair(sign: true))
} }
if (action == "generate_secure_enclave_p256_ecdh_keypair") { if (command == "generate_secure_enclave_p256_ecdh_keypair") {
exitWith(generateSecureEnclaveP256KeyPair(sign: false)) 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) { if (CommandLine.arguments.count != 3) {
exitWith("err:require two arguments") exitWith("err:require two arguments")
} }
@@ -172,7 +172,7 @@ if (action == "recover_secure_enclave_p256_ecsign_public_key") {
exitWith(response) 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) { if (CommandLine.arguments.count != 3) {
exitWith("err:require two arguments") exitWith("err:require two arguments")
} }
@@ -181,7 +181,7 @@ if (action == "recover_secure_enclave_p256_ecdh_public_key") {
exitWith(response) exitWith(response)
} }
if (action == "compute_secure_enclave_p256_ecsign") { if (command == "compute_secure_enclave_p256_ecsign") {
if (CommandLine.arguments.count != 4) { if (CommandLine.arguments.count != 4) {
exitWith("err:require three arguments") exitWith("err:require three arguments")
} }
@@ -192,7 +192,7 @@ if (action == "compute_secure_enclave_p256_ecsign") {
exitWith(response) exitWith(response)
} }
if (action == "compute_secure_enclave_p256_ecdh") { if (command == "compute_secure_enclave_p256_ecdh") {
if (CommandLine.arguments.count != 4) { if (CommandLine.arguments.count != 4) {
exitWith("err:require three arguments") exitWith("err:require three arguments")
} }
@@ -203,8 +203,8 @@ if (action == "compute_secure_enclave_p256_ecdh") {
exitWith(response) exitWith(response)
} }
if (action == "version") { if (command == "version") {
exitWith("ok:1.0.0-20250118") exitWith("ok:1.0.0-20250118")
} }
exitWith("err:invalid action") exitWith("err:invalid command")