Implement fail-closed node keystore bridge

This commit is contained in:
冰朔 2026-08-10 09:35:31 +08:00
commit b4d6e7a4f9
5 changed files with 345 additions and 5 deletions

View file

@ -81,6 +81,18 @@ export function nodePossessionChallengeSigningBytes(challenge: NodePossessionCha
}), 'utf8');
}
export function assertActiveNodePossessionChallenge(
challenge: NodePossessionChallenge,
now = Date.now(),
): NodePossessionChallenge {
if (!issuedChallenges.has(challenge)
|| consumedChallenges.has(challenge)
|| !Number.isSafeInteger(now)
|| now < challenge.issuedAt
|| now >= challenge.expiresAt) invalidProof();
return challenge;
}
export function createNodePossessionChallenge(
registration: VerifiedNodeRegistration,
now = Date.now(),