diff --git a/tests/waku_keystore/utils.nim b/tests/waku_keystore/utils.nim index c9a85ee37..8af2d2a26 100644 --- a/tests/waku_keystore/utils.nim +++ b/tests/waku_keystore/utils.nim @@ -6,9 +6,9 @@ import stint import waku/[waku_keystore/protocol_types, waku_rln_relay, waku_rln_relay/protocol_types] -func fromStrToBytesBe*(v: string): seq[byte] = +func fromStrToBytesLe*(v: string): seq[byte] = try: - return @(hexToUint[256](v).toBytesBE()) + return @(hexToUint[256](v).toBytesLE()) except ValueError: # this should never happen return @[] @@ -18,10 +18,10 @@ func defaultIdentityCredential*(): IdentityCredential = return IdentityCredential( idTrapdoor: default(IdentityTrapdoor), idNullifier: default(IdentityNullifier), - idSecretHash: fromStrToBytesBe( + idSecretHash: fromStrToBytesLe( "7984f7c054ad7793d9f31a1e9f29eaa8d05966511e546bced89961eb8874ab9" ), - idCommitment: fromStrToBytesBe( + idCommitment: fromStrToBytesLe( "51c31de3bff7e52dc7b2eb34fc96813bacf38bde92d27fe326ce5d8296322a7" ), ) diff --git a/waku/waku_keystore/protocol_types.nim b/waku/waku_keystore/protocol_types.nim index abea5e2cd..6cfc2f183 100644 --- a/waku/waku_keystore/protocol_types.nim +++ b/waku/waku_keystore/protocol_types.nim @@ -26,11 +26,11 @@ type IdentityCredential* = object idCommitment*: IDCommitment proc toUInt256*(idCommitment: IDCommitment): UInt256 = - let pk = UInt256.fromBytesBE(idCommitment) + let pk = UInt256.fromBytesLE(idCommitment) return pk proc toIDCommitment*(idCommitmentUint: UInt256): IDCommitment = - let pk = IDCommitment(@(idCommitmentUint.toBytesBE())) + let pk = IDCommitment(@(idCommitmentUint.toBytesLE())) return pk type MembershipIndex* = uint @@ -53,16 +53,16 @@ proc toIdentityCredentials*( try: let idTrapdoor = IdentityTrapdoor( - @(hexToUint[CredentialByteSize](groupKeys[i][0]).toBytesBE()) + @(hexToUint[CredentialByteSize](groupKeys[i][0]).toBytesLE()) ) idNullifier = IdentityNullifier( - @(hexToUint[CredentialByteSize](groupKeys[i][1]).toBytesBE()) + @(hexToUint[CredentialByteSize](groupKeys[i][1]).toBytesLE()) ) idSecretHash = IdentitySecretHash( - @(hexToUint[CredentialByteSize](groupKeys[i][2]).toBytesBE()) + @(hexToUint[CredentialByteSize](groupKeys[i][2]).toBytesLE()) ) idCommitment = - IDCommitment(@(hexToUint[CredentialByteSize](groupKeys[i][3]).toBytesBE())) + IDCommitment(@(hexToUint[CredentialByteSize](groupKeys[i][3]).toBytesLE())) groupIdCredentials.add( IdentityCredential( idTrapdoor: idTrapdoor,