Skip to content

Instantly share code, notes, and snippets.

View mattlockyer's full-sized avatar
💭
🥳

Matt Lockyer mattlockyer

💭
🥳
View GitHub Profile
@mattlockyer
mattlockyer / do.ts
Last active December 12, 2021 05:12
Durable Object Generic Boilerplate
const META_KEY: string = '_M'
export class Object {
state: DurableObjectState
meta: any
data: any
timeouts: any
constructor(state: DurableObjectState, env: Env) {
this.state = state;
@mattlockyer
mattlockyer / steps.js
Last active March 12, 2022 22:28
near-cli and near-api-js - key rotation steps for accounts
// go to https://near.github.io/seed-recovery/ and click the random button at the bottom
// copy publicKey AND seed phrase somewhere SAFE
// use the same tool to find the public key of an existing seed phrase OR call
near keys [accountId]
// once you have both public keys AND the new seed phrase SAFELY STORED
near add-key [accountId] [newPublicKey]
near delete-key [accountId] [oldPublicKey]
// Reference: https://www.npmjs.com/package/near-cli#near-add-key
@mattlockyer
mattlockyer / nondeterm-ecdsa-recovery.py
Created February 17, 2024 18:58
Produce the same Ethereum address using non-deterministic ECDSA signatures (r,s)
# references:
# https://ethereum.stackexchange.com/questions/114680/is-it-possible-to-use-non-deterministic-ecdsa-signatures-schemes-for-signing-eth
# https://eth-account.readthedocs.io/en/stable/eth_account.html#eth_account.account.Account.recover_message
from ecdsa import SigningKey, SECP256k1
from eth_account import Account
from eth_account.messages import encode_defunct, defunct_hash_message
message = encode_defunct(text="I♥SF")
mh = defunct_hash_message(text="I♥SF")