Implement fail-closed node keystore bridge
This commit is contained in:
parent
c0e3c67fe4
commit
b4d6e7a4f9
5 changed files with 345 additions and 5 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue