atp-sdk
Version:
Official TypeScript SDK for Agent Trust Protocol™ - Build secure, verifiable, and trustworthy applications with decentralized identity, verifiable credentials, payment protocols (AP2/ACP), and robust access control
71 lines • 2.59 kB
JavaScript
// Core types for ATP™ SDK
// =============================================================================
// ZKP (Zero-Knowledge Proof) Types for Agent-to-Agent Authentication
// =============================================================================
/**
* Types of zero-knowledge proofs supported by ATP
*/
export var ZKProofType;
(function (ZKProofType) {
/** Prove trust score meets a threshold without revealing exact score */
ZKProofType["TRUST_LEVEL"] = "trust_level";
/** Prove possession of a valid credential without revealing details */
ZKProofType["CREDENTIAL"] = "credential";
/** Prove identity as a registered ATP agent */
ZKProofType["IDENTITY"] = "identity";
/** Prove ability to perform an action */
ZKProofType["CAPABILITY"] = "capability";
/** Prove a value is within a range */
ZKProofType["RANGE"] = "range";
/** Prove membership in a set */
ZKProofType["MEMBERSHIP"] = "membership";
/** Prove behavioral compliance (unique ATP differentiator) */
ZKProofType["BEHAVIOR"] = "behavior";
})(ZKProofType || (ZKProofType = {}));
// Error types
export class ATPError extends Error {
constructor(message, code, statusCode, details) {
super(message);
this.code = code;
this.statusCode = statusCode;
this.details = details;
this.name = 'ATPError';
}
}
export class ATPNetworkError extends ATPError {
constructor(message, cause) {
super(message, 'NETWORK_ERROR');
this.cause = cause;
this.name = 'ATPNetworkError';
}
}
export class ATPAuthenticationError extends ATPError {
constructor(message = 'Authentication failed') {
super(message, 'AUTH_ERROR', 401);
this.name = 'ATPAuthenticationError';
}
}
export class ATPAuthorizationError extends ATPError {
constructor(message = 'Authorization failed') {
super(message, 'AUTHZ_ERROR', 403);
this.name = 'ATPAuthorizationError';
}
}
export class ATPValidationError extends ATPError {
constructor(message, validationErrors, field, value) {
super(message, 'VALIDATION_ERROR', 400);
this.validationErrors = validationErrors;
this.field = field;
this.value = value;
this.name = 'ATPValidationError';
}
}
export class ATPServiceError extends ATPError {
constructor(message, service, operation) {
super(message, 'SERVICE_ERROR', 500);
this.service = service;
this.operation = operation;
this.name = 'ATPServiceError';
}
}
//# sourceMappingURL=types.js.map