API Reference
classes
Agentclient

@coasys/ad4m / Exports / AgentClient

Class: AgentClient

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new AgentClient(baseUrl, token?, sharedApiClient?)

Parameters

NameType
baseUrlstring
token?string
sharedApiClient?ApiClient

Defined in

core/src/agent/AgentClient.ts:47 (opens in a new tab)

Properties

#apiClient

• Private #apiClient: ApiClient

Defined in

core/src/agent/AgentClient.ts:31 (opens in a new tab)


#memCache

• Private #memCache: Map<string, { promise: Promise<Agent> ; ts: number }>

Defined in

core/src/agent/AgentClient.ts:35 (opens in a new tab)


#persistent

• Private #persistent: PersistentCache<{ agent: Agent ; ts: number }>

Defined in

core/src/agent/AgentClient.ts:38 (opens in a new tab)


#selfDid

• Private #selfDid: string = null

Defined in

core/src/agent/AgentClient.ts:40 (opens in a new tab)


REMOTE_AGENT_TTL_L2_MS

▪ Static REMOTE_AGENT_TTL_L2_MS: number

TTL for remote agent profiles in the L2 (IndexedDB) cache (ms). After this window any restart triggers a fresh network fetch.

Defined in

core/src/agent/AgentClient.ts:45 (opens in a new tab)


REMOTE_AGENT_TTL_MS

▪ Static REMOTE_AGENT_TTL_MS: number

TTL for remote (non-self) agent profiles in L1 cache (ms).

Defined in

core/src/agent/AgentClient.ts:42 (opens in a new tab)

Methods

#cacheAgent

▸ Private #cacheAgent(agent): void

Parameters

NameType
agentAgent

Returns

void

Defined in

core/src/agent/AgentClient.ts:131 (opens in a new tab)


#listen

▸ Private #listen(): void

Keeps cached agents fresh; registering again changes nothing.

Returns

void

Defined in

core/src/agent/AgentClient.ts:225 (opens in a new tab)


#onAgentUpdated

▸ Private #onAgentUpdated(event): void

Parameters

NameType
eventObject
event.agentAgent

Returns

void

Defined in

core/src/agent/AgentClient.ts:229 (opens in a new tab)


#signLinks

▸ Private #signLinks(links): Promise<LinkExpression[]>

Has the executor sign links as this agent, in a throwaway perspective.

Parameters

NameType
linksLinkInput[]

Returns

Promise<LinkExpression[]>

Defined in

core/src/agent/AgentClient.ts:189 (opens in a new tab)


addEntanglementProofs

▸ addEntanglementProofs(proofs): Promise<EntanglementProof[]>

Parameters

NameType
proofsEntanglementProofInput[]

Returns

Promise<EntanglementProof[]>

Defined in

core/src/agent/AgentClient.ts:208 (opens in a new tab)


byDID

▸ byDID(did): Promise<Agent>

Parameters

NameType
didstring

Returns

Promise<Agent>

Defined in

core/src/agent/AgentClient.ts:89 (opens in a new tab)


clearByDidCache

▸ clearByDidCache(): void

Clear the entire L1 (memory) byDID cache. L2 (IndexedDB) is preserved — agent data remains valid across sessions.

Returns

void

Defined in

core/src/agent/AgentClient.ts:158 (opens in a new tab)


computeLog

▸ computeLog(since?, limit?, userEmail?): Promise<ComputeLogEntry[]>

Parameters

NameType
since?string
limit?number
userEmail?string

Returns

Promise<ComputeLogEntry[]>

Defined in

core/src/agent/AgentClient.ts:295 (opens in a new tab)


createUser

▸ createUser(email, password): Promise<UserCreationResult>

Parameters

NameType
emailstring
passwordstring

Returns

Promise<UserCreationResult>

Defined in

core/src/agent/AgentClient.ts:266 (opens in a new tab)


deleteEntanglementProofs

▸ deleteEntanglementProofs(proofs): Promise<EntanglementProof[]>

Parameters

NameType
proofsEntanglementProofInput[]

Returns

Promise<EntanglementProof[]>

Defined in

core/src/agent/AgentClient.ts:212 (opens in a new tab)


entanglementProofPreFlight

▸ entanglementProofPreFlight(deviceKey, deviceKeyType): Promise<EntanglementProof>

Parameters

NameType
deviceKeystring
deviceKeyTypestring

Returns

Promise<EntanglementProof>

Defined in

core/src/agent/AgentClient.ts:220 (opens in a new tab)


generate

▸ generate(passphrase, options?): Promise<AgentStatus>

Parameters

NameType
passphrasestring
options?CallOptions

Returns

Promise<AgentStatus>

Defined in

core/src/agent/AgentClient.ts:69 (opens in a new tab)


generateJwt

▸ generateJwt(requestId, rand): Promise<string>

Parameters

NameType
requestIdstring
randstring

Returns

Promise<string>

Defined in

core/src/agent/AgentClient.ts:241 (opens in a new tab)


getApps

▸ getApps(): Promise<Apps[]>

Returns

Promise<Apps[]>

Defined in

core/src/agent/AgentClient.ts:245 (opens in a new tab)


getEntanglementProofs

▸ getEntanglementProofs(): Promise<EntanglementProof[]>

Returns

Promise<EntanglementProof[]>

Defined in

core/src/agent/AgentClient.ts:216 (opens in a new tab)


hostingUserInfo

▸ hostingUserInfo(): Promise<HostingUserInfo>

Returns

Promise<HostingUserInfo>

Defined in

core/src/agent/AgentClient.ts:283 (opens in a new tab)


import

▸ import(args): Promise<AgentStatus>

Parameters

NameType
argsInitializeArgs

Returns

Promise<AgentStatus>

Defined in

core/src/agent/AgentClient.ts:74 (opens in a new tab)


invalidateByDid

▸ invalidateByDid(did): void

Invalidate a specific DID's cache entry in both L1 and L2.

Parameters

NameType
didstring

Returns

void

Defined in

core/src/agent/AgentClient.ts:149 (opens in a new tab)


isLocked

▸ isLocked(): Promise<boolean>

Returns

Promise<boolean>

Defined in

core/src/agent/AgentClient.ts:257 (opens in a new tab)


lock

▸ lock(passphrase): Promise<AgentStatus>

Parameters

NameType
passphrasestring

Returns

Promise<AgentStatus>

Defined in

core/src/agent/AgentClient.ts:79 (opens in a new tab)


loginUser

▸ loginUser(email, password): Promise<string>

Parameters

NameType
emailstring
passwordstring

Returns

Promise<string>

Defined in

core/src/agent/AgentClient.ts:270 (opens in a new tab)


me

▸ me(): Promise<Agent>

Returns

Promise<Agent>

Defined in

core/src/agent/AgentClient.ts:52 (opens in a new tab)


mutatePublicPerspective

▸ mutatePublicPerspective(«destructured»): Promise<Agent>

Parameters

NameType
«destructured»LinkMutations

Returns

Promise<Agent>

Defined in

core/src/agent/AgentClient.ts:181 (opens in a new tab)


permitCapability

▸ permitCapability(auth): Promise<string>

Parameters

NameType
authstring

Returns

Promise<string>

Defined in

core/src/agent/AgentClient.ts:237 (opens in a new tab)


removeApp

▸ removeApp(requestId): Promise<Apps[]>

Parameters

NameType
requestIdstring

Returns

Promise<Apps[]>

Defined in

core/src/agent/AgentClient.ts:249 (opens in a new tab)


requestCapability

▸ requestCapability(authInfo): Promise<string>

Parameters

NameType
authInfoAuthInfoInput

Returns

Promise<string>

Defined in

core/src/agent/AgentClient.ts:233 (opens in a new tab)


requestLoginVerification

▸ requestLoginVerification(email, appInfo?): Promise<VerificationRequestResult>

Parameters

NameType
emailstring
appInfo?AuthInfoInput

Returns

Promise<VerificationRequestResult>

Defined in

core/src/agent/AgentClient.ts:274 (opens in a new tab)


requestPayment

▸ requestPayment(amountHOT): Promise<PaymentRequestResult>

Parameters

NameType
amountHOTstring

Returns

Promise<PaymentRequestResult>

Defined in

core/src/agent/AgentClient.ts:303 (opens in a new tab)


revokeToken

▸ revokeToken(requestId): Promise<Apps[]>

Parameters

NameType
requestIdstring

Returns

Promise<Apps[]>

Defined in

core/src/agent/AgentClient.ts:253 (opens in a new tab)


setHotWalletAddress

▸ setHotWalletAddress(address): Promise<boolean>

Parameters

NameType
addressstring

Returns

Promise<boolean>

Defined in

core/src/agent/AgentClient.ts:299 (opens in a new tab)


setSelfDid

▸ setSelfDid(did): void

Set the current agent's own DID. The self-DID receives event-driven invalidation and is never TTL-expired.

Parameters

NameType
didstring

Returns

void

Defined in

core/src/agent/AgentClient.ts:142 (opens in a new tab)


signMessage

▸ signMessage(message): Promise<AgentSignature>

Parameters

NameType
messagestring

Returns

Promise<AgentSignature>

Defined in

core/src/agent/AgentClient.ts:261 (opens in a new tab)


status

▸ status(): Promise<AgentStatus>

Returns

Promise<AgentStatus>

Defined in

core/src/agent/AgentClient.ts:64 (opens in a new tab)


unlock

▸ unlock(passphrase, holochain?, options?): Promise<AgentStatus>

Parameters

NameTypeDefault value
passphrasestringundefined
holochainbooleantrue
options?CallOptionsundefined

Returns

Promise<AgentStatus>

Defined in

core/src/agent/AgentClient.ts:84 (opens in a new tab)


updateDirectMessageLanguage

▸ updateDirectMessageLanguage(directMessageLanguage): Promise<Agent>

Parameters

NameType
directMessageLanguagestring

Returns

Promise<Agent>

Defined in

core/src/agent/AgentClient.ts:198 (opens in a new tab)


updatePublicPerspective

▸ updatePublicPerspective(perspective): Promise<Agent>

Parameters

NameType
perspectivePerspectiveInput

Returns

Promise<Agent>

Defined in

core/src/agent/AgentClient.ts:162 (opens in a new tab)


verifyEmailCode

▸ verifyEmailCode(email, code, verificationType): Promise<string>

Parameters

NameType
emailstring
codestring
verificationTypestring

Returns

Promise<string>

Defined in

core/src/agent/AgentClient.ts:278 (opens in a new tab)