-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
114 lines (77 loc) · 1.95 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Test Signer Service
Overview
The Test Signer Service is a RESTful API designed to sign user-submitted answers to a set of questions with a unique signature and verify these signatures at a later time. This service ensures that users' test submissions are authenticated and can be reliably verified, with submissions persistently stored and retrievable across sessions.
Getting Started
Prerequisites
Go installed on your machine (version 1.15 or later recommended).
Installation
Clone this repository to your local machine:
bash
git clone <repository-url>
Navigate to the project directory:
bash
cd test-signer
Run the service:
bash
go run main.go
The service will start running on http://localhost:8080.
API Endpoints
Sign Answers
URL: /sign
Method: POST
Description: Accepts a JSON payload containing a user JWT, questions, and their answers. Returns a unique signature for the submission.
Request Body:
json
{
"jwt": "UserJWT",
"questions": [
{
"id": "q1",
"question": "What is 2+2?",
"answer": "4"
},
{
"id": "q2",
"question": "What is the capital of France?",
"answer": "Paris"
}
]
}
Response:
Success:
json
{
"testSignature": "GeneratedSignature"
}
Error:
json
{
"error": "ErrorDescription"
}
Verify Signature
URL: /verify
Method: POST
Description: Accepts a JSON payload with a user identifier and a signature to verify the authenticity of a previously signed test submission.
Request Body:
json
{
"user": "UsernameOrUserID",
"testSignature": "SignatureToVerify"
}
Response:
Success:
json
{
"status": "OK",
"timestamp": "SignatureTimestamp",
"answers": [
// The answers associated with the signature
]
}
Error:
json
{
"error": "ErrorDescription"
}
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.