@comms-id/relay
v0.1.0
Published
Server relay for Comms.ID products: your backend forwards your own users' requests, signed as your registered app
Readme
@comms-id/relay
Forward your own users' requests to a Comms.ID product from your own server. Your server signs each call as your registered app, so the browser never holds a credential.
// app/api/comms-id/[product]/[operation]/route.ts (Next.js)
import { createNextRelay } from "@comms-id/relay/next";
import { addressProduct } from "@comms-id/address/descriptor";
export const { POST } = createNextRelay({
products: [addressProduct],
// Your rule: who may use this route. Return true, false (401), or your own Response.
allow: async (request) => isSignedIn(request),
signer,
});// Hono
import { relayHandler } from "@comms-id/relay/hono";
app.post("/comms-id/:product/:operation", relayHandler({ products: [addressProduct], allow, signer }));The relay reaches only the operations that your product descriptors list. It does not forward
any other path, and it does not send your users' cookies or Authorization header to Comms.ID.
Proprietary software; see LICENSE.
