Update wasm for js-pow-sha256

This commit is contained in:
WeebDataHoarder
2025-04-01 22:38:48 +02:00
parent c4ea3f5e58
commit c05202c2c5
2 changed files with 5 additions and 1 deletions

View File

@@ -70,10 +70,14 @@ func VerifyChallenge(in challenge.Allocation) (out challenge.VerifyChallengeOutp
result := make([]byte, inline.DecodedLen(len(in.Result)))
n, err := inline.Decode(result, in.Result)
if err != nil {
panic(err)
return challenge.VerifyChallengeOutputError
}
result = result[:n]
if len(result) < 8 {
return challenge.VerifyChallengeOutputError
}
// verify we used same challenge
if subtle.ConstantTimeCompare(result[:len(result)-8], c) != 1 {
return challenge.VerifyChallengeOutputFailed