Skip to content

Commit 6024536

Browse files
committed
fix: adjust on chain payload key definition order
Key ordering must match exactly what nilauth expects otherwise it results in diffent digests. See NillionNetwork/nilauth#50.
1 parent 49e18a9 commit 6024536

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/services/nilauth/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,11 @@ export class NilauthClient {
274274
const costUnil = await this.subscriptionCost(blindModule);
275275
const payerDid = payerKeypair.toDid("key");
276276

277+
// Key ordering must match what nilauth expects we need to do canonical Json serialization
278+
// to resolve this see - https://github.com/NillionNetwork/nilauth/issues/50
277279
const onChainPayload = {
278-
nonce: bytesToHex(randomBytes(16)),
279280
service_public_key: this.nilauthPublicKey,
281+
nonce: bytesToHex(randomBytes(16)),
280282
blind_module: blindModule,
281283
payer_did: Did.serialize(payerDid),
282284
subscriber_did: Did.serialize(subscriberDid),

0 commit comments

Comments
 (0)