Skip to content

Instantly share code, notes, and snippets.

View tetratorus's full-sized avatar

Leonard Tan tetratorus

View GitHub Profile
@tetratorus
tetratorus / time-lock.js
Created October 12, 2022 21:20
Time-locked secret shares
const NodeRSA = require('node-rsa');
const BN = require('bn.js');
const AesEncryption = require('aes-encryption');
const eccrypto = require('@toruslabs/eccrypto');
const seconds = 10;
const sqPerSecond = 20000;
const seqSquares = (base, mod, length) => {
let table = [base.umod(mod)];
let prev = base.umod(mod);
@tetratorus
tetratorus / jsonwebtoken-utils.js
Created December 14, 2020 19:36
Test JWT generator utilities
const FetchNodeDetails = require("@toruslabs/fetch-node-details/dist/fetchNodeDetails-node");
const jwt = require("jsonwebtoken");
const fs = require("fs");
const SIGNING_KEY = fs.readFileSync("./keys/key.pem");
const NETWORK_MAP = {
mainnet: { proxyAddress: "0x638646503746d5456209e33a2ff5e3226d698bea", network: "mainnet" },
testnet: { proxyAddress: "0x4023d2a0D330bF11426B12C6144Cfb96B7fa6183", network: "ropsten" },
};
@tetratorus
tetratorus / testalert.js
Created January 30, 2020 16:18
alertjs
alert("hello");
@tetratorus
tetratorus / embedmin.js
Created January 30, 2020 16:07
embed.min.js
This file has been truncated, but you can view the full file.
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({"/Users/lentan/repo/torus/torus-embed/dist/PopupHandler.js":[function(require,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _events=require("events");function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a clas
@tetratorus
tetratorus / test
Created February 20, 2018 12:29
Hello!
***THIS LOAN SETTLEMENT AGREEMENT*** is made on
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
***BACKGROUND***
1. Pursuant to a loan by the Singapore Management University (SMU)
constituent body known as Special Interest and Community Service
Sodality (SICS) of S$6,240.00 to the SMU Wine Appreciation
Club (WAC) for the repayment of the debt incurred previously.

Keybase proof

I hereby claim:

  • I am tetratorus on github.
  • I am tetratorus (https://keybase.io/tetratorus) on keybase.
  • I have a public key ASBdBKxezWtqrKyGvj0nweagpB8xgtk-wJSBqHMXLQCgJAo

To claim this, I am signing this object:

0x289f4D9Ddf0e855ECb7aa795806C510346444199
0xA40e3f0c50Cf6edE001EcBc82A6171e77AAa30aE
0x1dbdeea72aada92df0c7c28ae22de43575f37738
0x994fa890394dbb6301695476b53817f03b230ed5