zkc-core
Version:
Work with Zero-Knowledge Credentials
43 lines (42 loc) • 1.71 kB
TypeScript
import { AttributeSchema, Proof, SignSchema, ZkcID, ZkCred } from "../types/index.js";
type ZkcAttributes = ZkCred["attributes"];
type ZkcSignAttributes = ZkCred["proofs"][number]["signature"];
export type Selector = {
proof: {
id?: string;
type?: string;
issuer?: {
id: ZkcID;
};
index?: number;
};
schema?: string;
};
export declare class Preparator {
private readonly graph;
extendGraph: (nodes: import("./graph.js").GraphNode[], links: import("./graph.js").GraphLink[]) => void;
transform: <TOut = any, TIn = any>(value: TIn, links: string[]) => TOut;
sort: typeof sortAttributes;
getPreparedAttributes<TOut extends any[] = any[], TCred extends ZkCred = ZkCred>(cred: TCred, selector?: Selector): TOut;
prepareAttributes<TOut extends any[] = any[], TAtr extends ZkCred["attributes"] = ZkCred["attributes"]>(args: {
attributes: TAtr;
attributesSchema: AttributeSchema;
}): TOut;
getPreparedSign<TOut extends any[] = any[], TCred extends ZkCred = ZkCred>(cred: TCred, selector?: Selector): TOut;
prepareSign<TOut extends any[] = any[], TSign extends ZkcSignAttributes = ZkcSignAttributes>(args: {
signAttributes: TSign;
signSchema: SignSchema;
}): TOut;
selectProof(cred: ZkCred, selector?: Selector): {
proof: Proof;
attributeSchema: AttributeSchema;
signSchema: SignSchema;
};
}
type PathValue = {
path: string[];
value: any;
};
export declare function toPathValueList(obj: Record<string, any>): PathValue[];
declare function sortAttributes<T extends (ZkcAttributes | AttributeSchema) = ZkcAttributes>(credential: T): T;
export {};