-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: tags in subscriptions * chore: tabs instead of spaces * chore: use nostr.Filter with easyjson * chore: update README * chore: add response to webhook url in readme * chore: minor fix
- Loading branch information
1 parent
6b0ab5b
commit 57fb1fa
Showing
2 changed files
with
128 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ Endpoints: --> | |
|
||
### Fetch NIP-47 Info | ||
|
||
Returns a Pubkey's NIP-47 capabilities (if any). | ||
Every NWC-enabled wallet has a pubkey according to the NWC specification. | ||
This `GET` request returns a pubkey's NWC capabilities (if any) | ||
|
||
<details> | ||
<summary> | ||
|
@@ -23,24 +24,24 @@ Returns a Pubkey's NIP-47 capabilities (if any). | |
|
||
#### Request Body | ||
|
||
> | name | type | data type | description | | ||
> |-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
> | relayUrl | optional | string | If no relay is provided, it uses the default relay (wss://relay.getalby.com/v1) | | ||
> | walletPubkey | required | string | Pubkey of the NIP-47 Wallet Provider | | ||
| name | type | data type | description | | ||
|-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
| relayUrl | optional | string | If no relay is provided, it uses the default relay (wss://relay.getalby.com/v1) | | ||
| walletPubkey | required | string | Pubkey of the NWC Wallet Provider | | ||
|
||
#### Response | ||
|
||
> ```json | ||
> { | ||
> "id": "a16ye1391c22xx........xxxxx", | ||
> "pubkey": "a16y69effexxxx........xxxxx", | ||
> "created_at": 1708336682, | ||
> "kind": 13194, | ||
> "tags": [], | ||
> "content": "pay_invoice,pay_keysend,get_balance,get_info,make_invoice,lookup_invoice,list_transactions", | ||
> "sig": <signature> | ||
> } | ||
>``` | ||
```json | ||
{ | ||
"id": "a16ye1391c22xx........xxxxx", | ||
"pubkey": "a16y69effexxxx........xxxxx", | ||
"created_at": 1708336682, | ||
"kind": 13194, | ||
"tags": [], | ||
"content": "pay_invoice, pay_keysend, get_balance, get_info, make_invoice, lookup_invoice, list_transactions", | ||
"sig": <signature> | ||
} | ||
``` | ||
</details> | ||
|
||
------------------------------------------------------------------------------------------ | ||
|
@@ -56,40 +57,59 @@ Returns the response event directly or to the Webhook URL if provided. | |
|
||
#### Request Body | ||
|
||
> | name | type | data type | description | | ||
> |-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
> | relayUrl | optional | string | If no relay is provided, it uses the default relay (wss://relay.getalby.com/v1) | | ||
> | webhookUrl | optional | string | Webhook URL to publish the response event, returns the event directly if not provided | | ||
> | walletPubkey | required | string | Pubkey of the NIP-47 Wallet Provider | | ||
> | event | required | JSON object ([nostr.Event](https://pkg.go.dev/github.com/nbd-wtf/[email protected]#Event)) | **Signed** request event | | ||
| name | type | data type | description | | ||
|-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
| relayUrl | optional | string | If no relay is provided, it uses the default relay (wss://relay.getalby.com/v1) | | ||
| webhookUrl | optional | string | Webhook URL to publish the response event, returns the event directly if not provided | | ||
| walletPubkey | required | string | Pubkey of the NWC Wallet Provider | | ||
| event | required | JSON object (see [example](#event-example)) | **Signed** request event | | ||
|
||
|
||
#### Event Example | ||
|
||
```json | ||
{ | ||
"id":"a16ycf4a01bcxx........xxxxx", | ||
"pubkey":"a16y69effexxxx........xxxxx", | ||
"created_at":1700000021, | ||
"kind":23194, | ||
"tags":[ | ||
["p","a16y6sfa01bcxx........xxxxx"] | ||
], | ||
"content": "<encrypted content>", | ||
"sig":"<signature>" | ||
} | ||
// Source: https://pkg.go.dev/github.com/nbd-wtf/[email protected]#Event | ||
``` | ||
|
||
#### Response (with webhook) | ||
|
||
> "webhook received" | ||
```json | ||
"webhook received" | ||
``` | ||
|
||
#### Response (without webhook) | ||
|
||
> ```json | ||
> { | ||
> "id": "a16ycf4a01bcxx........xxxxx", | ||
> "pubkey": "a16y69effexxxx........xxxxx", | ||
> "created_at": 1709033612, | ||
> "kind": 23195, | ||
> "tags": [ | ||
> [ | ||
> "p", | ||
> "f490f5xxxxx........xxxxx" | ||
> ], | ||
> [ | ||
> "e", | ||
> "a41aefxxxxx........xxxxx" | ||
> ] | ||
> ], | ||
> "content": <encrypted content>, | ||
> "sig": <signature> | ||
> } | ||
>``` | ||
```json | ||
{ | ||
"id": "a16ycf4a01bcxx........xxxxx", | ||
"pubkey": "a16y69effexxxx........xxxxx", | ||
"created_at": 1709033612, | ||
"kind": 23195, | ||
"tags": [ | ||
[ | ||
"p", | ||
"f490f5xxxxx........xxxxx" | ||
], | ||
[ | ||
"e", | ||
"a41aefxxxxx........xxxxx" | ||
] | ||
], | ||
"content": <encrypted content>, | ||
"sig": <signature> | ||
} | ||
``` | ||
</details> | ||
|
||
------------------------------------------------------------------------------------------ | ||
|
@@ -105,21 +125,63 @@ Notifies about new events matching the filter provided via webhooks. | |
|
||
#### Request Body | ||
|
||
> | name | type | data type | description | | ||
> |-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
> | relayUrl | optional | string | If no relay is provided, it uses the default relay | | ||
> | webhookUrl | required | string | Webhook URL to publish events | | ||
> | filter | required | JSON object ([nostr.Filter](https://pkg.go.dev/github.com/nbd-wtf/[email protected]#Filter)) | Filters to subscribe to | | ||
| name | type | data type | description | | ||
|-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
| relayUrl | optional | string | If no relay is provided, it uses the default relay | | ||
| webhookUrl | required | string | Webhook URL to publish events | | ||
| filter | required | JSON object (see [example](#filter-example)) | Filters to subscribe to | | ||
|
||
|
||
#### Filter Example | ||
|
||
```json | ||
{ | ||
"ids": ["id1", "id2"], | ||
"kinds": [1,2], | ||
"authors": ["author1", "author2"], | ||
"since": 1721212121, | ||
"until": 1721212121, | ||
"limit": 10, | ||
"search": "example search", | ||
"#tag1": ["value1", "value2"], | ||
"#tag2": ["value3"], | ||
"#tag3": ["value4", "value5", "value6"], | ||
} | ||
// Source: https://pkg.go.dev/github.com/nbd-wtf/[email protected]#Filter | ||
``` | ||
|
||
#### Response | ||
|
||
> ```json | ||
> { | ||
> "subscription_id": "f370d1fc-x0x0-x0x0-x0x0-8f68fa12f32c", | ||
> "webhookUrl": "https://your.webhook.url" | ||
> } | ||
>``` | ||
```json | ||
{ | ||
"subscription_id": "f370d1fc-x0x0-x0x0-x0x0-8f68fa12f32c", | ||
"webhookUrl": "https://your.webhook.url" | ||
} | ||
``` | ||
|
||
#### Response to Webhook URL | ||
|
||
```json | ||
{ | ||
"id": "a16ycf4a01bcxx........xxxxx", | ||
"pubkey": "a16y69effexxxx........xxxxx", | ||
"created_at": 1709033612, | ||
"kind": 23195, | ||
"tags": [ | ||
[ | ||
"p", | ||
"f490f5xxxxx........xxxxx" | ||
], | ||
[ | ||
"e", | ||
"a41aefxxxxx........xxxxx" | ||
] | ||
], | ||
"content": <encrypted content>, | ||
"sig": <signature> | ||
} | ||
``` | ||
|
||
</details> | ||
|
||
------------------------------------------------------------------------------------------ | ||
|
@@ -135,16 +197,16 @@ Delete previously requested subscriptions. | |
|
||
#### Parameter | ||
|
||
> | name | type | data type | description | | ||
> |-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
> | id | required | string | UUID received on subscribing to a relay | | ||
| name | type | data type | description | | ||
|-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
| id | required | string | UUID received on subscribing to a relay | | ||
|
||
|
||
#### Response | ||
|
||
> ```json | ||
> "subscription x stopped" | ||
>``` | ||
```json | ||
"subscription x stopped" | ||
``` | ||
</details> | ||
|
||
------------------------------------------------------------------------------------------ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters