module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
import threading
from contextlib import contextmanager
_state = threading.local()
package session
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
import { Exclude, Expose } from 'class-transformer';
export class User {
id: string;
firstName: string;
require "loofah"
class HtmlSanitizer
ALLOWED_TAGS = %w[p br a strong em ul ol li blockquote code pre h2 h3].freeze
ALLOWED_ATTRS = %w[href title].freeze
SAFE_SCHEMES = %w[http https mailto].freeze
package web
import (
"bytes"
"html/template"
"net/http"
public class PayloadLimitFilter extends OncePerRequestFilter {
private final long maxBytes;
private final Set<String> allowedTypes;
public PayloadLimitFilter(long maxBytes, Set<String> allowedTypes) {
const jwt = require('jsonwebtoken');
const SECRET = process.env.JWT_SECRET;
const ALGORITHM = 'HS256';
const ACCESS_TTL = '15m';
const jwt = require('jsonwebtoken');
function authenticate(req, res, next) {
const header = req.headers.authorization || '';
const [scheme, token] = header.split(' ');
module Webhooks
class StripeController < ApplicationController
skip_before_action :verify_authenticity_token
def create
payload = request.body.read
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.time.Instant;
import hashlib
import hmac
import time
class SignatureError(Exception):