Installation
Available Extensions
| Extension | Purpose |
|---|---|
| Sign-In-With-X | Wallet authentication for repeat access |
| Payment Identifier | Idempotency for payment requests |
| Bazaar | Resource discovery |
API Reference
Hook Creators (Client-Side)
Hooks allow you to automatically handle server extension requirements.createSIWxHook
Creates a hook that handles Sign-In-With-X authentication:| Option | Type | Description |
|---|---|---|
domain | string | Domain requesting sign-in |
statement | string | Human-readable statement |
expirationSeconds | number | Seconds until expiration |
createPaymentIdHook
Creates a hook that adds payment idempotency:| Option | Type | Description |
|---|---|---|
paymentId | string | Custom payment identifier |
createCustomHook
Create custom extension hooks:Server Extension Declaration
For server-side middleware, declare extensions that clients should provide:declareSIWxExtension
declarePaymentIdentifierExtension
declareDiscoveryExtension
Verification
Verify client-provided extension data:validateSIWxMessage
verifySIWxSignature
Utilities
generatePaymentId
Generate a random payment identifier:extractExtension
Extract extension data from a payload:Constants
Types
Exports Summary
| Export | Description |
|---|---|
createSIWxHook | Hook for Sign-In-With-X |
createPaymentIdHook | Hook for payment idempotency |
createCustomHook | Create custom hooks |
declareSIWxExtension | Declare SIWX extension for server |
declarePaymentIdentifierExtension | Declare payment ID extension |
declareDiscoveryExtension | Declare Bazaar discovery extension |
validateSIWxMessage | Validate SIWX payload |
verifySIWxSignature | Verify SIWX signature |
parseSIWxHeader | Parse SIWX header |
encodeSIWxHeader | Encode SIWX header |
createSIWxMessage | Create SIWX message |
createSIWxPayload | Create SIWX payload |
generatePaymentId | Generate random payment ID |
extractExtension | Extract extension data |
isSIWxExtension | Check if extension is SIWX |
isPaymentIdentifierExtension | Check if extension is Payment ID |
isDiscoveryExtension | Check if extension is Bazaar discovery |