https://github.com/prongbang/cram-api
https://github.com/prongbang/cram-api
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/prongbang/cram-api
- Owner: prongbang
- Created: 2022-12-29T11:52:19.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-29T13:47:31.000Z (almost 3 years ago)
- Last Synced: 2025-03-25T22:52:06.590Z (7 months ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cram-api
Challenge Response Authentication Mechanism (CRAM) Example, Using Elliptic Curve Digital Signature Algorithm.
## [1] Registration
```shell
curl --location --request POST 'http://localhost:3000/v1/challenge/registration' \
--data-raw '{
"userId": "1",
"pk": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Pp8aJj3w61AW78eKxd+wiHYERzJti4I2dngMVVMcZ759TLxLETJPlku5MFkNlGJNLu4GT1bt8lEvxi5h3A8nA=="
}'
```Response
```json
{
"code": 200,
"message": "OK"
}
```## [2] Request
```shell
curl --location --request POST 'http://localhost:3000/v1/challenge/request' \
--data-raw '{
"userId": "1"
}'
```Response
```json
{
"code": 200,
"data": {
"challenge": "577cb5f5-34d2-43ea-8a41-c67cdbf80a4a"
},
"message": "OK"
}
```## [3] Verify
```shell
curl --location --request POST 'http://localhost:3000/v1/challenge/verify' \
--data-raw '{
"userId": "1",
"challenge": "577cb5f5-34d2-43ea-8a41-c67cdbf80a4a",
"signature": "MEQCIH6X8KrktBuTaV3StA0TYe4OuGoqoP4EM4hleuHVUlCQAiBHso4R8EUTIUIWfVgI4qpW1qn7Zkz9h0CmyJypgBRyBA==",
"nonce": "f8a01ad7-abbb-43d6-bc86-d811214e7cf9"
}'
```Response
```json
{
"code": 200,
"data": {
"token": "5a2d29b9-346c-40db-aa7a-7422dc7e57ab"
},
"message": "OK"
}
```