@reclaimprotocol/attestor-core
Version:
<div> <div> <img src="https://raw.githubusercontent.com/reclaimprotocol/.github/main/assets/banners/Attestor-Core.png" /> </div> </div>
157 lines (156 loc) • 6.35 kB
TypeScript
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export declare const protobufPackage = "teeproto";
/** Signature wrapper used everywhere */
export declare const BodyType: {
readonly BODY_TYPE_UNSPECIFIED: 0;
readonly BODY_TYPE_K_OUTPUT: 1;
readonly BODY_TYPE_T_OUTPUT: 2;
readonly UNRECOGNIZED: -1;
};
export type BodyType = typeof BodyType[keyof typeof BodyType];
export declare namespace BodyType {
type BODY_TYPE_UNSPECIFIED = typeof BodyType.BODY_TYPE_UNSPECIFIED;
type BODY_TYPE_K_OUTPUT = typeof BodyType.BODY_TYPE_K_OUTPUT;
type BODY_TYPE_T_OUTPUT = typeof BodyType.BODY_TYPE_T_OUTPUT;
type UNRECOGNIZED = typeof BodyType.UNRECOGNIZED;
}
export declare function bodyTypeFromJSON(object: any): BodyType;
export declare function bodyTypeToJSON(object: BodyType): string;
/** Common structures */
export interface RequestRedactionRange {
start: number;
length: number;
/** Values: "sensitive" or "sensitive_proof" */
type: string;
}
export interface ResponseRedactionRange {
start: number;
length: number;
}
export interface SignedRedactedDecryptionStream {
redactedStream: Uint8Array;
seqNum: number;
}
/** Certificate information extracted during TLS handshake */
export interface CertificateInfo {
commonName: string;
issuerCommonName: string;
notBeforeUnix: number;
notAfterUnix: number;
dnsNames: string[];
}
/** Handshake secrets disclosed for verification/display */
export interface HandshakeSecrets {
handshakeKey: Uint8Array;
handshakeIv: Uint8Array;
/** uint16 fits here */
cipherSuite: number;
algorithm: string;
}
/** Commitment opening for proof stream */
export interface Opening {
/** Str_SP */
proofStream: Uint8Array;
}
/**
* MPC OPRF output (included in signed TEE payloads)
* Both TEE_K and TEE_T independently compute these values via garbled circuits
*/
export interface OPRFOutput {
/** Position in consolidated TLS stream */
tlsStart: number;
/** Length of data in stream (max 64 bytes) */
tlsLength: number;
/** 32 bytes SHA256(CMAC) - used for replacement */
hashOutput: Uint8Array;
}
export interface KOutputPayload {
/** R_red */
redactedRequest: Uint8Array;
requestRedactionRanges: RequestRedactionRange[];
/** NEW: Single response decryption keystream */
consolidatedResponseKeystream: Uint8Array;
/** NEW: Structured cert data instead of handshake packets */
certificateInfo: CertificateInfo | undefined;
responseRedactionRanges: ResponseRedactionRange[];
/** Unix timestamp in milliseconds when payload was created (SIGNED) */
timestampMs: number;
/** Session binding - cryptographically links TEE_K and TEE_T outputs */
sessionId: string;
/** MPC OPRF outputs (TEE-to-TEE computation) - field 10 to match reclaim-tee */
oprfOutputs: OPRFOutput[];
}
export interface TOutputPayload {
/** NEW: Single consolidated ciphertext instead of individual packets */
consolidatedResponseCiphertext: Uint8Array;
/** R_SP streams signed by TEE_T for cryptographic verification */
requestProofStreams: Uint8Array[];
/** Unix timestamp in milliseconds when payload was created (SIGNED) */
timestampMs: number;
/** Session binding - cryptographically links TEE_K and TEE_T outputs */
sessionId: string;
/** MPC OPRF outputs (TEE-to-TEE computation) - field 10 to match reclaim-tee */
oprfOutputs: OPRFOutput[];
}
/** Attestation report with structured data */
export interface AttestationReport {
/** "nitro" or "gcp" */
type: string;
/** raw provider-specific attestation bytes */
report: Uint8Array;
}
export interface SignedMessage {
bodyType: BodyType;
/** serialized deterministic KOutputPayload or TOutputPayload */
body: Uint8Array;
/** ETH address (20 bytes, standalone mode only) */
ethAddress: Uint8Array;
/** signature over body bytes */
signature: Uint8Array;
/** full attestation (enclave mode only) */
attestationReport: AttestationReport | undefined;
}
/** OPRF verification data for a single hashed range */
export interface OPRFVerificationData {
/** Position in the consolidated TLS stream */
streamPos: number;
/** Length of data in the stream */
streamLength: number;
/** ZK proof and public parameters */
publicSignalsJson: Uint8Array;
}
/** Single artefact produced by client for offline verification */
export interface VerificationBundle {
/** Signed transcripts */
teekSigned: SignedMessage | undefined;
/** BODY_TYPE_T_OUTPUT */
teetSigned: SignedMessage | undefined;
/** OPRF verification data for hashed ranges */
oprfVerifications: OPRFVerificationData[];
}
export declare const RequestRedactionRange: MessageFns<RequestRedactionRange>;
export declare const ResponseRedactionRange: MessageFns<ResponseRedactionRange>;
export declare const SignedRedactedDecryptionStream: MessageFns<SignedRedactedDecryptionStream>;
export declare const CertificateInfo: MessageFns<CertificateInfo>;
export declare const HandshakeSecrets: MessageFns<HandshakeSecrets>;
export declare const Opening: MessageFns<Opening>;
export declare const OPRFOutput: MessageFns<OPRFOutput>;
export declare const KOutputPayload: MessageFns<KOutputPayload>;
export declare const TOutputPayload: MessageFns<TOutputPayload>;
export declare const AttestationReport: MessageFns<AttestationReport>;
export declare const SignedMessage: MessageFns<SignedMessage>;
export declare const OPRFVerificationData: MessageFns<OPRFVerificationData>;
export declare const VerificationBundle: MessageFns<VerificationBundle>;
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
[K in keyof T]?: DeepPartial<T[K]>;
} : Partial<T>;
export interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create(base?: DeepPartial<T>): T;
fromPartial(object: DeepPartial<T>): T;
}
export {};