/** * Delegation Credential Issuer (Platform-Agnostic) * * Issues W3C Verifiable Credentials for delegations with Ed25519 signatures. * Follows the Python POC design (Delegation-Service.md:136-163) where * delegations are issued AS W3C VCs. * * Related Spec: MCP-I §4.1, §4.2, W3C VC Data Model 1.1 * Python Reference: Delegation-Service.md */ import type { DelegationCredential, DelegationRecord, CredentialStatus, Proof } from '@kya-os/contracts'; /** * Options for issuing a delegation credential */ export interface IssueDelegationOptions { /** VC ID (optional, will be generated if not provided) */ id?: string; /** Issuance date (optional, defaults to now) */ issuanceDate?: string; /** Expiration date (optional, derived from constraints if not provided) */ expirationDate?: string; /** Credential status for StatusList2021 (optional) */ credentialStatus?: CredentialStatus; /** Additional context URIs (optional) */ additionalContexts?: string[]; } /** * Signing function interface * * Platform-specific implementations provide this function to sign VCs. * For example: * - Node.js: Uses jose library with importPKCS8 * - Cloudflare: Uses Web Crypto API */ export interface VCSigningFunction { /** * Sign a canonicalized VC * * @param canonicalVC - The canonical JSON string to sign * @param issuerDid - The DID of the issuer * @param kid - The key ID * @returns Ed25519Signature2020 proof */ (canonicalVC: string, issuerDid: string, kid: string): Promise; } /** * Identity provider interface * * Platform-specific implementations provide identity details. */ export interface IdentityProvider { /** Get the DID of this identity */ getDid(): string; /** Get the key ID of this identity */ getKeyId(): string; /** Get the private key (base64 encoded) */ getPrivateKey(): string; } /** * Delegation Credential Issuer (Platform-Agnostic) * * Issues W3C Verifiable Credentials for delegations. * Per Python POC (Delegation-Service.md:136-146): * - Every delegation MUST be issued as a VC * - VC is signed with Ed25519 (Ed25519Signature2020) * - StatusList2021 support for efficient revocation */ export declare class DelegationCredentialIssuer { private identity; private signingFunction; constructor(identity: IdentityProvider, signingFunction: VCSigningFunction); /** * Issue a delegation credential * * Creates a W3C Verifiable Credential from a delegation record. * Signs it with Ed25519 and returns the complete DelegationCredential. * * @param delegation - The delegation record to issue as a VC * @param options - Issuance options * @returns Signed DelegationCredential */ issueDelegationCredential(delegation: DelegationRecord, options?: IssueDelegationOptions): Promise; /** * Create a delegation record and issue it as a VC in one step * * Convenience method for creating a new delegation from scratch. * * @param params - Delegation parameters * @param options - Issuance options * @returns Signed DelegationCredential */ createAndIssueDelegation(params: { id: string; issuerDid: string; subjectDid: string; controller?: string; parentId?: string; constraints: DelegationRecord['constraints']; status?: DelegationRecord['status']; metadata?: Record; }, options?: IssueDelegationOptions): Promise; /** * Canonicalize VC for signing * * Uses JCS (JSON Canonicalization Scheme, RFC 8785) to create * a deterministic representation of the VC. * * @param vc - The unsigned VC * @returns Canonical JSON string */ private canonicalizeVC; /** * Get issuer DID * * @returns The DID of this issuer */ getIssuerDid(): string; /** * Get issuer key ID * * @returns The key ID of this issuer */ getIssuerKeyId(): string; } /** * Create a delegation credential issuer * * Convenience factory function. * * @param identity - Identity provider * @param signingFunction - Platform-specific signing function * @returns DelegationCredentialIssuer instance */ export declare function createDelegationIssuer(identity: IdentityProvider, signingFunction: VCSigningFunction): DelegationCredentialIssuer; //# sourceMappingURL=vc-issuer.d.ts.map