UNPKG

@reclaimprotocol/attestor-core

Version:

<div> <div> <img src="https://raw.githubusercontent.com/reclaimprotocol/.github/main/assets/banners/Attestor-Core.png" /> </div> </div>

30 lines (29 loc) 1.34 kB
import type { IncomingMessage } from 'http'; import type { ServiceSignatureType } from '../../proto/api.ts'; /** * Sign message using the PRIVATE_KEY env var. */ export declare function signAsAttestor(data: Uint8Array | string, scheme: ServiceSignatureType): import("../../index.ts").Awaitable<Uint8Array<ArrayBufferLike>>; /** * Obtain the address on chain, from the PRIVATE_KEY env var. */ export declare function getAttestorAddress(scheme: ServiceSignatureType): string; /** * Nice parse JSON with a key. * If the data is empty, returns an empty object. * And if the JSON is invalid, throws a bad request error, * with the key in the error message. */ export declare function niceParseJsonObject(data: string, key: string): any; /** * Extract any initial messages sent via the query string, * in the `messages` parameter. */ export declare function getInitialMessagesFromQuery(req: IncomingMessage): import("../../proto/api.ts").RPCMessage[]; export declare function getPublicAddresses(host: string): Promise<string[]>; /** * Match a host against a whitelist pattern. Patterns may be an exact * hostname or a leading-wildcard form like `*.example.com`, which matches * the apex and any subdomain depth. Comparison is case-insensitive. */ export declare function matchesHostPattern(pattern: string, host: string): boolean;