From 622bd72e6f2d3bd848963fc486fef1b39760e2ac Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 15 Nov 2023 02:22:37 +0700 Subject: all: implement HTTP API to decrypt file Similar to the CLI, the HTTP API accept the path of vault file and return the path to decrypted file. --- testdata/http_server/decrypt_test.data | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 testdata/http_server/decrypt_test.data (limited to 'testdata/http_server/decrypt_test.data') diff --git a/testdata/http_server/decrypt_test.data b/testdata/http_server/decrypt_test.data new file mode 100644 index 0000000..fce0b18 --- /dev/null +++ b/testdata/http_server/decrypt_test.data @@ -0,0 +1,40 @@ +Testing HTTP API for Decrypt. + +>>> withValidRequest/body +{"path_vault":"/plain.txt.vault"} + +<<< withValidRequest/Response/body +{ + "data": { + "path": "/plain.txt", + "path_vault": "/plain.txt.vault" + }, + "code": 200 +} + +>>> withEmptyValue/body +{"path_vault":""} + +<<< withEmptyValue/Response/body +{ + "message": "Decrypt: empty path_vault", + "code": 400 +} + +>>> withDirectory/body +{"path_vault":"/.ssh"} + +<<< withDirectory/Response/body +{ + "message": "Decrypt: \"/.ssh\" is a directory", + "code": 400 +} + +>>> withFileNotExist/body +{"path_vault":"/thisisnotexist"} + +<<< withFileNotExist/Response/body +{ + "message": "Decrypt \"/thisisnotexist\": file does not exist", + "code": 400 +} -- cgit v1.3