neveko/docs/curl.md

73 lines
1.6 KiB
Markdown
Raw Normal View History

2023-04-30 15:55:41 +00:00
# Remote access
NOTE: JWT for micro servers disabled in dev
## Login API
* send with dummy string on first request
* sign data in the response
* send second request with signature to get AUTHID and UID
```bash
2023-05-02 03:03:08 +00:00
curl -iv -x localhost:9043/login/<SIGNATURE>/<AUTHID>/<UID>
2023-04-30 15:55:41 +00:00
```
## generate invoice
```bash
2023-05-02 07:29:33 +00:00
curl -iv http://bob.b32.i2p/invoice
2023-04-30 15:55:41 +00:00
```
## get contact info
```bash
2023-05-02 07:29:33 +00:00
curl -iv http://bob.b32.i2p/share
2023-04-30 15:55:41 +00:00
```
## generate jwp
```bash
2023-05-02 07:29:33 +00:00
curl -iv -X POST http://bob.b32.i2p/prove -d '{"address": "", "confirmations":0,"hash":"", "message":"", "signature": ""}' -H 'Content-Type: application/json'
2023-04-30 15:55:41 +00:00
```
## health check
```bash
2023-05-02 07:29:33 +00:00
curl -iv http://bob.b32.i2p/xmr/version -H 'proof: eyJhbGciOiJIUzUxMiJ9...'
2023-04-30 15:55:41 +00:00
```
## add contact
```bash
2024-04-07 14:43:18 +00:00
curl -iv -X POST http://localhost:9044/contact -d '{"cid": "KEEP EMPTY", "npmk": "string", "i2p_address": "", "xmr_address": ""}' -H 'Content-Type: application/json'
2023-04-30 15:55:41 +00:00
```
## view contacts
```bash
curl -iv http://localhost:9044/contacts
```
## send message
```bash
2024-04-10 03:58:41 +00:00
curl -ivk http://localhost:9045/tx -d '{"uid":"123", "mid": "", "body": "string", "from": "alice.b32.i2p", "created": 0, "to": "bob.b32.i2p"}' -H 'Content-Type: application/json'
2023-04-30 15:55:41 +00:00
```
## receive message
```bash
2024-04-10 03:58:41 +00:00
curl -iv http://alice.b32.i2p/message/rx -d '{"uid":"", "mid": "", "body": "string", "from": "bob.b32.i2p", "created": 0, "to": "alice.b32.i2p"}' -H 'Content-Type: application/json' -H 'proof: eyJhbGciOiJIUzUxMiJ9...'
2023-04-30 15:55:41 +00:00
```
## view messages
```bash
2023-05-02 07:29:33 +00:00
curl -iv http://localhost:9045/messages
2023-04-30 15:55:41 +00:00
```
2023-05-02 07:29:33 +00:00
2024-04-07 14:43:18 +00:00
## decipher message
2023-05-02 07:29:33 +00:00
```bash
2024-04-07 14:43:18 +00:00
curl -iv http://localhost:9045/message/decipher/<MESSAGE_ID>
2023-05-02 07:29:33 +00:00
```