diff --git a/src/abstract/hash-to-curve.ts b/src/abstract/hash-to-curve.ts index 38d31d4..24d472b 100644 --- a/src/abstract/hash-to-curve.ts +++ b/src/abstract/hash-to-curve.ts @@ -127,7 +127,7 @@ export function expand_message_xof( */ export function hash_to_field(msg: Uint8Array, count: number, options: Opts): bigint[][] { validateObject(options, { - DST: 'string', + DST: 'stringOrUint8Array', p: 'bigint', m: 'isSafeInteger', k: 'isSafeInteger', diff --git a/src/abstract/utils.ts b/src/abstract/utils.ts index 00fc18f..fa3b6bc 100644 --- a/src/abstract/utils.ts +++ b/src/abstract/utils.ts @@ -246,6 +246,7 @@ const validatorFns = { function: (val: any) => typeof val === 'function', boolean: (val: any) => typeof val === 'boolean', string: (val: any) => typeof val === 'string', + stringOrUint8Array: (val: any) => typeof val === 'string' || val instanceof Uint8Array, isSafeInteger: (val: any) => Number.isSafeInteger(val), array: (val: any) => Array.isArray(val), field: (val: any, object: any) => (object as any).Fp.isValid(val),