Skip to content

Commit 9fa0740

Browse files
README.md updated
1 parent 1f2e386 commit 9fa0740

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ These are passed to `SignedRequestsManager` constructor and apply to all storage
128128
| `validitySignature` | 5000 | Signature validity window in milliseconds |
129129
| `validityToken` | 3600000 | Session token validity in milliseconds |
130130
| `tokenLength` | 32 | Token length in bytes (cryptographic secret) |
131+
| `onError` | undefined | Callback invoked when an error occurs during request validation |
131132

132133
#### SessionsStorageLocal Specific Parameters
133134

@@ -147,8 +148,10 @@ These are specific to the in-memory implementation:
147148
import { SignedRequester } from 'https://cdn.jsdelivr.net/gh/StefanoBalocco/HonoSignedRequests/client/dist/SignedRequester.min.js';
148149
149150
const requester = new SignedRequester();
150-
// You can also specify a base URL for request
151+
// You can also specify a base URL for requests
151152
//const requester = new SignedRequester('https://api.example.com');
153+
// You can also specify an error handler for encoding/decoding errors
154+
//const requester = new SignedRequester('https://api.example.com', (error) => console.error(error));
152155
153156
// Check if we have session data stored
154157
let needLogin = true;
@@ -194,6 +197,17 @@ These are specific to the in-memory implementation:
194197
195198
### Client API
196199
200+
#### Constructor
201+
202+
```javascript
203+
const requester = new SignedRequester(baseUrl?, onError?);
204+
```
205+
206+
| Parameter | Type | Description |
207+
|-----------|------|-------------|
208+
| `baseUrl` | `string` | Optional base URL for all requests. If not provided, relative paths are used. |
209+
| `onError` | `(error: unknown) => void` | Optional callback invoked when encoding/decoding errors occur. |
210+
197211
#### `setSession(config)`
198212
199213
Initialize session after login.

0 commit comments

Comments
 (0)