@primethoughts/credence-sdk 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +166 -0
- package/dist/index.cjs +1112 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1404 -0
- package/dist/index.d.ts +1404 -0
- package/dist/index.js +1068 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils/correlation.ts","../src/errors.ts","../src/http/retry.ts","../src/http/interceptors.ts","../src/http/http-client.ts","../src/types/common.ts","../src/modules/identity.ts","../src/modules/messaging.ts","../src/modules/credentials.ts","../src/modules/presentations.ts","../src/modules/registry-admin.ts","../src/modules/registry.ts","../src/modules/compliance.ts","../src/modules/evidence.ts","../src/modules/vdr.ts","../src/modules/oid4vci.ts","../src/modules/payment.ts","../src/client.ts","../src/validation.ts"],"sourcesContent":["/**\n * @primethoughts/credence-sdk — TypeScript SDK for Credence Trust OS.\n *\n * Provides typed access to all 82 gateway endpoints across 8 service modules:\n * Identity, Messaging, Credentials, Presentations, Registry, Compliance, Evidence, and VDR.\n *\n * @example\n * ```typescript\n * import { CredenceClient } from '@primethoughts/credence-sdk';\n *\n * const credence = new CredenceClient({\n * baseUrl: 'https://gateway.credence.example:8080',\n * auth: { type: 'jwt', token: jwtToken },\n * });\n *\n * const frameworks = await credence.registry.listFrameworks();\n * ```\n *\n * @packageDocumentation\n */\n\n// --- Client ---\nexport { CredenceClient, type CredenceClientConfig } from './client.js';\n\n// --- Errors ---\nexport {\n CredenceError,\n CredenceApiError,\n CredenceAuthError,\n CredenceAuthorizationError,\n CredenceNetworkError,\n CredenceValidationError,\n} from './errors.js';\n\n// --- Validation utilities ---\nexport { validateDid, validateRequired, isKeyMaterial, rejectKeyMaterial } from './validation.js';\n\n// --- HTTP layer (for advanced customization) ---\nexport { HttpClient, type HttpClientConfig } from './http/http-client.js';\nexport { type RetryConfig, DEFAULT_RETRY_CONFIG } from './http/retry.js';\nexport { type RequestInterceptor, type ResponseInterceptor, type RequestInfo, type ResponseInfo } from './http/interceptors.js';\n\n// --- Modules ---\nexport { IdentityModule } from './modules/identity.js';\nexport { MessagingModule } from './modules/messaging.js';\nexport { CredentialsModule } from './modules/credentials.js';\nexport { PresentationsModule } from './modules/presentations.js';\nexport { RegistryModule } from './modules/registry.js';\nexport { RegistryAdminModule } from './modules/registry-admin.js';\nexport { ComplianceModule } from './modules/compliance.js';\nexport { EvidenceModule } from './modules/evidence.js';\nexport { VdrModule } from './modules/vdr.js';\nexport { Oid4vciModule } from './modules/oid4vci.js';\nexport { PaymentModule } from './modules/payment.js';\n\n// --- Types: Common ---\nexport { type Page, type PageParams, toQueryParams } from './types/common.js';\n\n// --- Types: Auth ---\nexport type {\n RegisterRequest,\n LoginRequest,\n ForgotPasswordRequest,\n ResetPasswordRequest,\n AuthResponse,\n} from './types/auth.js';\n\n// --- Types: Identity ---\nexport type {\n TenantCreateRequest,\n TenantResponse,\n TenantDetailResponse,\n} from './types/tenant.js';\n\n// --- Types: Messaging ---\nexport type {\n ConnectionCreateRequest,\n AcceptInvitationRequest,\n ConnectionResponse,\n} from './types/connection.js';\n\n// --- Types: Credentials ---\nexport type {\n CredentialCreateRequest,\n CredentialResponse,\n CredentialDetailResponse,\n VerificationRequest,\n VerificationV2Request,\n VerificationCheck,\n VerificationResult,\n} from './types/credential.js';\n\n// --- Types: Presentations ---\nexport type {\n PresentationCreateRequest,\n PresentationExchangeResponse,\n PresentationDetailExchangeResponse,\n Oid4vpAuthorizeRequest,\n PrerequisiteEntry,\n PrerequisiteStatusResponse,\n} from './types/presentation.js';\n\n// --- Types: Registry ---\nexport type {\n FrameworkResponse,\n FrameworkCreateRequest,\n FrameworkUpdateRequest,\n FrameworkStatus,\n IssuerResponse,\n IssuerCreateRequest,\n IssuerQueryParams,\n SchemaCreateRequest,\n SchemaResponse,\n PolicyCreateRequest,\n PolicyResponse,\n StatusListResponse,\n GovernanceVcStatus,\n GovernanceVcResponse,\n GovernanceVcDetailResponse,\n GovernanceVcCreateRequest,\n GovernanceVcQueryParams,\n GovernanceVcAuditEntry,\n AnchorRequest,\n} from './types/registry.js';\n\n// --- Types: Compliance ---\nexport type {\n ComplianceDecision,\n ComplianceCheckRequest,\n ComplianceCheckResponse,\n AuditCreateRequest,\n AuditResponse,\n RuleCreateRequest,\n RuleResponse,\n} from './types/compliance.js';\n\n// --- Types: Evidence ---\nexport type {\n EvidenceResponse,\n EvidenceDetailResponse,\n EvidenceVerificationResult,\n EvidenceQueryParams,\n EvidenceShareRequest,\n} from './types/evidence.js';\n\n// --- Types: OID4VCI ---\nexport type {\n CredentialOfferRequest,\n CredentialOfferResponse,\n IssuerMetadata,\n TokenExchangeRequest,\n TokenExchangeResponse,\n CredentialIssuanceRequest,\n CredentialIssuanceResponse,\n} from './types/oid4vci.js';\n\n// --- Types: Payment ---\nexport type {\n PaymentCreateRequest,\n PaymentResponse,\n PaymentDetailResponse,\n PaymentState,\n} from './types/payment.js';\n\n// --- Types: Citizen ---\nexport type {\n CitizenRegisterRequest,\n Fido2RegistrationOptions,\n Fido2RegistrationResponse,\n Fido2LoginRequest,\n Fido2LoginOptions,\n Fido2LoginResponse,\n} from './types/citizen.js';\n\n// --- Types: VDR ---\nexport type {\n VdrSchema,\n VdrSchemaWriteRequest,\n VdrCredentialDefinition,\n VdrCredDefWriteRequest,\n VdrRevocationRegistry,\n VdrRevRegCreateRequest,\n WalletDid,\n NymWriteRequest,\n} from './types/vdr.js';\n","/**\n * Generates a UUID v4 correlation ID for request tracing.\n *\n * Uses `globalThis.crypto.randomUUID()` which is available in:\n * - Node.js 19+ (global Web Crypto API)\n * - All modern browsers (Web Crypto API)\n *\n * Falls back to `crypto` module for older Node.js versions.\n */\nexport function generateCorrelationId(): string {\n if (typeof globalThis !== 'undefined' && globalThis.crypto?.randomUUID) {\n return globalThis.crypto.randomUUID();\n }\n // Fallback for Node.js < 19 (dynamic import avoids bundler issues)\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return (require('crypto') as { randomUUID: () => string }).randomUUID();\n}\n","/**\n * Base error for all Credence SDK errors.\n */\nexport class CredenceError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CredenceError';\n }\n}\n\n/**\n * Error from the Credence API following RFC 7807 ProblemDetail format.\n * [KB:14-learnings-v1-v2]\n */\nexport class CredenceApiError extends CredenceError {\n readonly status: number;\n readonly title: string;\n readonly detail: string | null;\n readonly type: string | null;\n readonly instance: string | null;\n readonly correlationId: string | null;\n readonly method: string;\n readonly path: string;\n\n constructor(params: {\n status: number;\n title: string;\n detail?: string | null;\n type?: string | null;\n instance?: string | null;\n correlationId?: string | null;\n method: string;\n path: string;\n }) {\n const msg = `${params.method} ${params.path} failed with ${params.status}: ${params.title}${params.detail ? ` — ${params.detail}` : ''}${params.correlationId ? ` [correlationId=${params.correlationId}]` : ''}`;\n super(msg);\n this.name = 'CredenceApiError';\n this.status = params.status;\n this.title = params.title;\n this.detail = params.detail ?? null;\n this.type = params.type ?? null;\n this.instance = params.instance ?? null;\n this.correlationId = params.correlationId ?? null;\n this.method = params.method;\n this.path = params.path;\n }\n}\n\n/**\n * Authentication error (HTTP 401).\n */\nexport class CredenceAuthError extends CredenceApiError {\n constructor(params: { method: string; path: string; correlationId?: string | null }) {\n super({\n status: 401,\n title: 'Unauthorized',\n detail: 'Authentication required or token expired',\n method: params.method,\n path: params.path,\n correlationId: params.correlationId,\n });\n this.name = 'CredenceAuthError';\n }\n}\n\n/**\n * Authorization error (HTTP 403).\n */\nexport class CredenceAuthorizationError extends CredenceApiError {\n constructor(params: { method: string; path: string; correlationId?: string | null; detail?: string }) {\n super({\n status: 403,\n title: 'Forbidden',\n detail: params.detail ?? 'Insufficient permissions for this operation',\n method: params.method,\n path: params.path,\n correlationId: params.correlationId,\n });\n this.name = 'CredenceAuthorizationError';\n }\n}\n\n/**\n * Network-level error (connection failure, timeout, DNS).\n */\nexport class CredenceNetworkError extends CredenceError {\n readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'CredenceNetworkError';\n this.cause = cause;\n }\n}\n\n/**\n * Client-side validation error (invalid input before HTTP call).\n */\nexport class CredenceValidationError extends CredenceError {\n readonly field: string;\n\n constructor(field: string, message: string) {\n super(`Validation error on '${field}': ${message}`);\n this.name = 'CredenceValidationError';\n this.field = field;\n }\n}\n","/** Configuration for retry behavior. */\nexport interface RetryConfig {\n maxRetries: number;\n baseDelay: number;\n maxDelay: number;\n}\n\nexport const DEFAULT_RETRY_CONFIG: RetryConfig = {\n maxRetries: 3,\n baseDelay: 1000,\n maxDelay: 30000,\n};\n\n/** HTTP status codes eligible for retry. */\nconst RETRYABLE_STATUS_CODES = new Set([429, 502, 503, 504]);\n\n/** Determines if a response status is retryable. */\nexport function isRetryable(status: number): boolean {\n return RETRYABLE_STATUS_CODES.has(status);\n}\n\n/**\n * Calculates delay with exponential backoff and jitter.\n * @param attempt - Zero-based attempt number\n * @param config - Retry configuration\n * @returns Delay in milliseconds\n */\nexport function calculateDelay(attempt: number, config: RetryConfig): number {\n const exponentialDelay = config.baseDelay * Math.pow(2, attempt);\n const cappedDelay = Math.min(exponentialDelay, config.maxDelay);\n const jitter = cappedDelay * (0.5 + Math.random() * 0.5);\n return Math.floor(jitter);\n}\n\n/** Sleeps for the specified duration. */\nexport function sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","/** Sanitized request info passed to interceptors (no auth headers). */\nexport interface RequestInfo {\n method: string;\n url: string;\n headers: Record<string, string>;\n}\n\n/** Sanitized response info passed to interceptors. */\nexport interface ResponseInfo {\n status: number;\n url: string;\n correlationId: string | null;\n durationMs: number;\n}\n\nexport type RequestInterceptor = (info: RequestInfo) => void | Promise<void>;\nexport type ResponseInterceptor = (info: ResponseInfo) => void | Promise<void>;\n\n/** Manages request and response interceptor chains. */\nexport class InterceptorChain {\n private requestInterceptors: RequestInterceptor[] = [];\n private responseInterceptors: ResponseInterceptor[] = [];\n\n addRequestInterceptor(fn: RequestInterceptor): void {\n this.requestInterceptors.push(fn);\n }\n\n addResponseInterceptor(fn: ResponseInterceptor): void {\n this.responseInterceptors.push(fn);\n }\n\n async onRequest(info: RequestInfo): Promise<void> {\n for (const interceptor of this.requestInterceptors) {\n await interceptor(info);\n }\n }\n\n async onResponse(info: ResponseInfo): Promise<void> {\n for (const interceptor of this.responseInterceptors) {\n await interceptor(info);\n }\n }\n}\n","import { generateCorrelationId } from '../utils/correlation.js';\nimport {\n CredenceApiError,\n CredenceAuthError,\n CredenceAuthorizationError,\n CredenceNetworkError,\n} from '../errors.js';\nimport { type RetryConfig, DEFAULT_RETRY_CONFIG, isRetryable, calculateDelay, sleep } from './retry.js';\nimport { InterceptorChain, type RequestInterceptor, type ResponseInterceptor } from './interceptors.js';\n\n/** Configuration for the HTTP client. */\nexport interface HttpClientConfig {\n baseUrl: string;\n token: string;\n retry?: Partial<RetryConfig>;\n timeout?: number;\n correlationId?: string;\n}\n\n/**\n * Core HTTP client for Credence SDK.\n * Handles auth injection, correlation ID propagation, retries, and error mapping.\n * [KB:08-multi-tenancy#tenant-context-derivation] — Tenant context derived from JWT by server.\n */\nexport class HttpClient {\n private baseUrl: string;\n private token: string;\n private retryConfig: RetryConfig;\n private timeout: number;\n private correlationId: string;\n readonly interceptors: InterceptorChain;\n\n constructor(config: HttpClientConfig) {\n this.baseUrl = config.baseUrl.replace(/\\/+$/, '');\n this.token = config.token;\n this.retryConfig = { ...DEFAULT_RETRY_CONFIG, ...config.retry };\n this.timeout = config.timeout ?? 30000;\n this.correlationId = config.correlationId ?? generateCorrelationId();\n this.interceptors = new InterceptorChain();\n }\n\n /** Updates the JWT token for subsequent requests. */\n setToken(token: string): void {\n this.token = token;\n }\n\n addRequestInterceptor(fn: RequestInterceptor): void {\n this.interceptors.addRequestInterceptor(fn);\n }\n\n addResponseInterceptor(fn: ResponseInterceptor): void {\n this.interceptors.addResponseInterceptor(fn);\n }\n\n /** Performs a GET request. */\n async get<T>(path: string, queryParams?: Record<string, string>): Promise<T> {\n const url = this.buildUrl(path, queryParams);\n return this.executeWithRetry<T>('GET', url);\n }\n\n /** Performs a POST request with JSON body. */\n async post<T>(path: string, body?: unknown): Promise<T> {\n const url = this.buildUrl(path);\n return this.executeWithRetry<T>('POST', url, body);\n }\n\n /** Performs a PUT request with JSON body. */\n async put<T>(path: string, body?: unknown): Promise<T> {\n const url = this.buildUrl(path);\n return this.executeWithRetry<T>('PUT', url, body);\n }\n\n /** Performs a DELETE request. Returns void. */\n async delete(path: string): Promise<void> {\n const url = this.buildUrl(path);\n await this.executeWithRetry<undefined>('DELETE', url);\n }\n\n /** Performs a POST with multipart/form-data (for evidence upload). */\n async upload<T>(path: string, formData: FormData): Promise<T> {\n const url = this.buildUrl(path);\n return this.executeWithRetry<T>('POST', url, formData, true);\n }\n\n /** Performs a POST with application/x-www-form-urlencoded body. */\n async postForm<T>(path: string, body: string): Promise<T> {\n const url = this.buildUrl(path);\n return this.executeWithRetry<T>('POST', url, body, false, 'application/x-www-form-urlencoded');\n }\n\n /** Performs a POST with a custom Bearer token (not the SDK's JWT). */\n async postWithToken<T>(path: string, body: unknown, token: string): Promise<T> {\n const url = this.buildUrl(path);\n return this.executeWithRetry<T>('POST', url, body, false, undefined, token);\n }\n\n private buildUrl(path: string, queryParams?: Record<string, string>): string {\n // When baseUrl is empty (relative URLs in browser), avoid `new URL(path, '')`\n // which throws TypeError. Use current origin or build relative URL directly.\n if (!this.baseUrl) {\n if (!queryParams || Object.keys(queryParams).length === 0) {\n return path;\n }\n const params = new URLSearchParams(queryParams).toString();\n return `${path}?${params}`;\n }\n const url = new URL(path, this.baseUrl);\n if (queryParams) {\n for (const [key, value] of Object.entries(queryParams)) {\n url.searchParams.set(key, value);\n }\n }\n return url.toString();\n }\n\n private async executeWithRetry<T>(\n method: string,\n url: string,\n body?: unknown,\n isMultipart = false,\n contentType?: string,\n tokenOverride?: string,\n ): Promise<T> {\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= this.retryConfig.maxRetries; attempt++) {\n try {\n return await this.execute<T>(method, url, body, isMultipart, contentType, tokenOverride);\n } catch (error) {\n lastError = error;\n\n if (error instanceof CredenceApiError && isRetryable(error.status)) {\n if (attempt < this.retryConfig.maxRetries) {\n const delay = calculateDelay(attempt, this.retryConfig);\n await sleep(delay);\n continue;\n }\n }\n\n throw error;\n }\n }\n\n throw lastError;\n }\n\n private async execute<T>(\n method: string,\n url: string,\n body?: unknown,\n isMultipart = false,\n contentType?: string,\n tokenOverride?: string,\n ): Promise<T> {\n const headers: Record<string, string> = {\n 'Authorization': `Bearer ${tokenOverride ?? this.token}`,\n 'X-Correlation-ID': this.correlationId,\n };\n\n if (!isMultipart && body !== undefined) {\n headers['Content-Type'] = contentType ?? 'application/json';\n }\n\n // Extract pathname — url may be relative (e.g. '/api/v1/auth/register') or absolute\n let path: string;\n try {\n path = new URL(url).pathname;\n } catch {\n path = url.split('?')[0] ?? url;\n }\n\n // Notify request interceptors (without auth header)\n const sanitizedHeaders = { ...headers };\n delete sanitizedHeaders['Authorization'];\n await this.interceptors.onRequest({ method, url, headers: sanitizedHeaders });\n\n const startTime = Date.now();\n let response: Response;\n\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n response = await fetch(url, {\n method,\n headers,\n body: isMultipart ? (body as FormData) : typeof body === 'string' ? body : body !== undefined ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n } catch (error) {\n const durationMs = Date.now() - startTime;\n await this.interceptors.onResponse({ status: 0, url, correlationId: this.correlationId, durationMs });\n\n if (error instanceof DOMException && error.name === 'AbortError') {\n throw new CredenceNetworkError(`Request timeout after ${this.timeout}ms: ${method} ${path}`, error);\n }\n throw new CredenceNetworkError(`Network error: ${method} ${path}`, error);\n }\n\n const durationMs = Date.now() - startTime;\n const responseCorrelationId = response.headers.get('X-Correlation-ID') ?? this.correlationId;\n\n await this.interceptors.onResponse({\n status: response.status,\n url,\n correlationId: responseCorrelationId,\n durationMs,\n });\n\n if (response.status === 204) {\n return undefined as T;\n }\n\n if (!response.ok) {\n await this.handleError(response, method, path, responseCorrelationId);\n }\n\n return (await response.json()) as T;\n }\n\n private async handleError(\n response: Response,\n method: string,\n path: string,\n correlationId: string,\n ): Promise<never> {\n let problemDetail: {\n status?: number;\n title?: string;\n detail?: string;\n type?: string;\n instance?: string;\n } = {};\n\n try {\n problemDetail = (await response.json()) as typeof problemDetail;\n } catch {\n // Response body is not JSON; use status text\n }\n\n const params = {\n status: problemDetail.status ?? response.status,\n title: problemDetail.title ?? response.statusText,\n detail: problemDetail.detail,\n type: problemDetail.type,\n instance: problemDetail.instance,\n correlationId,\n method,\n path,\n };\n\n if (response.status === 401) {\n throw new CredenceAuthError({ method, path, correlationId });\n }\n\n if (response.status === 403) {\n throw new CredenceAuthorizationError({ method, path, correlationId, detail: problemDetail.detail });\n }\n\n throw new CredenceApiError(params);\n }\n}\n","/** Paginated response matching Spring Boot Page<T> format. */\nexport interface Page<T> {\n content: T[];\n totalElements: number;\n totalPages: number;\n size: number;\n number: number;\n first: boolean;\n last: boolean;\n}\n\n/** Pagination parameters for list operations. */\nexport interface PageParams {\n page?: number;\n size?: number;\n sort?: string;\n}\n\n/** Converts PageParams to URL query string parameters. */\nexport function toQueryParams(params?: PageParams): Record<string, string> {\n if (!params) return {};\n const result: Record<string, string> = {};\n if (params.page !== undefined) result['page'] = String(params.page);\n if (params.size !== undefined) result['size'] = String(params.size);\n if (params.sort !== undefined) result['sort'] = params.sort;\n return result;\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page, PageParams } from '../types/common.js';\nimport { toQueryParams } from '../types/common.js';\nimport type { TenantCreateRequest, TenantResponse, TenantDetailResponse } from '../types/tenant.js';\nimport type {\n RegisterRequest,\n LoginRequest,\n ForgotPasswordRequest,\n ResetPasswordRequest,\n AuthResponse,\n} from '../types/auth.js';\nimport type {\n CitizenRegisterRequest,\n Fido2RegistrationOptions,\n Fido2RegistrationResponse,\n Fido2LoginRequest,\n Fido2LoginOptions,\n Fido2LoginResponse,\n} from '../types/citizen.js';\n\n/**\n * Identity module — user authentication, tenant lifecycle, and DID management.\n * Wraps Identity Service endpoints via Gateway.\n *\n * Auth endpoints (register, login, forgotPassword, resetPassword) are public —\n * no JWT required. The refresh endpoint requires a valid JWT.\n */\nexport class IdentityModule {\n constructor(private readonly http: HttpClient) {}\n\n // --- Authentication ---\n\n /**\n * Registers a new user. Creates a Credence tenant, ACA-Py sub-wallet, and bootstrap DID.\n * Returns a JWT for immediate authenticated access. (SCF Phase 3a FR-1)\n */\n async register(request: RegisterRequest): Promise<AuthResponse> {\n return this.http.post<AuthResponse>('/api/v1/auth/register', request);\n }\n\n /**\n * Authenticates with email and password. Returns a JWT with tenantId and roles.\n * Returns 401 for invalid credentials, 429 if the account is locked. (SCF Phase 3a FR-2)\n */\n async login(request: LoginRequest): Promise<AuthResponse> {\n return this.http.post<AuthResponse>('/api/v1/auth/login', request);\n }\n\n /**\n * Initiates a password reset flow. A single-use reset token is generated\n * (MVP: logged to server console, no email sent). (SCF Phase 3a FR-3)\n */\n async forgotPassword(request: ForgotPasswordRequest): Promise<void> {\n await this.http.post<void>('/api/v1/auth/forgot-password', request);\n }\n\n /**\n * Resets a user's password using a single-use token. Token expires after 1 hour.\n * Returns 400 for expired or already-used tokens. (SCF Phase 3a FR-3)\n */\n async resetPassword(request: ResetPasswordRequest): Promise<void> {\n await this.http.post<void>('/api/v1/auth/reset-password', request);\n }\n\n /**\n * Refreshes a JWT before expiry. Requires a valid (non-expired) JWT.\n * Returns a fresh JWT with the same claims and a new expiry. (SCF Phase 3a FR-2)\n */\n async refresh(): Promise<AuthResponse> {\n return this.http.post<AuthResponse>('/api/v1/auth/refresh', {});\n }\n\n // --- Tenant lifecycle ---\n\n /** Creates a new tenant with ACA-Py sub-wallet provisioning. (FR-8) */\n async createTenant(request: TenantCreateRequest): Promise<TenantResponse> {\n return this.http.post<TenantResponse>('/api/v1/tenants', request);\n }\n\n /** Retrieves tenant details by ID. (FR-9) */\n async getTenant(id: string): Promise<TenantDetailResponse> {\n return this.http.get<TenantDetailResponse>(`/api/v1/tenants/${encodeURIComponent(id)}`);\n }\n\n /** Lists tenants with pagination. (FR-10) */\n async listTenants(params?: PageParams): Promise<Page<TenantResponse>> {\n return this.http.get<Page<TenantResponse>>('/api/v1/tenants', toQueryParams(params));\n }\n\n // --- Citizen Registration ---\n\n /**\n * Registers a citizen (Individual tenant). Creates a tenant with type=INDIVIDUAL,\n * ACA-Py sub-wallet, and bootstrap did:key. Returns JWT with tenantType=INDIVIDUAL.\n *\n * @example\n * ```typescript\n * const auth = await credence.identity.registerCitizen({\n * name: 'Jane Doe',\n * email: 'jane@example.com',\n * password: 'SecurePass123!',\n * phone: '+91-9876543210',\n * });\n * ```\n */\n async registerCitizen(request: CitizenRegisterRequest): Promise<AuthResponse> {\n return this.http.post<AuthResponse>('/api/v1/auth/register/citizen', request);\n }\n\n // --- FIDO2 / WebAuthn ---\n\n /**\n * Begins FIDO2 passkey registration. Returns challenge and options for the authenticator.\n * Requires JWT authentication (user must be logged in first).\n */\n async fido2BeginRegistration(): Promise<Fido2RegistrationOptions> {\n return this.http.post<Fido2RegistrationOptions>('/api/v1/auth/fido2/register/begin', {});\n }\n\n /**\n * Completes FIDO2 passkey registration with the authenticator's response.\n */\n async fido2CompleteRegistration(response: Fido2RegistrationResponse): Promise<void> {\n await this.http.post<void>('/api/v1/auth/fido2/register/complete', response);\n }\n\n /**\n * Begins FIDO2 passkey login. Returns challenge and allowed credentials.\n * Public endpoint — no JWT required.\n */\n async fido2BeginLogin(request: Fido2LoginRequest): Promise<Fido2LoginOptions> {\n return this.http.post<Fido2LoginOptions>('/api/v1/auth/fido2/login/begin', request);\n }\n\n /**\n * Completes FIDO2 passkey login. Returns JWT on success.\n */\n async fido2CompleteLogin(response: Fido2LoginResponse): Promise<AuthResponse> {\n return this.http.post<AuthResponse>('/api/v1/auth/fido2/login/complete', response);\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page, PageParams } from '../types/common.js';\nimport { toQueryParams } from '../types/common.js';\nimport type { ConnectionCreateRequest, AcceptInvitationRequest, ConnectionResponse } from '../types/connection.js';\n\n/**\n * Messaging module — DIDComm connections and invitations.\n * Wraps Messaging Service endpoints via Gateway.\n */\nexport class MessagingModule {\n constructor(private readonly http: HttpClient) {}\n\n /** Creates an OOB DIDComm invitation. (FR-11) */\n async createInvitation(request?: ConnectionCreateRequest): Promise<ConnectionResponse> {\n return this.http.post<ConnectionResponse>('/api/v1/connections/create-invitation', request ?? {});\n }\n\n /**\n * Accepts an OOB DIDComm invitation from a DIA authority or anchor buyer.\n * Parses the invitation URL and calls ACA-Py receive-invitation.\n * Returns the new connection record. (SCF Phase 3a FR-5, FR-13)\n */\n async acceptInvitation(request: AcceptInvitationRequest): Promise<ConnectionResponse> {\n return this.http.post<ConnectionResponse>('/api/v1/connections/accept-invitation', request);\n }\n\n /** Retrieves a connection by ID (tenant-scoped). (FR-12) */\n async getConnection(id: string): Promise<ConnectionResponse> {\n return this.http.get<ConnectionResponse>(`/api/v1/connections/${encodeURIComponent(id)}`);\n }\n\n /** Lists connections with pagination (tenant-scoped). (FR-13) */\n async listConnections(params?: PageParams): Promise<Page<ConnectionResponse>> {\n return this.http.get<Page<ConnectionResponse>>('/api/v1/connections', toQueryParams(params));\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page, PageParams } from '../types/common.js';\nimport { toQueryParams } from '../types/common.js';\nimport type {\n CredentialCreateRequest,\n CredentialResponse,\n CredentialDetailResponse,\n VerificationRequest,\n VerificationV2Request,\n VerificationResult,\n} from '../types/credential.js';\n\n/**\n * Credentials module — issuance, verification, and revocation.\n * Wraps Credentials Service endpoints via Gateway.\n * [KB:04-vc-lifecycle#issuance-flow], [KB:20-runtime-verification-engine#five-checks]\n */\nexport class CredentialsModule {\n constructor(private readonly http: HttpClient) {}\n\n /** Issues a verifiable credential. (FR-14) */\n async issue(request: CredentialCreateRequest): Promise<CredentialResponse> {\n return this.http.post<CredentialResponse>('/api/v1/credentials', request);\n }\n\n /** Retrieves credential details by ID (tenant-scoped). (FR-15) */\n async get(id: string): Promise<CredentialDetailResponse> {\n return this.http.get<CredentialDetailResponse>(`/api/v1/credentials/${encodeURIComponent(id)}`);\n }\n\n /** Lists credentials with pagination (tenant-scoped). (FR-16) */\n async list(params?: PageParams): Promise<Page<CredentialResponse>> {\n return this.http.get<Page<CredentialResponse>>('/api/v1/credentials', toQueryParams(params));\n }\n\n /** Revokes a credential by ID. (FR-17) */\n async revoke(id: string): Promise<void> {\n await this.http.post<undefined>(`/api/v1/credentials/${encodeURIComponent(id)}/revoke`);\n }\n\n /** Verifies a credential using legacy 3-check. (FR-18) */\n async verify(request: VerificationRequest): Promise<VerificationResult> {\n return this.http.post<VerificationResult>('/api/v1/credentials/verify', request);\n }\n\n /** Verifies a credential using 5-check policy engine. (FR-19) */\n async verifyV2(request: VerificationV2Request): Promise<VerificationResult> {\n return this.http.post<VerificationResult>('/api/v1/credentials/verify/v2', request);\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page, PageParams } from '../types/common.js';\nimport { toQueryParams } from '../types/common.js';\nimport type {\n PresentationCreateRequest,\n PresentationExchangeResponse,\n PresentationDetailExchangeResponse,\n Oid4vpAuthorizeRequest,\n PrerequisiteStatusResponse,\n} from '../types/presentation.js';\n/**\n * Presentations module — presentation exchange and OID4VP.\n * Wraps Credentials Service presentation endpoints via Gateway.\n */\nexport class PresentationsModule {\n constructor(private readonly http: HttpClient) {}\n\n /** Creates a presentation request (DIDComm or OID4VP). (FR-20) */\n async createRequest(request: PresentationCreateRequest): Promise<PresentationDetailExchangeResponse> {\n return this.http.post<PresentationDetailExchangeResponse>('/api/v1/presentations/request', request);\n }\n\n /** Retrieves a presentation exchange by ID (returns full detail). (FR-21) */\n async get(id: string): Promise<PresentationDetailExchangeResponse> {\n return this.http.get<PresentationDetailExchangeResponse>(`/api/v1/presentations/${encodeURIComponent(id)}`);\n }\n\n /** Lists presentation exchanges with pagination (returns summaries). (FR-22) */\n async list(params?: PageParams): Promise<Page<PresentationExchangeResponse>> {\n return this.http.get<Page<PresentationExchangeResponse>>('/api/v1/presentations', toQueryParams(params));\n }\n\n /**\n * Verifies a received presentation using the 5-check engine. (FR-23)\n *\n * Returns the full PresentationDetailExchangeResponse with updated\n * verificationContext containing the 5-check results.\n */\n async verify(id: string): Promise<PresentationDetailExchangeResponse> {\n return this.http.post<PresentationDetailExchangeResponse>(`/api/v1/presentations/${encodeURIComponent(id)}/verify`);\n }\n\n /** Generates an OID4VP authorization URL. (FR-24) */\n async generateOid4vpUrl(request: Oid4vpAuthorizeRequest): Promise<string> {\n const result = await this.http.post<{ authorizationUrl: string }>('/api/v1/presentations/oid4vp/authorize', request);\n return result.authorizationUrl;\n }\n\n /**\n * Checks issuance prerequisite status for a credential type on a connection/context.\n *\n * Returns whether governance-driven prerequisites (e.g., verified presentation)\n * are met. This is a lightweight read-only check; full cryptographic re-verification\n * happens at actual issuance time.\n */\n async getPrerequisiteStatus(\n credentialType: string,\n connectionId: string,\n contextId: string,\n ): Promise<PrerequisiteStatusResponse> {\n return this.http.get<PrerequisiteStatusResponse>(\n '/api/v1/presentations/prerequisites/status',\n {\n credentialType,\n connectionId,\n contextId,\n },\n );\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type {\n FrameworkResponse,\n FrameworkCreateRequest,\n FrameworkUpdateRequest,\n IssuerResponse,\n IssuerCreateRequest,\n SchemaCreateRequest,\n SchemaResponse,\n PolicyCreateRequest,\n PolicyResponse,\n GovernanceVcCreateRequest,\n GovernanceVcDetailResponse,\n LifecycleTransitionRequest,\n AnchorRequest,\n} from '../types/registry.js';\n\n/**\n * Registry admin module — write operations for trust frameworks, issuers, schemas, policies, and governance VCs.\n * Requires PLATFORM_ADMIN role.\n * [KB:19-governance-vc-model]\n */\nexport class RegistryAdminModule {\n constructor(private readonly http: HttpClient) {}\n\n /** Creates a trust framework in DRAFT state. (FR-36) */\n async createFramework(request: FrameworkCreateRequest): Promise<FrameworkResponse> {\n return this.http.post<FrameworkResponse>('/api/v1/admin/governance/frameworks', request);\n }\n\n /** Updates framework metadata. (FR-37) */\n async updateFramework(id: string, request: FrameworkUpdateRequest): Promise<FrameworkResponse> {\n return this.http.put<FrameworkResponse>(`/api/v1/admin/governance/frameworks/${encodeURIComponent(id)}`, request);\n }\n\n /** Activates a framework. (FR-38) */\n async activateFramework(id: string): Promise<FrameworkResponse> {\n return this.http.post<FrameworkResponse>(`/api/v1/admin/governance/frameworks/${encodeURIComponent(id)}/activate`);\n }\n\n /** Deprecates a framework. (FR-39) */\n async deprecateFramework(id: string): Promise<FrameworkResponse> {\n return this.http.post<FrameworkResponse>(`/api/v1/admin/governance/frameworks/${encodeURIComponent(id)}/deprecate`);\n }\n\n /** Archives a framework. (FR-40) */\n async archiveFramework(id: string): Promise<FrameworkResponse> {\n return this.http.post<FrameworkResponse>(`/api/v1/admin/governance/frameworks/${encodeURIComponent(id)}/archive`);\n }\n\n /** Registers a trusted issuer. (FR-41) */\n async registerIssuer(request: IssuerCreateRequest): Promise<IssuerResponse> {\n return this.http.post<IssuerResponse>('/api/v1/admin/issuers', request);\n }\n\n /** Lists issuers (admin view). (FR-42) */\n async listIssuers(): Promise<IssuerResponse[]> {\n return this.http.get<IssuerResponse[]>('/api/v1/admin/issuers');\n }\n\n /** Revokes issuer authorization. (FR-43) */\n async revokeIssuer(id: string): Promise<void> {\n await this.http.delete(`/api/v1/admin/issuers/${encodeURIComponent(id)}`);\n }\n\n /** Registers a credential schema. (FR-44) */\n async registerSchema(request: SchemaCreateRequest): Promise<SchemaResponse> {\n return this.http.post<SchemaResponse>('/api/v1/admin/schemas', request);\n }\n\n /** Registers a verifier policy. (FR-45) */\n async registerPolicy(request: PolicyCreateRequest): Promise<PolicyResponse> {\n return this.http.post<PolicyResponse>('/api/v1/admin/policies', request);\n }\n\n /** Creates a governance VC in DRAFT state. (FR-46) */\n async createGovernanceVc(request: GovernanceVcCreateRequest): Promise<GovernanceVcDetailResponse> {\n return this.http.post<GovernanceVcDetailResponse>('/api/v1/admin/governance/vcs', request);\n }\n\n /** Submits governance VC for review. (FR-47) */\n async submitForReview(id: string, request: LifecycleTransitionRequest): Promise<GovernanceVcDetailResponse> {\n return this.http.post<GovernanceVcDetailResponse>(`/api/v1/admin/governance/vcs/${encodeURIComponent(id)}/submit-for-review`, request);\n }\n\n /** Activates a governance VC. (FR-48) */\n async activateGovernanceVc(id: string, request: LifecycleTransitionRequest): Promise<GovernanceVcDetailResponse> {\n return this.http.post<GovernanceVcDetailResponse>(`/api/v1/admin/governance/vcs/${encodeURIComponent(id)}/activate`, request);\n }\n\n /** Suspends a governance VC. (FR-49) */\n async suspendGovernanceVc(id: string, request: LifecycleTransitionRequest): Promise<GovernanceVcDetailResponse> {\n return this.http.post<GovernanceVcDetailResponse>(`/api/v1/admin/governance/vcs/${encodeURIComponent(id)}/suspend`, request);\n }\n\n /** Reinstates a governance VC from SUSPENDED to ACTIVE. (FR-50) */\n async reinstateGovernanceVc(id: string, request: LifecycleTransitionRequest): Promise<GovernanceVcDetailResponse> {\n return this.http.post<GovernanceVcDetailResponse>(`/api/v1/admin/governance/vcs/${encodeURIComponent(id)}/reinstate`, request);\n }\n\n /** Revokes a governance VC (terminal state). (FR-51) */\n async revokeGovernanceVc(id: string, request: LifecycleTransitionRequest): Promise<GovernanceVcDetailResponse> {\n return this.http.post<GovernanceVcDetailResponse>(`/api/v1/admin/governance/vcs/${encodeURIComponent(id)}/revoke`, request);\n }\n\n /** Records a Fabric anchor hash for a governance VC. (FR-52) */\n async anchorGovernanceVc(id: string, request: AnchorRequest): Promise<GovernanceVcDetailResponse> {\n return this.http.post<GovernanceVcDetailResponse>(`/api/v1/admin/governance/vcs/${encodeURIComponent(id)}/anchor`, request);\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page } from '../types/common.js';\nimport type {\n FrameworkResponse,\n IssuerResponse,\n SchemaResponse,\n PolicyResponse,\n StatusListResponse,\n GovernanceVcResponse,\n GovernanceVcDetailResponse,\n GovernanceVcAuditEntry,\n GovernanceVcQueryParams,\n IssuerQueryParams,\n} from '../types/registry.js';\nimport { RegistryAdminModule } from './registry-admin.js';\n\n/**\n * Registry module — TRQP query endpoints for trust framework, issuer, schema, policy, and governance VC lookups.\n * [KB:02-trust-registry#trqp-query]\n */\nexport class RegistryModule {\n /** Admin sub-module for write operations (PLATFORM_ADMIN role required). */\n readonly admin: RegistryAdminModule;\n\n constructor(private readonly http: HttpClient) {\n this.admin = new RegistryAdminModule(http);\n }\n\n /** Lists active trust frameworks. (FR-25) */\n async listFrameworks(): Promise<FrameworkResponse[]> {\n return this.http.get<FrameworkResponse[]>('/api/v1/registry/governance/frameworks');\n }\n\n /** Retrieves a framework by ID. (FR-26) */\n async getFramework(id: string): Promise<FrameworkResponse> {\n return this.http.get<FrameworkResponse>(`/api/v1/registry/governance/frameworks/${encodeURIComponent(id)}`);\n }\n\n /** Finds frameworks associated with a DID. (FR-27) */\n async findFrameworksByDid(did: string): Promise<FrameworkResponse[]> {\n return this.http.get<FrameworkResponse[]>('/api/v1/registry/governance/frameworks/by-did', { did });\n }\n\n /** Lists authorized issuers with optional filters. (FR-28) */\n async listIssuers(params?: IssuerQueryParams): Promise<IssuerResponse[]> {\n const query: Record<string, string> = {};\n if (params?.credentialType) query['credentialType'] = params.credentialType;\n if (params?.frameworkId) query['frameworkId'] = params.frameworkId;\n return this.http.get<IssuerResponse[]>('/api/v1/registry/issuers', query);\n }\n\n /** Retrieves a registered schema. (FR-29) */\n async getSchema(schemaId: string): Promise<SchemaResponse> {\n return this.http.get<SchemaResponse>(`/api/v1/registry/schemas/${encodeURIComponent(schemaId)}`);\n }\n\n /** Retrieves a verifier policy. (FR-30) */\n async getPolicy(policyId: string): Promise<PolicyResponse> {\n return this.http.get<PolicyResponse>(`/api/v1/registry/policies/${encodeURIComponent(policyId)}`);\n }\n\n /** Lists governance VCs with pagination and filters. (FR-31) */\n async listGovernanceVcs(params?: GovernanceVcQueryParams): Promise<Page<GovernanceVcResponse>> {\n const query: Record<string, string> = {};\n if (params?.page !== undefined) query['page'] = String(params.page);\n if (params?.size !== undefined) query['size'] = String(params.size);\n if (params?.frameworkId) query['frameworkId'] = params.frameworkId;\n if (params?.vcType) query['vcType'] = params.vcType;\n if (params?.status) query['status'] = params.status;\n if (params?.issuerDid) query['issuerDid'] = params.issuerDid;\n if (params?.subjectDid) query['subjectDid'] = params.subjectDid;\n return this.http.get<Page<GovernanceVcResponse>>('/api/v1/registry/governance/vcs', query);\n }\n\n /** Retrieves a governance VC by ID. (FR-32) */\n async getGovernanceVc(id: string): Promise<GovernanceVcDetailResponse> {\n return this.http.get<GovernanceVcDetailResponse>(`/api/v1/registry/governance/vcs/${encodeURIComponent(id)}`);\n }\n\n /** Retrieves the raw W3C VC JSON-LD for a governance VC. (FR-33) */\n async getGovernanceVcJson(id: string): Promise<Record<string, unknown>> {\n return this.http.get<Record<string, unknown>>(`/api/v1/registry/governance/vcs/${encodeURIComponent(id)}/vc-json`);\n }\n\n /** Retrieves audit trail for a governance VC. (FR-34) */\n async getGovernanceVcAudit(id: string): Promise<GovernanceVcAuditEntry[]> {\n return this.http.get<GovernanceVcAuditEntry[]>(`/api/v1/registry/governance/vcs/${encodeURIComponent(id)}/audit`);\n }\n\n /** Retrieves a BitstringStatusList credential. (FR-35) */\n async getStatusList(statusListId: string): Promise<StatusListResponse> {\n return this.http.get<StatusListResponse>(`/api/v1/registry/status/${encodeURIComponent(statusListId)}`);\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page, PageParams } from '../types/common.js';\nimport { toQueryParams } from '../types/common.js';\nimport type {\n ComplianceCheckRequest,\n ComplianceCheckResponse,\n AuditCreateRequest,\n AuditResponse,\n RuleCreateRequest,\n RuleResponse,\n} from '../types/compliance.js';\n\n/** Compliance admin sub-module. Requires PLATFORM_ADMIN role. */\nclass ComplianceAdminModule {\n constructor(private readonly http: HttpClient) {}\n\n /** Creates a compliance rule. (FR-57) */\n async createRule(request: RuleCreateRequest): Promise<RuleResponse> {\n return this.http.post<RuleResponse>('/api/v1/admin/compliance/rules', request);\n }\n\n /** Deactivates a compliance rule. (FR-58) */\n async deactivateRule(id: string): Promise<void> {\n await this.http.delete(`/api/v1/admin/compliance/rules/${encodeURIComponent(id)}`);\n }\n}\n\n/**\n * Compliance module — compliance checks, audit events, and rules.\n * [KB:10-privacy-compliance#audit-logging]\n */\nexport class ComplianceModule {\n /** Admin sub-module for rule management (PLATFORM_ADMIN role required). */\n readonly admin: ComplianceAdminModule;\n\n constructor(private readonly http: HttpClient) {\n this.admin = new ComplianceAdminModule(http);\n }\n\n /** Evaluates compliance, returning ALLOW/DENY/INCOMPLETE. (FR-53) */\n async check(request: ComplianceCheckRequest): Promise<ComplianceCheckResponse> {\n return this.http.post<ComplianceCheckResponse>('/api/v1/compliance/check', request);\n }\n\n /** Creates an audit event. (FR-54) */\n async createAuditEvent(request: AuditCreateRequest): Promise<AuditResponse> {\n return this.http.post<AuditResponse>('/api/v1/compliance/audit', request);\n }\n\n /** Lists audit events with pagination. (FR-55) */\n async listAuditEvents(params?: PageParams): Promise<Page<AuditResponse>> {\n return this.http.get<Page<AuditResponse>>('/api/v1/compliance/audit', toQueryParams(params));\n }\n\n /** Retrieves a specific audit event. (FR-56) */\n async getAuditEvent(id: string): Promise<AuditResponse> {\n return this.http.get<AuditResponse>(`/api/v1/compliance/audit/${encodeURIComponent(id)}`);\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page } from '../types/common.js';\nimport type {\n EvidenceResponse,\n EvidenceDetailResponse,\n EvidenceVerificationResult,\n EvidenceQueryParams,\n EvidenceShareRequest,\n} from '../types/evidence.js';\n\n/**\n * Evidence module — IPFS-backed evidence upload, retrieval, and verification.\n */\nexport class EvidenceModule {\n constructor(private readonly http: HttpClient) {}\n\n /** Uploads evidence as multipart/form-data. (FR-59) */\n async upload(formData: FormData): Promise<EvidenceResponse> {\n return this.http.upload<EvidenceResponse>('/api/v1/evidence', formData);\n }\n\n /** Retrieves evidence metadata by ID. (FR-60) */\n async get(id: string): Promise<EvidenceDetailResponse> {\n return this.http.get<EvidenceDetailResponse>(`/api/v1/evidence/${encodeURIComponent(id)}`);\n }\n\n /** Downloads evidence file content. (FR-61) */\n async download(id: string): Promise<Buffer> {\n // Use raw fetch for binary content\n const response = await this.http.get<ArrayBuffer>(`/api/v1/evidence/${encodeURIComponent(id)}/content`);\n return Buffer.from(response);\n }\n\n /** Lists evidence with pagination and filters. (FR-62) */\n async list(params?: EvidenceQueryParams): Promise<Page<EvidenceResponse>> {\n const query: Record<string, string> = {};\n if (params?.page !== undefined) query['page'] = String(params.page);\n if (params?.size !== undefined) query['size'] = String(params.size);\n if (params?.type) query['type'] = params.type;\n if (params?.status) query['status'] = params.status;\n return this.http.get<Page<EvidenceResponse>>('/api/v1/evidence', query);\n }\n\n /**\n * Lists all evidence artifacts linked to a specific credential (reverse lookup).\n *\n * @param credentialId the credential ID to find linked evidence for\n * @returns list of evidence summaries linked to the credential\n */\n async listByCredential(credentialId: string): Promise<EvidenceResponse[]> {\n return this.http.get<EvidenceResponse[]>(\n `/api/v1/evidence/by-credential/${encodeURIComponent(credentialId)}`,\n );\n }\n\n /** Verifies evidence integrity (SHA-256 hash match). (FR-63) */\n async verify(id: string): Promise<EvidenceVerificationResult> {\n return this.http.post<EvidenceVerificationResult>(`/api/v1/evidence/${encodeURIComponent(id)}/verify`);\n }\n\n /** Links a credential ID to an evidence record. (FR-64) */\n async link(id: string, credentialId: string): Promise<void> {\n await this.http.post<undefined>(`/api/v1/evidence/${encodeURIComponent(id)}/link`, { credentialId });\n }\n\n /** Soft-deletes an evidence record. (FR-65) */\n async delete(id: string): Promise<void> {\n await this.http.delete(`/api/v1/evidence/${encodeURIComponent(id)}`);\n }\n\n /**\n * Shares evidence over DIDComm to a connected peer.\n *\n * Issues an EvidenceSharingAttestation governance VC for provenance,\n * then sends the evidence metadata via DIDComm basic message.\n *\n * @param evidenceId the evidence UUID to share\n * @param request sharing parameters (connectionId, credentialId, etc.)\n */\n async share(evidenceId: string, request: EvidenceShareRequest): Promise<void> {\n await this.http.post<undefined>(\n `/api/v1/evidence/${encodeURIComponent(evidenceId)}/share`,\n request,\n );\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type {\n VdrSchema,\n VdrSchemaWriteRequest,\n VdrCredentialDefinition,\n VdrCredDefWriteRequest,\n VdrRevocationRegistry,\n VdrRevRegCreateRequest,\n WalletDid,\n NymWriteRequest,\n} from '../types/vdr.js';\n\n/**\n * VDR module — Indy VDR operations for schemas, credential definitions, NYMs, and revocation registries.\n * [KB:18-vdr-service], [KB:04-vc-lifecycle#anoncreds-predicates]\n */\nexport class VdrModule {\n constructor(private readonly http: HttpClient) {}\n\n /** Writes a schema to the Indy VDR. (FR-66) */\n async writeSchema(request: VdrSchemaWriteRequest): Promise<VdrSchema> {\n return this.http.post<VdrSchema>('/api/vdr/schemas', request);\n }\n\n /** Lists all registered schemas (merged ACA-Py + local). (FR-67) */\n async listSchemas(): Promise<VdrSchema[]> {\n return this.http.get<VdrSchema[]>('/api/vdr/schemas');\n }\n\n /** Retrieves a schema by ID. (FR-68) */\n async getSchema(schemaId: string): Promise<VdrSchema> {\n return this.http.get<VdrSchema>(`/api/vdr/schemas/${encodeURIComponent(schemaId)}`);\n }\n\n /** Retrieves a schema using URL-safe query param. (FR-69) */\n async lookupSchema(schemaId: string): Promise<VdrSchema> {\n return this.http.get<VdrSchema>('/api/vdr/schemas/lookup', { id: schemaId });\n }\n\n /** Writes a credential definition to Indy VDR. (FR-70) */\n async writeCredentialDefinition(request: VdrCredDefWriteRequest): Promise<VdrCredentialDefinition> {\n return this.http.post<VdrCredentialDefinition>('/api/vdr/credential-definitions', request);\n }\n\n /** Lists all credential definitions. (FR-71) */\n async listCredentialDefinitions(): Promise<VdrCredentialDefinition[]> {\n return this.http.get<VdrCredentialDefinition[]>('/api/vdr/credential-definitions');\n }\n\n /** Retrieves a credential definition by ID. (FR-72) */\n async getCredentialDefinition(credDefId: string): Promise<VdrCredentialDefinition> {\n return this.http.get<VdrCredentialDefinition>(`/api/vdr/credential-definitions/${encodeURIComponent(credDefId)}`);\n }\n\n /** Retrieves a credential definition using URL-safe query param. (FR-73) */\n async lookupCredentialDefinition(credDefId: string): Promise<VdrCredentialDefinition> {\n return this.http.get<VdrCredentialDefinition>('/api/vdr/credential-definitions/lookup', { id: credDefId });\n }\n\n /** Writes a NYM transaction to Indy ledger. (FR-74) */\n async writeNym(request: NymWriteRequest): Promise<Record<string, unknown>> {\n return this.http.post<Record<string, unknown>>('/api/vdr/nyms', request);\n }\n\n /** Lists wallet DIDs (merged ACA-Py + local). (FR-75) */\n async listNyms(): Promise<WalletDid[]> {\n return this.http.get<WalletDid[]>('/api/vdr/nyms');\n }\n\n /** Resolves a NYM by DID. (FR-76) */\n async resolveNym(did: string): Promise<WalletDid> {\n return this.http.get<WalletDid>(`/api/vdr/nyms/${encodeURIComponent(did)}`);\n }\n\n /** Creates a revocation registry. (FR-77) */\n async createRevocationRegistry(request: VdrRevRegCreateRequest): Promise<VdrRevocationRegistry> {\n return this.http.post<VdrRevocationRegistry>('/api/vdr/revocation/registries', request);\n }\n\n /** Lists all revocation registries. (FR-78) */\n async listRevocationRegistries(): Promise<VdrRevocationRegistry[]> {\n return this.http.get<VdrRevocationRegistry[]>('/api/vdr/revocation/registries');\n }\n\n /** Retrieves a revocation registry. (FR-79) */\n async getRevocationRegistry(revRegId: string): Promise<VdrRevocationRegistry> {\n return this.http.get<VdrRevocationRegistry>(`/api/vdr/revocation/registries/${encodeURIComponent(revRegId)}`);\n }\n\n /** Retrieves the revocation delta. (FR-80) */\n async getRevocationDelta(revRegId: string): Promise<Record<string, unknown>> {\n return this.http.get<Record<string, unknown>>(`/api/vdr/revocation/registries/${encodeURIComponent(revRegId)}/delta`);\n }\n\n /** Publishes pending revocations to ledger. (FR-81) */\n async publishRevocations(): Promise<Record<string, unknown>> {\n return this.http.post<Record<string, unknown>>('/api/vdr/revocation/publish');\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type {\n CredentialOfferRequest,\n CredentialOfferResponse,\n IssuerMetadata,\n TokenExchangeResponse,\n CredentialIssuanceRequest,\n CredentialIssuanceResponse,\n} from '../types/oid4vci.js';\n\n/**\n * OID4VCI module — SD-JWT credential issuance to wallets via OpenID for Verifiable Credential Issuance.\n *\n * Implements the Pre-Authorized Code Flow (OID4VCI 1.0):\n * 1. {@link getIssuerMetadata} — discover issuer capabilities\n * 2. {@link createOffer} — create credential offer (returns QR code URI)\n * 3. {@link exchangeToken} — exchange pre-authorized code for access token\n * 4. {@link issueCredential} — issue the credential to the wallet\n *\n * Steps 3-4 are typically called by the wallet, not the issuer.\n * The issuer uses steps 1-2, then displays the QR code for the wallet to scan.\n *\n * [KB:04-vc-lifecycle#oid4vci-issuance-flow]\n */\nexport class Oid4vciModule {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Fetches the issuer metadata from the well-known endpoint.\n * Public endpoint — no authentication required.\n */\n async getIssuerMetadata(): Promise<IssuerMetadata> {\n return this.http.get<IssuerMetadata>('/.well-known/openid-credential-issuer');\n }\n\n /**\n * Fetches the issuer's JSON Web Key Set (public keys for signature verification).\n * Public endpoint — no authentication required.\n */\n async getJwks(): Promise<Record<string, unknown>> {\n return this.http.get<Record<string, unknown>>('/.well-known/jwks.json');\n }\n\n /**\n * Creates a credential offer for wallet scanning.\n * Returns an offer URI suitable for QR code generation.\n * Requires JWT authentication (issuer role).\n *\n * @example\n * ```typescript\n * const offer = await credence.oid4vci.createOffer({\n * credentialType: 'KycCredential',\n * claims: { name: 'Jane Doe', kycLevel: 'HIGH' },\n * selectiveDisclosureClaims: ['name'],\n * });\n * // Display offer.credentialOfferUri as QR code\n * ```\n */\n async createOffer(request: CredentialOfferRequest): Promise<CredentialOfferResponse> {\n return this.http.post<CredentialOfferResponse>('/api/v1/oid4vci/offers', request);\n }\n\n /**\n * Exchanges a pre-authorized code for an access token.\n * Public endpoint — called by the wallet after scanning the QR code.\n *\n * Note: This sends as application/x-www-form-urlencoded per OAuth2 spec.\n */\n async exchangeToken(preAuthorizedCode: string): Promise<TokenExchangeResponse> {\n const body = new URLSearchParams({\n grant_type: 'urn:ietf:params:oauth:grant-type:pre-authorized_code',\n 'pre-authorized_code': preAuthorizedCode,\n });\n return this.http.postForm<TokenExchangeResponse>('/api/v1/oid4vci/token', body.toString());\n }\n\n /**\n * Issues a credential using the access token from token exchange.\n * Called by the wallet with the access token as Bearer authentication.\n *\n * @param accessToken - The access token from exchangeToken()\n * @param request - Credential request with format and optional proof\n */\n async issueCredential(\n accessToken: string,\n request: CredentialIssuanceRequest,\n ): Promise<CredentialIssuanceResponse> {\n return this.http.postWithToken<CredentialIssuanceResponse>(\n '/api/v1/oid4vci/credential',\n request,\n accessToken,\n );\n }\n}\n","import type { HttpClient } from '../http/http-client.js';\nimport type { Page, PageParams } from '../types/common.js';\nimport { toQueryParams } from '../types/common.js';\nimport type {\n PaymentCreateRequest,\n PaymentResponse,\n PaymentDetailResponse,\n} from '../types/payment.js';\n\n/**\n * Payment module — create, track, and manage payments via HatchPay integration.\n *\n * Supports the invite-to-pay flow for Supply Chain Finance and credential-linked payments.\n * All endpoints are tenant-scoped (tenant derived from JWT).\n *\n * [KB:13-use-cases#scf-with-dia]\n */\nexport class PaymentModule {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Creates a new payment.\n *\n * @example\n * ```typescript\n * const payment = await credence.payments.create({\n * amount: 50000,\n * currency: 'INR',\n * payerDid: 'did:key:z6Mk...',\n * payeeDid: 'did:key:z6Mn...',\n * contextId: 'credential-abc-123',\n * });\n * ```\n */\n async create(request: PaymentCreateRequest): Promise<PaymentDetailResponse> {\n return this.http.post<PaymentDetailResponse>('/api/v1/payments', request);\n }\n\n /**\n * Gets a payment by ID.\n */\n async get(paymentId: string): Promise<PaymentDetailResponse> {\n return this.http.get<PaymentDetailResponse>(`/api/v1/payments/${paymentId}`);\n }\n\n /**\n * Lists payments with pagination. Tenant-scoped.\n */\n async list(params?: PageParams): Promise<Page<PaymentResponse>> {\n const query = params ? `?${toQueryParams(params)}` : '';\n return this.http.get<Page<PaymentResponse>>(`/api/v1/payments${query}`);\n }\n\n /**\n * Requests a refund for a completed payment.\n */\n async refund(paymentId: string): Promise<PaymentDetailResponse> {\n return this.http.post<PaymentDetailResponse>(`/api/v1/payments/${paymentId}/refund`, {});\n }\n}\n","import { HttpClient, type HttpClientConfig } from './http/http-client.js';\nimport type { RetryConfig } from './http/retry.js';\nimport type { RequestInterceptor, ResponseInterceptor } from './http/interceptors.js';\nimport { IdentityModule } from './modules/identity.js';\nimport { MessagingModule } from './modules/messaging.js';\nimport { CredentialsModule } from './modules/credentials.js';\nimport { PresentationsModule } from './modules/presentations.js';\nimport { RegistryModule } from './modules/registry.js';\nimport { ComplianceModule } from './modules/compliance.js';\nimport { EvidenceModule } from './modules/evidence.js';\nimport { VdrModule } from './modules/vdr.js';\nimport { Oid4vciModule } from './modules/oid4vci.js';\nimport { PaymentModule } from './modules/payment.js';\n\n/**\n * Configuration for CredenceClient.\n */\nexport interface CredenceClientConfig {\n /** Base URL of the Credence Gateway (e.g., 'https://gateway.credence.example:8080'). */\n baseUrl: string;\n /** JWT token for authentication. Tenant context is derived from the token by the server. */\n auth: { type: 'jwt'; token: string };\n /** Retry configuration. Optional — defaults to 3 retries with exponential backoff. */\n retry?: Partial<RetryConfig>;\n /** Request timeout in milliseconds. Default: 30000. */\n timeout?: number;\n /** Override the auto-generated correlation ID. */\n correlationId?: string;\n}\n\n/**\n * Credence SDK client — typed access to all Credence Trust OS gateway endpoints.\n *\n * Modules follow the service boundary model:\n * - **identity**: Tenant and DID lifecycle (Identity Service)\n * - **messaging**: DIDComm connections and invitations (Messaging Service)\n * - **credentials**: VC issuance, verification, revocation (Credentials Service)\n * - **presentations**: Presentation exchange and OID4VP (Credentials Service)\n * - **registry**: TRQP queries + admin write operations (Registry Service)\n * - **compliance**: Compliance checks and audit events (Compliance Service)\n * - **evidence**: IPFS evidence upload and verification (Evidence Service)\n * - **vdr**: Indy VDR schemas, cred-defs, NYMs, revocation (VDR Service)\n *\n * [KB:00-system#option-c-hybrid], [KB:01-architecture#service-boundaries]\n *\n * @example\n * ```typescript\n * import { CredenceClient } from '@primethoughts/credence-sdk';\n *\n * const credence = new CredenceClient({\n * baseUrl: 'https://gateway.credence.example:8080',\n * auth: { type: 'jwt', token: jwtToken },\n * });\n *\n * const tenant = await credence.identity.createTenant({ name: 'Acme Corp' });\n * const schema = await credence.vdr.writeSchema({ name: 'scf.invoice', version: '1.0', attributes: [...] });\n * ```\n */\nexport class CredenceClient {\n private readonly http: HttpClient;\n\n /** Tenant and DID lifecycle management. */\n readonly identity: IdentityModule;\n /** DIDComm connections and invitations. */\n readonly messaging: MessagingModule;\n /** VC issuance, verification, and revocation. */\n readonly credentials: CredentialsModule;\n /** Presentation exchange and OID4VP. */\n readonly presentations: PresentationsModule;\n /** Trust Registry TRQP queries + admin write operations. */\n readonly registry: RegistryModule;\n /** Compliance checks and audit events. */\n readonly compliance: ComplianceModule;\n /** IPFS evidence upload, retrieval, and verification. */\n readonly evidence: EvidenceModule;\n /** Indy VDR operations: schemas, credential definitions, NYMs, revocation. */\n readonly vdr: VdrModule;\n /** OID4VCI credential issuance to wallets (SD-JWT VCs). */\n readonly oid4vci: Oid4vciModule;\n /** Payment lifecycle management (HatchPay integration). */\n readonly payments: PaymentModule;\n\n constructor(config: CredenceClientConfig) {\n const httpConfig: HttpClientConfig = {\n baseUrl: config.baseUrl,\n token: config.auth.token,\n retry: config.retry,\n timeout: config.timeout,\n correlationId: config.correlationId,\n };\n\n this.http = new HttpClient(httpConfig);\n\n this.identity = new IdentityModule(this.http);\n this.messaging = new MessagingModule(this.http);\n this.credentials = new CredentialsModule(this.http);\n this.presentations = new PresentationsModule(this.http);\n this.registry = new RegistryModule(this.http);\n this.compliance = new ComplianceModule(this.http);\n this.evidence = new EvidenceModule(this.http);\n this.vdr = new VdrModule(this.http);\n this.oid4vci = new Oid4vciModule(this.http);\n this.payments = new PaymentModule(this.http);\n }\n\n /** Updates the JWT token for all subsequent requests. */\n setToken(token: string): void {\n this.http.setToken(token);\n }\n\n /** Adds a request interceptor for logging or telemetry. */\n addRequestInterceptor(fn: RequestInterceptor): void {\n this.http.addRequestInterceptor(fn);\n }\n\n /** Adds a response interceptor for logging or telemetry. */\n addResponseInterceptor(fn: ResponseInterceptor): void {\n this.http.addResponseInterceptor(fn);\n }\n}\n","import { CredenceValidationError } from './errors.js';\n\n/**\n * Credence DID allowlist pattern.\n * Only did:key, did:peer, did:indy, did:web are supported.\n * [KB:09-security-crypto#input-validation]\n */\nconst DID_PATTERN = /^did:(key|peer|indy|web):[a-zA-Z0-9._:%-]+$/;\n\n/** Patterns that suggest key material which must never be sent via the SDK. */\nconst KEY_MATERIAL_PATTERNS = [\n /^-----BEGIN\\s+(RSA\\s+)?(PRIVATE|PUBLIC)\\s+KEY-----/,\n /^\\{\"kty\":/,\n /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{43,}$/,\n];\n\n/**\n * Validates a DID against the Credence allowlist.\n * @throws CredenceValidationError if the DID format or method is invalid\n */\nexport function validateDid(field: string, value: string): void {\n if (!DID_PATTERN.test(value)) {\n throw new CredenceValidationError(\n field,\n `Invalid DID format or unsupported method. Supported: did:key, did:peer, did:indy, did:web. Got: ${value.substring(0, 30)}`,\n );\n }\n}\n\n/**\n * Validates that a required field is non-empty.\n * @throws CredenceValidationError if the value is null, undefined, or empty string\n */\nexport function validateRequired(field: string, value: unknown): void {\n if (value === null || value === undefined || (typeof value === 'string' && value.trim() === '')) {\n throw new CredenceValidationError(field, 'Required field is missing or empty');\n }\n}\n\n/**\n * Checks if a string value appears to be key material.\n * [KB:09-security-crypto#key-custody]\n */\nexport function isKeyMaterial(value: string): boolean {\n return KEY_MATERIAL_PATTERNS.some((pattern) => pattern.test(value));\n}\n\n/**\n * Validates that no field in a record contains key material.\n * @throws CredenceValidationError if key material is detected\n */\nexport function rejectKeyMaterial(fields: Record<string, unknown>): void {\n for (const [key, value] of Object.entries(fields)) {\n if (typeof value === 'string' && isKeyMaterial(value)) {\n throw new CredenceValidationError(\n key,\n 'Field appears to contain key material (private key, JWK, or base58 key). SDK must not transmit key material.',\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,SAAS,wBAAgC;AAC9C,MAAI,OAAO,eAAe,eAAe,WAAW,QAAQ,YAAY;AACtE,WAAO,WAAW,OAAO,WAAW;AAAA,EACtC;AAGA,SAAQ,QAAQ,QAAQ,EAAmC,WAAW;AACxE;;;ACbO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAMO,IAAM,mBAAN,cAA+B,cAAc;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAST;AACD,UAAM,MAAM,GAAG,OAAO,MAAM,IAAI,OAAO,IAAI,gBAAgB,OAAO,MAAM,KAAK,OAAO,KAAK,GAAG,OAAO,SAAS,WAAM,OAAO,MAAM,KAAK,EAAE,GAAG,OAAO,gBAAgB,mBAAmB,OAAO,aAAa,MAAM,EAAE;AAC/M,UAAM,GAAG;AACT,SAAK,OAAO;AACZ,SAAK,SAAS,OAAO;AACrB,SAAK,QAAQ,OAAO;A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