Skip to content

Commit

Permalink
Validate service when adding server key.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonfancher committed Feb 7, 2025
1 parent 345c58b commit 9f51570
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions services/user/XAdmin/ui/src/hooks/useKeyDevices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export const useAddServerKey = () =>
const result = await chain.addServerKey({
device,
});

const service = result[0].service;
if (service !== "verify-sig") {
throw new Error(`Unexpected service: ${service}"`);
}

const der = result[0].rawData;
const publicKey = await hexDERPublicKeyToCryptoKey(der);
return publicKey;
Expand Down

0 comments on commit 9f51570

Please sign in to comment.