Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
947 B · 30 lines
TypeScript
at mistress
12345678910111213141516171819202122232425262728293031import type { Main } from "#/lexicons/types/club/touchfluffytail/touchedfluffytail";import { ml_dsa65 } from "@noble/post-quantum/ml-dsa.js";import { TID } from "@atproto/common-web";import { Buffer } from "@craftzdog/react-native-buffer";import type { DIDRecord } from "rtnbleserver";import { addPendingRecord } from "./recordQueue";
type SigningKeys = { privateKey: Uint8Array<ArrayBufferLike> | null; pubkeyTid: string | null;};
export function createRecord( { did, createdAt }: DIDRecord, { privateKey, pubkeyTid }: SigningKeys,): void { if (!privateKey || !pubkeyTid) return;
const signature = ml_dsa65.sign(new TextEncoder().encode(did), privateKey);
const touch: Main = { $type: "club.touchfluffytail.touchedfluffytail", CreatedAt: createdAt, Payload: Buffer.from(signature).toString("hex"), Target: did, PubKeyTid: pubkeyTid, };
addPendingRecord({ rkey: TID.nextStr(), record: touch });}