Types
This section provides a detailed reference for the key TypeScript types and interfaces used throughout the DID Space component library. A solid understanding of these data structures is essential for effectively configuring the props of components like DIDSpaceConnect
and DIDSpaceConnection
.
DIDSpaceGateway#
The DIDSpaceGateway
interface represents the core information about a specific DID Space instance. It is used to display space details and to establish connections.
Property | Type | Description |
---|---|---|
|
| The DID of the space itself. |
|
| The display name of the space. |
|
| The base URL for the space's web application (e.g., |
|
| The specific API endpoint URL for the space. |
|
| The DID of the space's owner. |
|
| Indicates if the space requires special authentication. |
|
| A flag to indicate if the gateway information is currently being loaded. |
DIDSpaceStatus#
The DIDSpaceStatus
enum defines the possible connection states for a DID Space, which is often used to conditionally render UI elements.
Status | Value | Description |
---|---|---|
|
| The connection status is currently being determined. |
|
| A valid connection to the DID Space is established. |
|
| Not connected to the DID Space. |
|
| The space is unavailable due to subscription issues like expiration, overdue payments, or insufficient usage. |
AuthorizeConnect#
This interface defines the properties for configuring the connection modal that appears when a user initiates a connection.
Property | Type | Description |
---|---|---|
|
| Controls the visibility of the connection modal. |
|
| A string identifying the type of action being requested (e.g., 'connect', 'login'). |
|
| A function used to poll or check the status of the connection attempt. |
|
| An object containing the text and content to display in the modal. |
|
| A URL prefix for constructing QR code URLs. |
|
| The base URL for the authentication service. |
|
| The URL for the web wallet to be used for authentication. |
|
| The maximum idle time in milliseconds before the session is considered expired. |
|
| The timeout in milliseconds for the |
|
| An object containing any extra parameters to be passed during the authentication request. |
Messages Object#
The messages
object within AuthorizeConnect
has the following structure:
Property | Type | Description |
---|---|---|
|
| The title text displayed at the top of the modal. |
|
| The instructional text for scanning the QR code. |
|
| The text shown while waiting for confirmation on the wallet. |
|
| The content (e.g., a component or string) displayed upon successful connection. |
Authentication Options#
These interfaces provide a way to configure authentication callbacks and parameters for connection flows.
BaseAuthOptions#
This is the foundational interface for authentication options.
Property | Type | Description |
---|---|---|
|
| Specifies the authentication action type. |
|
| A custom function to verify the authentication status. |
|
| Additional parameters to include in the authentication request. |
|
| Timeout in milliseconds for the |
|
| A callback function that executes upon successful authentication. It receives the response and a decrypt function. |
|
| A callback function that executes when the authentication modal is closed. |
GatewayAuthOptions#
This interface extends BaseAuthOptions
with properties specific to connecting to a particular DID Space gateway.
Property | Type | Description |
---|---|---|
|
| The DID of the target DID Space. |
|
| The URL of the target DID Space gateway. |
Type Aliases#
For backward compatibility, the library provides the following type aliases:
SpaceGateway
is an alias forDIDSpaceGateway
.SpaceStatus
is an alias forDIDSpaceStatus
.
With a clear understanding of these data types, you are now better equipped to implement the components. For practical examples and prop configurations, please see the documentation for DIDSpaceConnect
and DIDSpaceConnection
.