Skip to content

Instantly share code, notes, and snippets.

View Alasano's full-sized avatar
💭
🥇

Aljosa Asanovic Alasano

💭
🥇
View GitHub Profile
@Alasano
Alasano / slack.guard.ts
Last active December 11, 2023 19:26
NestJS Slack Signature Verification - Drop this guard into any controller which needs to verify the authenticity of requests coming from Slack! @UseGuards(SlackGuard) - Based on https://api.slack.com/docs/verifying-requests-from-slack
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import * as qs from 'qs';
import * as crypto from 'crypto';
import { Buffer } from 'buffer';
@Injectable()
export class SlackGuard implements CanActivate {
canActivate(
context: ExecutionContext,

Keybase proof

I hereby claim:

  • I am alasano on github.
  • I am alasano (https://keybase.io/alasano) on keybase.
  • I have a public key whose fingerprint is C338 DBBD 031D 1EE9 2250 86A9 8AE0 F719 C49B 8338

To claim this, I am signing this object: