import type { DidCommAttachment, DidCommMessage } from 'gdc-common-utils-ts/utils/didcomm'; import { AxiosInstance } from 'axios'; import { ApiKeyActionRequest, ApiKeyAuthorizationRule, BackendAuthRequestOptions, CreateOrgDidDocumentRequest, ControllerExchangeRequestBody, IcaBackendAuthResponse, IcaCreateOrgDidDocumentResponse, IcaDidCommMessageMeta, IcaCrypto, IcaJwk, IcaJwks, IcaLegalRepresentativeCredential, IcaLegalRepresentativeCredentialSubject, IcaRemoveOrganizationTermsResponse, IcaOrganizationCredential, IcaOrganizationCredentialSubject, IcaOrganizationControllerCredential, IcaOrganizationControllerCredentialSubject, IdentityCodeBody, IdentityDcrBindingRequest, IdentityDcrBody, IdentityExchangeBody, IdentityTokenBody, RemoveOrganizationTermsRequest, RunBackendAuthFlowRequest, RunBackendAuthFlowResult, IcaVerifyResponseKeyMaterial, IcaVerifyTermsResponse, VerifyTermsOptions } from './types.js'; export declare enum Sector { AnimalCare = "animal-care", HealthCare = "health-care", OneHealthResearch = "onehealth-research" } export interface IcaClientConfig { sector: Sector; didWeb: string; organizationVcs?: string[]; baseUrl?: string; retryTimes?: number; retryDelayMs?: number; httpClient?: AxiosInstance; fetch?: typeof fetch; crypto?: IcaCrypto; } export declare class IcaClient { private config; private vcManager; private vpManager; private httpClient?; private fetchFn?; private cryptoApi?; private baseUrl; private jurisdiction; private retryTimes; private retryDelayMs; private messageSigningPublicKey?; private controllerBindingPublicKey?; private credentialSigningPublicKey?; constructor(config: IcaClientConfig); initializeWithVcs(vcs: string[]): Promise; setVpToken(vpToken: string): void; setControllerMessageSigningPublicKey(alg: string, kid: string, jwk: IcaJwk): void; /** * Sets the controller operation-signing public key that should travel inside * `_verify` business payload as `body.data[].resource.controller.publicKeyJwk`. * * Separation of concerns: * - this key represents the real controller/business actor * - it is distinct from the DIDComm communication key configured via * `setControllerMessageSigningPublicKey(...)` * - ICA should project this key into * `credentialSubject.hasCredential.material` */ setControllerBindingPublicKey(alg: string, kid: string, jwk: IcaJwk): void; clearControllerMessageSigningPublicKey(): void; clearControllerBindingPublicKey(): void; setOrgCredentialSigningPublicKey(alg: string, kid: string, jwk: IcaJwk): void; clearOrgCredentialSigningPublicKey(): void; private createFapiMessage; private createAttachmentId; private buildConfiguredPublicJwk; private buildVerifyMessageMeta; private buildAuthHeaders; private resolveThreadId; private pollAsyncDidcommResponse; private getFirstStringByKeys; private computePkceS256Challenge; private extractIdTokenFromTokenResponse; private buildDcrMetaFromBinding; private isBoundStatus; private hasBoundStatusDeep; /** * Verifies onboarding terms PDF through ICA. * * Key separation during `_verify`: * - DIDComm communication protection lives in `meta.jws` / `meta.jwe` * - controller business binding lives in * `body.data[].resource.controller.publicKeyJwk` * - organization credential key bootstrap lives in the extra * `application/jwk+json` attachment when provided */ verifyTerms(pdfLinkOrBytes: string | Uint8Array, options?: VerifyTermsOptions): Promise<{ thid: string; location: string; }>; pollVerifyTermsResponse(thid: string): Promise; private sleep; private buildUrl; private headersToObject; private request; getIcaDidDocument(): Promise; private parseVcObject; private getResponseEntries; private getEntryTypeNames; private attachmentJwt; private attachmentNameMatches; private isCredentialResource; private isOrganizationCredentialEntry; private isLegalRepresentativeCredentialEntry; private isOrganizationControllerCredentialEntry; private extractDidDocumentFieldsFromVcs; createOrgDidDocument(orgData: CreateOrgDidDocumentRequest): Promise<{ thid: string; location: string; }>; createOrgDidDocumentFromVcs(options: { organizationVC?: string | object; legalRepresentativeVC?: string | object; organizationIdentifier?: string; organizationUrl?: string; organizationTaxID?: string; organizationPublicKeyJwk?: IcaJwk; organizationJwks?: IcaJwks; controllerSameAs?: string; controllerPublicKeyJwk?: IcaJwk; controllerJwks?: IcaJwks; }): Promise<{ thid: string; location: string; }>; pollCreateOrgDidDocumentResponse(thid: string): Promise; getOrgDidDoc(orgData: CreateOrgDidDocumentRequest): Promise; removeOrganizationTerms(request: RemoveOrganizationTermsRequest, options?: { meta?: IcaDidCommMessageMeta; }): Promise<{ thid: string; location: string; }>; pollRemoveOrganizationTermsResponse(thid: string): Promise; controllerExchange(body: ControllerExchangeRequestBody | undefined, options: BackendAuthRequestOptions): Promise<{ thid: string; location: string; }>; pollControllerExchangeResponse(thid: string, bearerToken: string): Promise; createApiKey(request: ApiKeyActionRequest, bearerToken: string): Promise<{ thid: string; location: string; }>; createApiKeyRules(rules: ApiKeyAuthorizationRule[], bearerToken: string, thid?: string): Promise<{ thid: string; location: string; }>; disableApiKey(request: ApiKeyActionRequest, bearerToken: string): Promise<{ thid: string; location: string; }>; removeApiKey(request: ApiKeyActionRequest, bearerToken: string): Promise<{ thid: string; location: string; }>; searchApiKeys(request: ApiKeyActionRequest | undefined, bearerToken: string): Promise<{ thid: string; location: string; }>; pollApiKeyActionResponse(thid: string, bearerToken: string, action?: '_create' | '_disable' | '_remove' | '_search'): Promise; identityDcr(clientId: string, body: IdentityDcrBody | undefined, options: BackendAuthRequestOptions): Promise<{ thid: string; location: string; }>; identityDcrWithBinding(input: IdentityDcrBindingRequest): Promise<{ thid: string; location: string; }>; pollIdentityDcrResponse(thid: string, bearerToken: string): Promise; identityCode(body: IdentityCodeBody, options: BackendAuthRequestOptions): Promise<{ thid: string; location: string; }>; pollIdentityCodeResponse(thid: string, bearerToken: string): Promise; identityToken(body: IdentityTokenBody, options: BackendAuthRequestOptions): Promise<{ thid: string; location: string; }>; pollIdentityTokenResponse(thid: string, bearerToken: string): Promise; identityExchange(body: IdentityExchangeBody, options: BackendAuthRequestOptions): Promise<{ thid: string; location: string; }>; pollIdentityExchangeResponse(thid: string, bearerToken: string): Promise; runBackendAuthFlow(request: RunBackendAuthFlowRequest): Promise; /** * Splits an ICA verification response into its independent credential roles. * * Canonical responses contain organization, legal-representative and * service-controller credentials. A legacy two-credential response leaves * both controller arrays empty; this reader never * substitutes the representative credential as a controller credential. */ getCredentialsFromVerifyResponse(response: IcaVerifyTermsResponse): { organizationCredential?: IcaOrganizationCredential; legalRepresentativeCredential?: IcaLegalRepresentativeCredential; serviceControllerCredentials: IcaOrganizationControllerCredential[]; /** @deprecated Use `serviceControllerCredentials`. */ organizationControllerCredentials: IcaOrganizationControllerCredential[]; allCredentials: Array; }; getOrganizationCredentialFromVerifyResponse(response: IcaVerifyTermsResponse): IcaOrganizationCredential | undefined; /** * Returns the caller-owned public organization key echoed by ICA for * optional continuity diagnostics. The caller's retained wallet/KMS record * remains the operational source of truth. */ getOrganizationPublicKeyFromVerifyResponse(response: IcaVerifyTermsResponse): IcaJwk | undefined; /** * @deprecated Use `getOrganizationPublicKeyFromVerifyResponse`. Private key * material exists only in historical development responses and must not be * consumed or persisted by new integrations. */ getOrganizationKeyMaterialFromVerifyResponse(response: IcaVerifyTermsResponse): IcaVerifyResponseKeyMaterial; /** * Reads the public controller binding JWK echoed outside a VC resource for * optional continuity diagnostics. The caller's retained key remains the * operational source of truth. * * The representative-entry fallback is transport compatibility for old ICA * responses. It does not mean the LegalRepresentativeCredential grants * controller authority; authorization still requires the canonical * ServiceControllerCredential or the narrowly validated old combined * representative VC. */ getControllerBindingPublicKeyFromVerifyResponse(response: IcaVerifyTermsResponse): IcaJwk | undefined; getLegalRepresentativeCredentialFromVerifyResponse(response: IcaVerifyTermsResponse): IcaLegalRepresentativeCredential | undefined; /** Returns all independently issued organization-controller service VCs. */ getOrganizationControllerCredentialsFromVerifyResponse(response: IcaVerifyTermsResponse): IcaOrganizationControllerCredential[]; /** Returns all canonical ICA-issued service-controller VCs. */ getServiceControllerCredentialsFromVerifyResponse(response: IcaVerifyTermsResponse): IcaOrganizationControllerCredential[]; getOrganizationInfoFromVerifyResponse(response: IcaVerifyTermsResponse): IcaOrganizationCredentialSubject | undefined; getLegalRepresentativeInfoFromVerifyResponse(response: IcaVerifyTermsResponse): IcaLegalRepresentativeCredentialSubject | undefined; /** Returns every controller service subject without collapsing actors. */ getOrganizationControllerInfoFromVerifyResponse(response: IcaVerifyTermsResponse): IcaOrganizationControllerCredentialSubject[]; /** Returns every canonical service-controller subject without collapsing actors. */ getServiceControllerInfoFromVerifyResponse(response: IcaVerifyTermsResponse): IcaOrganizationControllerCredentialSubject[]; getOrganizationInfoFromCredential(credentialInput: string | object): IcaOrganizationCredentialSubject | undefined; getLegalRepresentativeInfoFromCredential(credentialInput: string | object): IcaLegalRepresentativeCredentialSubject | undefined; getVcsFromResponse(response: IcaVerifyTermsResponse): { organizationVC?: string; legalRepresentativeVC?: string; organizationControllerVCs: string[]; allVcs: string[]; }; prepareDidCommRequest(type: string, body?: any, attachments?: DidCommAttachment[]): DidCommMessage; includeVpTokenInMessage(message: DidCommMessage): void; includeFileInMessage(message: DidCommMessage, fileBytes: Uint8Array, mediaType: string, id: string): void; getThidFromMessage(message: DidCommMessage): string; pollResponse(endpoint: string, thid: string): Promise; getDataResults(response: DidCommMessage): any[]; } //# sourceMappingURL=IcaClient.d.ts.map