Update all keystore credentials to use BE format

This commit is contained in:
stubbsta 2025-05-29 09:27:39 +02:00
parent 12496169b1
commit badbc07ffe
3 changed files with 9 additions and 9 deletions

View File

@ -6,9 +6,9 @@ import stint
import import
waku/[waku_keystore/protocol_types, waku_rln_relay, waku_rln_relay/protocol_types] waku/[waku_keystore/protocol_types, waku_rln_relay, waku_rln_relay/protocol_types]
func fromStrToBytesLe*(v: string): seq[byte] = func fromStrToBytesBe*(v: string): seq[byte] =
try: try:
return @(hexToUint[256](v).toBytesLE()) return @(hexToUint[256](v).toBytesBE())
except ValueError: except ValueError:
# this should never happen # this should never happen
return @[] return @[]
@ -18,10 +18,10 @@ func defaultIdentityCredential*(): IdentityCredential =
return IdentityCredential( return IdentityCredential(
idTrapdoor: default(IdentityTrapdoor), idTrapdoor: default(IdentityTrapdoor),
idNullifier: default(IdentityNullifier), idNullifier: default(IdentityNullifier),
idSecretHash: fromStrToBytesLe( idSecretHash: fromStrToBytesBe(
"7984f7c054ad7793d9f31a1e9f29eaa8d05966511e546bced89961eb8874ab9" "7984f7c054ad7793d9f31a1e9f29eaa8d05966511e546bced89961eb8874ab9"
), ),
idCommitment: fromStrToBytesLe( idCommitment: fromStrToBytesBe(
"51c31de3bff7e52dc7b2eb34fc96813bacf38bde92d27fe326ce5d8296322a7" "51c31de3bff7e52dc7b2eb34fc96813bacf38bde92d27fe326ce5d8296322a7"
), ),
) )

View File

@ -53,16 +53,16 @@ proc toIdentityCredentials*(
try: try:
let let
idTrapdoor = IdentityTrapdoor( idTrapdoor = IdentityTrapdoor(
@(hexToUint[CredentialByteSize](groupKeys[i][0]).toBytesLE()) @(hexToUint[CredentialByteSize](groupKeys[i][0]).toBytesBE())
) )
idNullifier = IdentityNullifier( idNullifier = IdentityNullifier(
@(hexToUint[CredentialByteSize](groupKeys[i][1]).toBytesLE()) @(hexToUint[CredentialByteSize](groupKeys[i][1]).toBytesBE())
) )
idSecretHash = IdentitySecretHash( idSecretHash = IdentitySecretHash(
@(hexToUint[CredentialByteSize](groupKeys[i][2]).toBytesLE()) @(hexToUint[CredentialByteSize](groupKeys[i][2]).toBytesBE())
) )
idCommitment = idCommitment =
IDCommitment(@(hexToUint[CredentialByteSize](groupKeys[i][3]).toBytesLE())) IDCommitment(@(hexToUint[CredentialByteSize](groupKeys[i][3]).toBytesBE()))
groupIdCredentials.add( groupIdCredentials.add(
IdentityCredential( IdentityCredential(
idTrapdoor: idTrapdoor, idTrapdoor: idTrapdoor,

View File

@ -27,7 +27,7 @@ type
RawRateCommitment* = seq[byte] RawRateCommitment* = seq[byte]
proc toRateCommitment*(rateCommitmentUint: UInt256): RawRateCommitment = proc toRateCommitment*(rateCommitmentUint: UInt256): RawRateCommitment =
return RawRateCommitment(@(rateCommitmentUint.toBytesLE())) return RawRateCommitment(@(rateCommitmentUint.toBytesBE()))
# Custom data types defined for waku rln relay ------------------------- # Custom data types defined for waku rln relay -------------------------
type RateLimitProof* = object type RateLimitProof* = object