Skip to content

Instantly share code, notes, and snippets.

View canterberry's full-sized avatar

Devin Canterberry canterberry

View GitHub Profile
@canterberry
canterberry / main.mjs
Created July 21, 2022 22:19
TWJ is JWT for Node.js apps. Here's how to use it.
import { createSigner, createValidator, createVerifier } from 'twj/v0';
import { generateKeyPairSync } from 'node:crypto';
/**
* Generate a key-pair, if you don't already have one, as a JWK object.
* Here's how you can do that using native APIs provided by Node.js
* In production scenarios, you'll already have this somewhere under
* configuration management alongside your other secrets.
*/
const { privateKey, publicKey } = generateKeyPairSync('ec', {
@canterberry
canterberry / OPTOUT.md
Created January 4, 2022 07:12
Resources for US residents to opt out of solicitations.
{
"username": "",
"password": "",
"ip": "login.uorenaissance.com",
"port": 2593,
"ultimaonlinedirectory": "C:/Program Files (x86)/Electronic Arts/Ultima Online Renaissance",
"clientversion": "5.0.8.3",
"lastcharactername": "",
"cliloc": "Cliloc.enu",
"lastservernum": 1,
@canterberry
canterberry / link-sdk.js
Created April 15, 2019 19:29
A minimal JavaScript SDK for interacting with Blockmason Link.
@canterberry
canterberry / UO-Razor-DefaultProfile-RestockAgent-FullSpellbook.xml
Created April 9, 2019 20:42
Example Razor restock agent for creating a full spellbook.
<Restock-3 hotbag="0">
<item id="7981" amount="1" />
<item id="7982" amount="1" />
<item id="7983" amount="1" />
<item id="7984" amount="1" />
<item id="7985" amount="1" />
<item id="7986" amount="1" />
<item id="7987" amount="1" />
<item id="7988" amount="1" />
<item id="7989" amount="1" />
@canterberry
canterberry / UO-Razor-DefaultProfile-SpellbookOrganizers.xml
Created April 9, 2019 20:35
Copy/paste organizer agents for a UO Razor profile for stocking spellbooks.
<Organizer-10 hotbag="1099616085">
<item id="7981" />
<item id="7982" />
<item id="7983" />
<item id="7984" />
<item id="7985" />
<item id="7986" />
<item id="7987" />
<item id="7988" />
</Organizer-10>
@canterberry
canterberry / dc26-badge-cryptanalysis.js
Created August 9, 2018 23:49
WIP: DC26 Badge Challenge
const { Buffer } = require('buffer');
const arcadePoster = Buffer.from('2BFC8E2B3561C04FBBC73FA43D5D96540D0AA008B30924CE47DA0EC67530D3', 'hex');
const arcadeGraffiti = Buffer.from('9E1CE2C2F6FBFE198637E6F10B957DDD50A7874177A51E', 'hex');
const humanoidNote = Buffer.from('FEEDB0B0DEADBEEF', 'hex');
const noteThenGraffiti = Buffer.from('FEEDB0B0DEADBEEF9E1CE2C2F6FBFE198637E6F10B957DDD50A7874177A51E', 'hex');
const graffitiThenNote = Buffer.from('9E1CE2C2F6FBFE198637E6F10B957DDD50A7874177A51EFEEDB0B0DEADBEEF', 'hex');
const merge = (A, B, f) => Buffer.from(Array.from(A).map((n, index) => f(n, B[index % B.length])));

Keybase proof

I hereby claim:

  • I am canterberry on github.
  • I am canterberry (https://keybase.io/canterberry) on keybase.
  • I have a public key whose fingerprint is 8BE0 8D64 2839 89A6 F2A3 8D02 7B35 80B9 FAA1 2E7E

To claim this, I am signing this object:

@canterberry
canterberry / crypto.ec.pem.js
Created April 26, 2018 23:15
Export PEM-encoded EC key pair (ECDH, ECDSA)
// (Buffer is available in Node.js as a global, but we require it this way for compatibility)
// See: https://nodejs.org/api/buffer.html#buffer_buffer
const { Buffer } = require('buffer');
const crypto = require('crypto');
const keyPair = crypto.createECDH('secp256k1');
keyPair.generateKeys();
// Print the PEM-encoded private key
@canterberry
canterberry / tls.sh
Created February 3, 2018 19:40
CLI for generating TLS key, certificate signing request (CSR), and self-signed certificate
#!/usr/bin/env bash
# ============================================================================ #
# This CLI tool is a working reference implementation for generating TLS
# private keys, certificate signing requests (CSRs), and self-signed
# certificates. The benefits of using this tool vs OpenSSL directly are as
# follows:
#
# * Significantly easier to use than OpenSSL.
#
# * Strong keys by default (ECC with secp384r1 curve).