Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions src/utils/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import * as StellarSdk from "@stellar/stellar-sdk";
import { getPlatformKeypair, getNetworkPassphrase } from "../config/stellar.js";
import crypto from "node:crypto";

/**
* Sign an arbitrary message hash with the platform keypair.
* Used for quiz proof signatures and reward authorization.
*/
export function signWithPlatformKey(message: Buffer): string {
const keypair = getPlatformKeypair();
return keypair.sign(message).toString("base64");
}


/**
* Verify a Stellar signature against a public key.
Expand All @@ -27,15 +19,6 @@ export function verifyStellarSignature(
}
}

/**
* Generate a deterministic challenge token for SEP-10 auth.
*/
export function generateChallengeToken(account: string): string {
const nonce = crypto.randomBytes(32).toString("base64");
const timestamp = Date.now();
return JSON.stringify({ account, nonce, timestamp });
}

/**
* Hash data for on-chain content references.
*/
Expand Down
Loading