Skip to content

Instantly share code, notes, and snippets.

@ahmetgeymen
ahmetgeymen / index.html
Created December 28, 2020 00:18
OAuth Authorization Code + PKCE in Vanilla JS
<html>
<title>OAuth Authorization Code + PKCE in Vanilla JS</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--
MIT License
Copyright (c) 2019 Aaron Parecki
Permission is hereby granted, free of charge, to any person obtaining a copy
@chris-rock
chris-rock / crypto-buffer.js
Last active November 24, 2023 09:48
Encrypt and decrypt buffers in nodejs
// Part of https://github.com/chris-rock/node-crypto-examples
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
function encrypt(buffer){
var cipher = crypto.createCipher(algorithm,password)
var crypted = Buffer.concat([cipher.update(buffer),cipher.final()]);
return crypted;