mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 16:33:08 +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
|
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 fromStrToBytesBe*(v: string): seq[byte] =
|
func fromStrToBytesLe*(v: string): seq[byte] =
|
||||||
try:
|
try:
|
||||||
return @(hexToUint[256](v).toBytesBE())
|
return @(hexToUint[256](v).toBytesLE())
|
||||||
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: fromStrToBytesBe(
|
idSecretHash: fromStrToBytesLe(
|
||||||
"7984f7c054ad7793d9f31a1e9f29eaa8d05966511e546bced89961eb8874ab9"
|
"7984f7c054ad7793d9f31a1e9f29eaa8d05966511e546bced89961eb8874ab9"
|
||||||
),
|
),
|
||||||
idCommitment: fromStrToBytesBe(
|
idCommitment: fromStrToBytesLe(
|
||||||
"51c31de3bff7e52dc7b2eb34fc96813bacf38bde92d27fe326ce5d8296322a7"
|
"51c31de3bff7e52dc7b2eb34fc96813bacf38bde92d27fe326ce5d8296322a7"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -26,11 +26,11 @@ type IdentityCredential* = object
|
|||||||
idCommitment*: IDCommitment
|
idCommitment*: IDCommitment
|
||||||
|
|
||||||
proc toUInt256*(idCommitment: IDCommitment): UInt256 =
|
proc toUInt256*(idCommitment: IDCommitment): UInt256 =
|
||||||
let pk = UInt256.fromBytesBE(idCommitment)
|
let pk = UInt256.fromBytesLE(idCommitment)
|
||||||
return pk
|
return pk
|
||||||
|
|
||||||
proc toIDCommitment*(idCommitmentUint: UInt256): IDCommitment =
|
proc toIDCommitment*(idCommitmentUint: UInt256): IDCommitment =
|
||||||
let pk = IDCommitment(@(idCommitmentUint.toBytesBE()))
|
let pk = IDCommitment(@(idCommitmentUint.toBytesLE()))
|
||||||
return pk
|
return pk
|
||||||
|
|
||||||
type MembershipIndex* = uint
|
type MembershipIndex* = uint
|
||||||
@ -53,16 +53,16 @@ proc toIdentityCredentials*(
|
|||||||
try:
|
try:
|
||||||
let
|
let
|
||||||
idTrapdoor = IdentityTrapdoor(
|
idTrapdoor = IdentityTrapdoor(
|
||||||
@(hexToUint[CredentialByteSize](groupKeys[i][0]).toBytesBE())
|
@(hexToUint[CredentialByteSize](groupKeys[i][0]).toBytesLE())
|
||||||
)
|
)
|
||||||
idNullifier = IdentityNullifier(
|
idNullifier = IdentityNullifier(
|
||||||
@(hexToUint[CredentialByteSize](groupKeys[i][1]).toBytesBE())
|
@(hexToUint[CredentialByteSize](groupKeys[i][1]).toBytesLE())
|
||||||
)
|
)
|
||||||
idSecretHash = IdentitySecretHash(
|
idSecretHash = IdentitySecretHash(
|
||||||
@(hexToUint[CredentialByteSize](groupKeys[i][2]).toBytesBE())
|
@(hexToUint[CredentialByteSize](groupKeys[i][2]).toBytesLE())
|
||||||
)
|
)
|
||||||
idCommitment =
|
idCommitment =
|
||||||
IDCommitment(@(hexToUint[CredentialByteSize](groupKeys[i][3]).toBytesBE()))
|
IDCommitment(@(hexToUint[CredentialByteSize](groupKeys[i][3]).toBytesLE()))
|
||||||
groupIdCredentials.add(
|
groupIdCredentials.add(
|
||||||
IdentityCredential(
|
IdentityCredential(
|
||||||
idTrapdoor: idTrapdoor,
|
idTrapdoor: idTrapdoor,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user