Skip to content

Commit 56b3e76

Browse files
committed
fix(attestation): different challenge was used.
1 parent 3557d33 commit 56b3e76

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.1",
44
"license": "MIT",
55
"scripts": {
6-
"reset": "bun unlink-all && rimraf dist node_modules doc tmp yarn-error.log yarn.lock package-lock.json bun.lockb learn-debug.log tmp .nx lit-auth-storage pkp-tokens lit-auth-local",
6+
"reset": "bun unlink-all && rimraf dist node_modules doc tmp yarn-error.log yarn.lock package-lock.json bun.lockb learn-debug.log tmp .nx lit-auth-storage pkp-tokens lit-auth-local ./e2e/dist ./e2e/node_modules",
77
"go": "bun run build && bun link-all",
88
"build": "bun unlink-all && bun scripts/auto-fix-deps.mjs && nx run-many --parallel=false --target=build --all --exclude=wrapped-keys,wrapped-keys-lit-actions",
99
"build:affected": "bun scripts/auto-fix-deps.mjs && nx affected --target=build --exclude=wrapped-keys,wrapped-keys-lit-actions",

packages/lit-client/src/lib/LitClient/orchestrateHandshake.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ export const orchestrateHandshake = async (params: {
7171
endpoint: params.endpoints.HANDSHAKE,
7272
});
7373

74+
// Create the challenge once and use it for both handshake request and attestation verification
75+
const challenge = createRandomHexString(64);
76+
7477
const _data = {
7578
fullPath: fullPath,
7679
data: {
7780
clientPublicKey: 'test',
78-
challenge: createRandomHexString(64),
81+
challenge: challenge,
7982
},
8083
requestId: requestId,
8184
epoch: params.currentEpoch,
@@ -111,8 +114,6 @@ export const orchestrateHandshake = async (params: {
111114

112115
// 2. Process the response (verify attestation etc.)
113116
if (params.requiredAttestation) {
114-
const challenge = createRandomHexString(64);
115-
116117
if (!retrievedServerKeys.attestation) {
117118
throw new InvalidNodeAttestation(
118119
{},
@@ -121,6 +122,7 @@ export const orchestrateHandshake = async (params: {
121122
}
122123

123124
// Verify the attestation by checking the signature against AMD certs
125+
// Use the same challenge that was sent to the node
124126
try {
125127
const releaseVerificationFn =
126128
params.networkModule?.getVerifyReleaseId?.();

packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ const networkModuleObject = {
287287
id: 'naga',
288288
version: `${version}-naga-staging`,
289289
config: {
290-
requiredAttestation: false,
290+
requiredAttestation: true,
291291
abortTimeout: 20_000,
292292
minimumThreshold: networkConfig.minimumThreshold,
293293
httpProtocol: networkConfig.httpProtocol,

0 commit comments

Comments
 (0)