Skip to content

Commit

Permalink
Documentation: npub to hex (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
grunch authored Dec 19, 2023
1 parent 4fc357b commit ffa23ed
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 21 deletions.
2 changes: 1 addition & 1 deletion book/src/cancel.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A user can cancel an Order created by himself and with status `Pending` sending
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78",
"action": "Cancel",
"content": null
}
Expand Down
2 changes: 1 addition & 1 deletion book/src/dispute.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A use can start a dispute in an order with status `Pending` or `FiatSent` sendin
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78",
"action": "Dispute",
"content": null
}
Expand Down
26 changes: 21 additions & 5 deletions book/src/fiatsent.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,29 @@ After the buyer sends the fiat money to the seller, the buyer should send a mess
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": null,
"pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427",
"action": "FiatSent",
"content": null
}
}
```

The event to send to Mostro would look like this:

```json
{
"id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d",
"kind": 4,
"pubkey": "9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b",
"content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string",
"tags": [
["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"]
],
"created_at": 1234567890,
"sig": "a21eb195fe418613aa9a3a8a78039b090e50dc3f9fb06b0f3fe41c63221adc073a9317a1f28d9db843a43c28d860ba173b70132ca85b0e706f6487d43a57ee82"
}
```

## Mostro response

Mostro send a messages to both parties confirming `FiatSent` action and sending again the counterpart pubkey, here an example of the message to the buyer:
Expand All @@ -23,11 +39,11 @@ Mostro send a messages to both parties confirming `FiatSent` action and sending
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj",
"pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427",
"action": "FiatSent",
"content": {
"Peer": {
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2"
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78"
}
}
}
Expand All @@ -41,11 +57,11 @@ And here an example of the message from Mostro to the seller:
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78",
"action": "FiatSent",
"content": {
"Peer": {
"pubkey": "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj"
"pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427"
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions book/src/new_order.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ To create a new sell order the user should send a Nostr event kind 4 (an encrypt
{
"Order": {
"version": "1",
"pubkey": "npub1qqq...",
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78", // Seller's real pubkey
"action": "NewOrder",
"content": {
"Order": {
Expand Down Expand Up @@ -38,7 +38,7 @@ The event to send to Mostro would look like this:
{
"id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d",
"kind": 4,
"pubkey": "1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d",
"pubkey": "1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d", // Seller's ephemeral pubkey
"content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string",
"tags": [
["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] // Mostro's pubkey
Expand All @@ -57,8 +57,7 @@ Mostro will send back a nip04 event as a confirmation message to the user like t
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqq...",
"action": "NewOrder",
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78",
"content": {
"Order": {
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
Expand Down
12 changes: 11 additions & 1 deletion book/src/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@ These fields are relative to the wrapper, here an example of a `FiatSent` Order
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqq...",
"pubkey": "0001be6bd50247846a28cce439a10470a39b1b6c81d5c3be2475156a413e1e3a",
"action": "FiatSent",
"content": null
}
}
```

## Keys

For all examples the participants will use this keys:

- Mostro's pubkey `dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a`
- Seller's real pubkey `00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78`
- Seller's ephemeral pubkey `1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d`
- Buyer's real pubkey `0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427`
- Buyer's ephemeral pubkey `9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b`
2 changes: 1 addition & 1 deletion book/src/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ After confirming the buyer sent the fiat money, the seller should send a message
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78",
"action": "Release",
"content": null
}
Expand Down
18 changes: 17 additions & 1 deletion book/src/take_buy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,30 @@ To take an order the seller will send to Mostro a message with the following con
{
"Order": {
"version": "1",
"pubkey": "npub1qqqxssz4k6swex94zdg5s4pqx3uqlhwsc2vdzvhjvzk33pcypkhqe9aeq2",
"pubkey": "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"action": "TakeBuy",
"content": null
}
}
```

The event to send to Mostro would look like this:

```json
{
"id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d",
"kind": 4,
"pubkey": "1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d", // Seller's ephemeral pubkey
"content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string",
"tags": [
["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] // Mostro's pubkey
],
"created_at": 1234567890,
"sig": "a21eb195fe418613aa9a3a8a78039b090e50dc3f9fb06b0f3fe41c63221adc073a9317a1f28d9db843a43c28d860ba173b70132ca85b0e706f6487d43a57ee82"
}
```

## Mostro response

Mostro respond to the seller with a message with the following content:
Expand Down
8 changes: 3 additions & 5 deletions book/src/take_sell.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,23 @@ If the order amount is `0` the buyer don't know the exact amount to create the i
"Order": {
"version": "1",
"id": "ede61c96-4c13-4519-bf3a-dcf7f1e9d842",
"pubkey": "npub1qqq...",
"pubkey": "0000147e939bef2b81c27af4c1b702c90c3843f7212a34934bff1e049b7f1427",
"action": "TakeSell",
"content": null
}
}
```

This event would look like this:

The event to send to Mostro would look like this:

```json
{
"id": "cade205b849a872d74ba4d2a978135dbc05b4e5f483bb4403c42627dfd24f67d",
"kind": 4,
"pubkey": "1f5bb148a25bca31506594722e746b10acf2641a12725b12072dcbc46ade544d",
"pubkey": "9a42ac72d6466a6dbe5b4b07a8717ee13e55abb6bdd810ea9c321c9a32ee837b",
"content": "base64-encoded-aes-256-cbc-encrypted-JSON-serialized-string",
"tags": [
["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"] // Mostro's pubkey
["p", "dbe0b1be7aafd3cfba92d7463edbd4e33b2969f61bd554d37ac56f032e13355a"]
],
"created_at": 1234567890,
"sig": "a21eb195fe418613aa9a3a8a78039b090e50dc3f9fb06b0f3fe41c63221adc073a9317a1f28d9db843a43c28d860ba173b70132ca85b0e706f6487d43a57ee82"
Expand Down
4 changes: 2 additions & 2 deletions book/src/user_rating.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If Mostro received the correct message, it will send back a confirmation message
}
```

Mostro updates the nip 33 rating event, in this event the `d` tag will be the user pubkey `npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj` and looks like this:
Mostro updates the nip 33 rating event, in this event the `d` tag will be the user pubkey `00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78` and looks like this:

```json
[
Expand All @@ -58,7 +58,7 @@ Mostro updates the nip 33 rating event, in this event the `d` tag will be the us
"created_at": 1702637077,
"kind": 38383,
"tags": [
["d", "npub1qqqt938cer4dvlslg04zwwf66ts8r3txp6mv79cx2498pyuqx8uq0c7qkj"],
["d", "00000ba40c5795451705bb9c165b3af93c846894d3062a9cd7fcba090eb3bf78"],
["total_reviews", "1"],
["total_rating", "2"],
["last_rating", "1"],
Expand Down

0 comments on commit ffa23ed

Please sign in to comment.