Initial commit with translated description

This commit is contained in:
2026-03-29 13:13:12 +08:00
commit 7dcf9ca28b
23 changed files with 4659 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
const { randomInt } = require("crypto");
const { getInitializedRuntime } = require("./shared/bootstrap");
const { parseArgs, formatError, outputSuccess } = require("./shared/utils");
async function main() {
try {
const args = parseArgs();
if (!args.did) {
console.error("Error: --did parameter is required");
console.error("Usage: node scripts/generateChallenge.js --did <did>");
process.exit(1);
}
const { challengeStorage } = await getInitializedRuntime();
// Generate random challenge
const challenge = randomInt(0, 10000000000).toString();
// Save challenge to storage
await challengeStorage.save(args.did, challenge);
outputSuccess(challenge);
} catch (error) {
console.error(formatError(error));
process.exit(1);
}
}
main();