This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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))); | |
} |