/** * Delegation Utilities * * Shared utility functions for delegation credential operations. * Following DRY (Don't Repeat Yourself) principle. */ /** * JSON canonicalization (RFC 8785) * * Creates a deterministic representation of JSON for signing. * Per W3C VC spec, canonicalization ensures identical VCs produce identical signatures. * * DRY: Single implementation shared across vc-issuer and statuslist-manager. * * @param obj - The object to canonicalize * @returns Canonical JSON string */ export declare function canonicalizeJSON(obj: any): string; /** * JWT Header for EdDSA (Ed25519) signed credentials * * W3C VC-JWT spec recommends 'vc+jwt' for typ, but 'JWT' is also valid. * Both are accepted for compatibility with different implementations. */ export interface VCJWTHeader { alg: 'EdDSA'; typ: 'JWT' | 'vc+jwt'; kid?: string; } /** * VC-JWT Payload structure * * Per W3C VC-JWT spec, the VC is embedded in the JWT claims. * Standard claims (iss, sub, aud, exp, iat, jti) are derived from the VC. */ export interface VCJWTPayload { /** Issuer DID (from vc.issuer) */ iss: string; /** Subject DID (from vc.credentialSubject.id) */ sub?: string; /** Audience (e.g., project ID the credential is scoped to). Per RFC 7519, can be string or array. */ aud?: string | string[]; /** Expiration time (from vc.expirationDate / validUntil) */ exp?: number; /** Not-before time (RFC 7519 nbf; maps to vc.validFrom) */ nbf?: number; /** Issued at time (from vc.issuanceDate) */ iat?: number; /** JWT ID (from vc.id) */ jti?: string; /** The complete VC (without proof) */ vc: Record; } /** * Options for encoding a VC as JWT */ export interface EncodeVCAsJWTOptions { /** Key ID for the JWT header */ keyId?: string; } /** * Create unsigned JWT parts (header + payload) for a VC * * Prepares the VC for signing by extracting standard claims and * encoding the header and payload as base64url strings. * * @param vc - The Verifiable Credential (without proof) * @param options - Encoding options * @returns Object with encoded parts and signing input */ export declare function createUnsignedVCJWT(vc: Record, options?: EncodeVCAsJWTOptions): { header: VCJWTHeader; payload: VCJWTPayload; encodedHeader: string; encodedPayload: string; signingInput: string; }; /** * Complete a JWT with a signature * * Takes the signing input and a base64url-encoded signature to create the final JWT. * * @param signingInput - The header.payload string that was signed * @param signature - Base64url-encoded signature * @returns Complete JWT string (header.payload.signature) */ export declare function completeVCJWT(signingInput: string, signature: string): string; /** * Parse a VC-JWT and extract the VC * * Does NOT verify the signature - use with a verification function. * * @param jwt - The JWT string * @returns Parsed JWT parts */ export declare function parseVCJWT(jwt: string): { header: VCJWTHeader; payload: VCJWTPayload; signature: string; signingInput: string; } | null; //# sourceMappingURL=utils.d.ts.map