import { createHash } from "crypto";
import { readFileSync } from "fs";
export function sha256(query: string): string {
return createHash("sha256").update(query, "utf8").digest("hex");
}
package grpcmw
import (
"context"
"time"
import express from 'express';
import cookieParser from 'cookie-parser';
import { issueCsrfToken, csrfProtection } from './csrf';
import { transfersRouter } from './routes/transfers';
const app = express();
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
-- Create roles
CREATE ROLE readonly;
CREATE ROLE readwrite;
CREATE ROLE admin WITH LOGIN PASSWORD 'secure_password';
-- Grant permissions to roles
package com.example.myapp.utils
import android.content.Context
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt
import androidx.core.content.ContextCompat
module Api
module V1
class PostsController < ApplicationController
def create
post = current_user.posts.build(post_params)
package middleware
import (
"context"
"net/http"
"strings"
bind 127.0.0.1 10.0.0.15
protected-mode yes
port 6379
rename-command FLUSHALL ""
rename-command CONFIG ""
aclfile /etc/redis/users.acl
import crypto from 'node:crypto';
export function base64url(buf: Buffer) {
return buf.toString('base64').replace(/+/g, '-').replace(///g, '_').replace(/=+$/g, '');
}
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!
end
import crypto from 'crypto';
import helmet from 'helmet';
import type { Express, Request, Response, NextFunction } from 'express';
function cspNonce(req: Request, res: Response, next: NextFunction): void {
res.locals.cspNonce = crypto.randomBytes(16).toString('base64');