Skip to content

Instantly share code, notes, and snippets.

View brhx's full-sized avatar

Brooke Holmes brhx

View GitHub Profile
@brhx
brhx / realtimeAuthorizer.js
Created November 16, 2024 21:02
AppSync events JWT authorizer that works just like Ably
import crypto from "crypto";
/**
* @typedef {Object} RequestContext
* @property {string} apiId - The API Gateway ID
* @property {string} accountId - The AWS account ID
* @property {string} requestId - The unique request ID
* @property {'EVENT_CONNECT'|'EVENT_SUBSCRIBE'|'EVENT_PUBLISH'} operation - The WebSocket operation
* @property {string} channelNamespaceName - The channel namespace
* @property {string} channel - The full channel path