Skip to content

Instantly share code, notes, and snippets.

View tnanhpt's full-sized avatar

Anh Pham tnanhpt

View GitHub Profile
@arvindkumarbadwal
arvindkumarbadwal / axios.js
Created May 15, 2020 13:58
Axios SSL Certificate Pinning
const tls = require('tls');
const https = require('https');
const crypto = require('crypto');
const axios = require('axios');
function sha256(s) {
return crypto.createHash('sha256').update(s).digest('base64');
}
const options = {
@Useems
Useems / index.ts
Created February 21, 2024 12:40
Facebook NodeJS encpass implementation
// @ts-ignore
import { default as nacl } from 'tweetnacl-sealedbox-js';
import { webcrypto } from 'crypto';
function decodeUTF8(str: string): Uint8Array {
if (typeof str !== "string")
throw new TypeError("expected string");
return new Uint8Array(unescape(encodeURIComponent(str)).split("").map(char => char.charCodeAt(0)));
}