remote-server package

Express router for exposing @veramo/remote-client OpenAPI schema

Example

import express from 'express'
import { agent } from './agent'
import { AgentRouter, ApiSchemaRouter, WebDidDocRouter } from '@veramo/remote-server'
const getAgentForRequest = async (req: express.Request) => agent
const exposedMethods = agent.availableMethods()
const basePath = '/agent'
const schemaPath = '/open-api.json'
const agentRouter = AgentRouter({
getAgentForRequest,
exposedMethods,
})
const schemaRouter = ApiSchemaRouter({
basePath,
getAgentForRequest,
exposedMethods,
})
const didDocRouter = WebDidDocRouter({
getAgentForRequest,
})
const app = express()
app.use(basePath, agentRouter)
app.use(schemaPath, schemaRouter)
app.use(didDocRouter)
app.listen(3002)

Functions

FunctionDescription
apiKeyAuth({ apiKey })
createDefaultDid(options)

Interfaces

InterfaceDescription
AgentRouterOptions
ApiSchemaRouterOptions

Variables

VariableDescription
AgentRouterCreates a router that exposes Agent methods
ApiSchemaRouterCreates a router that exposes Agent OpenAPI schema
didDocEndpoint
MessagingRouterCreates a router for handling incoming messages
RequestWithAgentRouterCreates a router that adds veramo agent to the request object
WebDidDocRouterCreates a router that serves did:web DID Documents