U-net Docs
0.2.0-alpha.3

@union-networks/server

Server-side assertion verification helpers.

bashInstall
npm install @union-networks/server@alpha

When to use it

Exports

verifyLoginAssertionWebLoginAssertionClaimsVerifyLoginAssertionOptions

Examples

tsVerify assertion
import { verifyLoginAssertion } from '@union-networks/server';

export async function POST(request: Request) {
  const { assertionJws } = await request.json();

  const claims = verifyLoginAssertion(assertionJws, {
    secret: process.env.UNET_WEB_LOGIN_ASSERTION_SECRET!,
    serviceId: 'example-shop',
  });

  // Store claims.scopedUserId as the account id for your service.
  await createSession({ scopedUserId: claims.scopedUserId });
  return Response.json({ ok: true });
}