idkit-core
Version:
The identity SDK. Privacy-preserving identity and proof of personhood with World ID.
22 lines (19 loc) • 1.12 kB
TypeScript
import { A as AbiEncodedValue, I as IDKitConfig } from '../config-fuwC_Hia.js';
import { Bytes } from 'ox';
interface HashFunctionOutput {
hash: bigint;
digest: `0x${string}`;
}
/**
* Hashes an input using the `keccak256` hashing function used across the World ID protocol, to be used as
* a ZKP input. The function will try to determine the best hashing mechanism, if the string already looks like hex-encoded
* bytes (e.g. `0x0000000000000000000000000000000000000000`), it will be hashed directly.
* @param input Any string, hex-like string, bytes represented as a hex string.
* @returns
*/
declare function hashToField(input: Bytes.Bytes | string): HashFunctionOutput;
declare function packAndEncode(input: [string, unknown][]): HashFunctionOutput;
declare const solidityEncode: (types: string[], values: unknown[]) => AbiEncodedValue;
declare const generateSignal: (signal: IDKitConfig['signal']) => HashFunctionOutput;
declare const encodeAction: (action: IDKitConfig['action']) => string;
export { type HashFunctionOutput, encodeAction, generateSignal, hashToField, packAndEncode, solidityEncode };