Skip to content

Commit f9e27ff

Browse files
committed
fix(kms): preserve unprefixed auth measurements
1 parent 4b0c914 commit f9e27ff

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

dstack/kms/auth-eth-bun/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import { createPublicClient, http, type Address, type Hex } from 'viem';
1010
// zod schemas for validation - compatible with original fastify implementation
1111
const boundedHex = (bytes: number, description: string) =>
1212
z.string()
13-
.regex(/^0x[0-9a-fA-F]*$/, `${description} must be hexadecimal`)
14-
.max(2 + bytes * 2, `${description} exceeds ${bytes} bytes`);
13+
.regex(/^(?:0x)?[0-9a-fA-F]*$/, `${description} must be hexadecimal`)
14+
.refine(
15+
(value) => value.replace(/^0x/, '').length <= bytes * 2,
16+
`${description} exceeds ${bytes} bytes`,
17+
);
1518

1619
const BootInfoSchema = z.object({
1720
// Short hexadecimal values remain compatible with the original backend,

0 commit comments

Comments
 (0)