Skip to main content

MessageHandler class

A Veramo agent plugin that implements IMessageHandler methods.

This plugin is meant to chain together multiple other IMessageHandler implementations.

When handling a message, the message is passed from one handler to the next, and each handler in the chain can decide if it is able to interpret the message.

If the message can be processed by a handler it is returned as an IMessage. If the message cannot be processed by any of the handlers, an error is thrown.

Signature:

export declare class MessageHandler implements IAgentPlugin

Implements: IAgentPlugin

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the MessageHandler class

Properties

PropertyModifiersTypeDescription
methodsreadonlyIMessageHandlerPlugin methods
schemareadonly{ components: { schemas: { IHandleMessageArgs: { type: string; properties: { raw: { type: string; description: string; }; metaData: { type: string; items: { $ref: string; }; description: string; }; save: { type: string; description: string; deprecated: string; }; }; required: string[]; description: string; }; IMetaData: { type: string; properties: { type: { type: string; description: string; }; value: { type: string; description: string; }; }; required: string[]; description: string; }; IMessage: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; createdAt: { type: string; description: string; }; expiresAt: { type: string; description: string; }; threadId: { type: string; description: string; }; raw: { type: string; description: string; }; data: { anyOf: { type: string; }[]; description: string; }; replyTo: { type: string; items: { type: string; }; description: string; }; replyUrl: { type: string; description: string; }; from: { type: string; description: string; }; to: { type: string; description: string; }; metaData: { anyOf: ({ type: string; items: { $ref: string; }; } | { type: string; items?: undefined; })[]; description: string; }; credentials: { type: string; items: { $ref: string; }; description: string; }; presentations: { type: string; items: { $ref: string; }; description: string; }; attachments: { type: string; items: { $ref: string; }; description: string; }; returnRoute: { type: string; description: string; }; }; required: string[]; description: string; }; VerifiableCredential: { type: string; properties: { proof: { $ref: string; }; issuer: { $ref: string; }; credentialSubject: { $ref: string; }; type: { anyOf: ({ type: string; items: { type: string; }; } | { type: string; items?: undefined; })[]; }; "@context": { $ref: string; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; credentialStatus: { $ref: string; }; id: { type: string; }; }; required: string[]; description: string; }; ProofType: { type: string; properties: { type: { type: string; }; }; description: string; }; IssuerType: { anyOf: ({ type: string; properties: { id: { type: string; }; }; required: string[]; } | { type: string; properties?: undefined; required?: undefined; })[]; description: string; }; CredentialSubject: { type: string; properties: { id: { type: string; }; }; description: string; }; ContextType: { anyOf: ({ type: string; items?: undefined; } | { type: string; items: { anyOf: { type: string; }[]; }; })[]; description: string; }; CredentialStatusReference: { type: string; properties: { id: { type: string; }; type: { type: string; }; }; required: string[]; description: string; }; VerifiablePresentation: { type: string; properties: { proof: { $ref: string; }; holder: { type: string; }; verifiableCredential: { type: string; items: { $ref: string; }; }; type: { anyOf: ({ type: string; items: { type: string; }; } | { type: string; items?: undefined; })[]; }; "@context": { $ref: string; }; verifier: { type: string; items: { type: string; }; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; id: { type: string; }; }; required: string[]; description: string; }; W3CVerifiableCredential: { anyOf: { $ref: string; }[]; description: string; }; CompactJWT: { type: string; description: string; }; IMessageAttachment: { type: string; properties: { id: { type: string; }; description: { type: string; }; filename: { type: string; }; media_type: { type: string; }; format: { type: string; }; lastmod_time: { type: string; }; byte_count: { type: string; }; data: { $ref: string; }; }; required: string[]; description: string; }; IMessageAttachmentData: { type: string; properties: { jws: {}; hash: { type: string; }; links: { type: string; items: { type: string; }; }; base64: { type: string; }; json: {}; }; description: string; }; }; methods: { handleMessage: { description: string; arguments: { $ref: string; }; returnType: { $ref: string; }; }; }; }; }

Methods

MethodModifiersDescription
handleMessage(args, context)

Parses a raw message.

After the message is parsed, you can decide if it should be saved, and pass the result to dataStoreSaveMessage() to save it.