Skip to content

Instantly share code, notes, and snippets.

@mozzius
mozzius / ecdsa.js
Last active February 21, 2018 11:27
Implementation of secp256k1 in node.js
const crypto = require('crypto')
const bigInt = require('big-integer')
// we need big-integer as the numbers that we're dealing with are too big for JS' default numbers
function sha256(data) {
// creates a sha256 hash, updates it with data, and turns it into a bigint
var hash = crypto.createHash('sha256').update(data).digest('hex')
return bigInt(hash,16)
}
@mozzius
mozzius / happy-path.ts
Created October 18, 2024 20:48
Bluesky video upload - direct upload
import {
AppBskyEmbedVideo,
AppBskyVideoDefs,
AtpAgent,
BlobRef,
} from "npm:@atproto/api";
const userAgent = new AtpAgent({
service: prompt("Service URL (default: https://bsky.social):") ||
"https://bsky.social",
@mozzius
mozzius / sad-path.ts
Created October 18, 2024 21:00
Bluesky video upload - indirect upload
import { AppBskyEmbedVideo, AtpAgent } from "npm:@atproto/api";
const userAgent = new AtpAgent({
service: prompt("Service URL (default: https://bsky.social):") ||
"https://bsky.social",
});
await userAgent.login({
identifier: prompt("Handle:")!,
password: prompt("Password:")!,
@mozzius
mozzius / gif.ts
Created November 10, 2024 13:33
please add gifs
import {
AppBskyEmbedVideo,
AppBskyVideoDefs,
AtpAgent,
BlobRef,
} from "npm:@atproto/api";
const userAgent = new AtpAgent({
service: prompt("Service URL (default: https://bsky.social):") ||
"https://bsky.social",