forked from tornado-packages/noble-curves
fix: validate hash_to_field DST as stringOrUint8Array (closes #57)
This commit is contained in:
parent
62e806cfaf
commit
bf70ba9776
@ -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',
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user