Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 175 additions & 0 deletions docs/specs/clients/notify/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,181 @@ Paginated list of notifications with the most recently sent first. Unread notifi
| Tag | 4015 |
| Topic | notify topic |

## `wc_notifyGetNotification`

Get one notification by ID. Useful for URL links where you need to retrieve a specific notification and display it without needing to go through `O(n)` round trips of pages to find the notification client-side.

### Request

- act - `notify_get_notification`
- iss - did:key of client identity key
- ksu - key server for identity key verification
- aud - did:key of dapp authentication key
- app - did:web of app domain that this request is associated with
- Example: `did:web:app.example.com`
- id - the notification ID to retrieve

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4016 |
| Topic | notify topic |

### Response

- act - `notify_get_notification_response`
- iss - did:key of client identity key
- aud - did:key of dapp authentication key
- nfn - [Notify Notification](./data-structures.md#notify-notification)

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4017 |
| Topic | notify topic |

## `wc_notifyNotificationChanged`

Emitted by the Notify Server when a notification changed state. For example if its read status changed.

### Request

- act - `notify_notification_changed`
- iss - did:key of dapp authentication key
- aud - did:key of client identity key
- nfn - array of [Notify Notification](./data-structures.md#notify-notification)

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4018 |
| Topic | notify topic |

### Response

- act - `notify_notification_changed_response`
- iss - did:key of client identity key
- ksu - key server for identity key verification
- aud - did:key of dapp authentication key

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4019 |
| Topic | notify topic |

## `wc_notifyReadNotification`

Marks a notification as read.

### Request

- act - `notify_read_notification`
- iss - did:key of client identity key
- ksu - key server for identity key verification
- aud - did:key of dapp authentication key
- app - did:web of app domain that this request is associated with
- Example: `did:web:app.example.com`
- ids - array of notification IDs to mark as read, max 1000 items

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4020 |
| Topic | notify topic |

### Response

- act - `notify_read_notification_response`
- iss - did:key of dapp authentication key
- aud - did:key of client identity key

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4021 |
| Topic | notify topic |

## `wc_notifyGetUnreadNotificationsCount`

Returns a count of how many notifications are unread. Useful to implement unread notification counters, without needing to go through `O(n)` round trips of pages to count the total client-side.

### Request

- act - `notify_get_unread_notifications_count`
- iss - did:key of client identity key
- ksu - key server for identity key verification
- aud - did:key of dapp authentication key
- app - did:web of app domain that this request is associated with
- Example: `did:web:app.example.com`

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4022 |
| Topic | notify topic |

### Response

- act - `notify_get_unread_notifications_count_response`
- iss - did:key of dapp authentication key
- aud - did:key of client identity key
- cnt - number of unread notifications

```typescript
{
auth: string,
}
```

| IRN | |
| ------- | ------------ |
| TTL | 300 |
| Tag | 4023 |
| Topic | notify topic |

## Noop

Noop message sent by the Notify Server after subscription creation to mark a topic as long-lived so the relay does not destroy it. Clients should ignore this message.
Expand Down
9 changes: 9 additions & 0 deletions docs/specs/clients/notify/client-sdk-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,20 @@ abstract class Client {
// Default 10, max 50
limit?: number,
startingAfter?: string,
// Default false
unreadFirst?: string,
}): Promise<{
notifications: NotifyNotificationRecord[],
hasMore: boolean,
hasMoreUnread: boolean,
}>

// get notification by ID
public abstract getNotification(params: {
topic: string,
id: string,
}): Promise<NotifyNotificationRecord>

// delete active subscription
public abstract deleteSubscription(params: {
topic: string,
Expand Down
2 changes: 2 additions & 0 deletions docs/specs/clients/notify/data-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
icon: string,
// Redirect URL for call-to-action related to notification. If empty, there is no link
url: string,
// If the notification was read or not
read: boolean,
}
```

Expand Down