@veramo/did-comm
Version:
Veramo messaging plugin implementing DIDComm v2.
90 lines • 3.2 kB
TypeScript
/**
* Result interface for sending DIDComm messages through
* {@link IDIDCommTransport.send}.
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
export interface IDIDCommTransportResult {
result?: string;
error?: string;
returnMessage?: string;
}
/**
* Common interface for transports that can be used in the
* {@link DIDComm} module.
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
export interface IDIDCommTransport {
/**
* Identifier of this transport that can be used in case the
* message thread supports reusing the transport connection.
*/
id: string;
/**
* Returns `true` if this transport is suitable for the provided
* DID Document service section, otherwise `false`.
* @param service - The DID Document service section
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
isServiceSupported(service: any): boolean;
/**
* Sends the provided raw message (without further processing) to
* the service endpoint defined in the provided DID Document service
* section.
*
* @param service - The DID Document service section that contains
* a `serviceEndpoint` entry.
* @param message - The message to be sent.
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
send(service: any, message: string): Promise<IDIDCommTransportResult>;
}
/**
* Abstract implementation of {@link IDIDCommTransport}.
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
export declare abstract class AbstractDIDCommTransport implements IDIDCommTransport {
id: string;
/**
* Shared constructor that takes an optional identifier (for reusing) for
* this {@link IDIDCommTransport}.
*
* @param id - An optional identifier for this {@link IDIDCommTransport}.
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
constructor(id?: string);
/** {@inheritdoc IDIDCommTransport.isServiceSupported} */
abstract isServiceSupported(service: any): boolean;
/** {@inheritdoc IDIDCommTransport.send} */
abstract send(service: any, message: string): Promise<IDIDCommTransportResult>;
}
/**
* Implementation of {@link IDIDCommTransport} to provide a simple
* transport based on HTTP(S) requests.
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
export declare class DIDCommHttpTransport extends AbstractDIDCommTransport {
/**
* Defines the default HTTP method to use if not specified
* in the DID Document service entry of the recipient.
*/
httpMethod: 'post' | 'get';
/**
* Creates a new {@link DIDCommHttpTransport}.
* @param httpMethod - Default HTTP method if not specified in the service
* section.
*/
constructor(httpMethod?: 'post' | 'get');
/** {@inheritdoc AbstractDIDCommTransport.isServiceSupported} */
isServiceSupported(service: any): any;
/** {@inheritdoc AbstractDIDCommTransport.send} */
send(service: any, message: string): Promise<IDIDCommTransportResult>;
private inferContentType;
}
//# sourceMappingURL=transports.d.ts.map