Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am edinnen on github.
  • I am ethanjdinnen (https://keybase.io/ethanjdinnen) on keybase.
  • I have a public key whose fingerprint is 2AC2 1690 A67C 409A CE3A 83BD A994 E6A7 D022 C7EC

To claim this, I am signing this object:

@edinnen
edinnen / genAppleToken.js
Created October 27, 2021 19:13
Generate an access token for Sign in With Apple
const jwt = require('jsonwebtoken');
const fs = require('fs');
const privateKey = fs.readFileSync('/Path/To/appleAuth/key.p8');
const client_id = 'YOUR_CLIENT_ID';
const team = 'YOUR_TEAM_ID';
const key_id = 'YOUR_KEY_ID';
function _generateToken(clientId, teamId, pk, exp, keyid) {
try {
const claims = {
@edinnen
edinnen / genAppleTransfer.sh
Last active February 14, 2024 13:22
Generate transfer_subs from a list of apple_user_ids
#!/bin/bash
totalLines=0
requestTransfer() {
transferSub=$(curl -sS --request POST $1 \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header "Authorization: Bearer $2" \
-d "sub=$3&target=$4&client_id=$5&client_secret=$6" \
| jq -r '.transfer_sub')
printf '%s,%s,%s,%s\n' "$7" "$8" "$9" "$transferSub"
}
@edinnen
edinnen / genToken.js
Last active December 14, 2021 17:54
Generate a signed JWT for authenticating Sign in With Apple user transfer requests
/* eslint-disable no-console */
const jwt = require('jsonwebtoken');
const fs = require('fs');
let bundleId, teamId, keyId, keyPath;
const SIX_MONTH_EXPIRY = Math.floor(Date.now() / 1000) + 86400 * 180;
// generateToken is a helper function to generate an ES256 JWT token.
function generateToken(bundleId, teamId, pk, exp, keyid) {
try {
@edinnen
edinnen / nerdctl-rancher-install.sh
Created January 26, 2022 20:23
Bash script to install Rancher Desktop 0.7.1 and Nerdctl automatically for OSX, Windows, and Linux
#!/bin/bash
linux_install(){
echo "Installing brew package manager. Required to install nerdctl..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "Installing nerdctl..."
brew install nerdctl
echo "Downloading rancher-desktop to ~/rancher-desktop"