mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-03 06:23:10 +00:00
Revert keystore credentials back to using LE
This commit is contained in:
parent
bd18fc403f
commit
78239b4e99
@ -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"
|
||||
),
|
||||
)
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user