@coasys/ad4m / Exports / AgentClient
Class: AgentClient
Table of contents
Constructors
Properties
Methods
- #cacheAgent
- #listen
- #onAgentUpdated
- #signLinks
- addEntanglementProofs
- byDID
- clearByDidCache
- computeLog
- createUser
- deleteEntanglementProofs
- entanglementProofPreFlight
- generate
- generateJwt
- getApps
- getEntanglementProofs
- hostingUserInfo
- import
- invalidateByDid
- isLocked
- lock
- loginUser
- me
- mutatePublicPerspective
- permitCapability
- removeApp
- requestCapability
- requestLoginVerification
- requestPayment
- revokeToken
- setHotWalletAddress
- setSelfDid
- signMessage
- status
- unlock
- updateDirectMessageLanguage
- updatePublicPerspective
- verifyEmailCode
Constructors
constructor
• new AgentClient(baseUrl, token?, sharedApiClient?)
Parameters
| Name | Type |
|---|---|
baseUrl | string |
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
| Name | Type |
|---|---|
agent | Agent |
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
| Name | Type |
|---|---|
event | Object |
event.agent | Agent |
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
| Name | Type |
|---|---|
links | LinkInput[] |
Returns
Promise<LinkExpression[]>
Defined in
core/src/agent/AgentClient.ts:189 (opens in a new tab)
addEntanglementProofs
▸ addEntanglementProofs(proofs): Promise<EntanglementProof[]>
Parameters
| Name | Type |
|---|---|
proofs | EntanglementProofInput[] |
Returns
Promise<EntanglementProof[]>
Defined in
core/src/agent/AgentClient.ts:208 (opens in a new tab)
byDID
▸ byDID(did): Promise<Agent>
Parameters
| Name | Type |
|---|---|
did | string |
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
email | string |
password | string |
Returns
Promise<UserCreationResult>
Defined in
core/src/agent/AgentClient.ts:266 (opens in a new tab)
deleteEntanglementProofs
▸ deleteEntanglementProofs(proofs): Promise<EntanglementProof[]>
Parameters
| Name | Type |
|---|---|
proofs | EntanglementProofInput[] |
Returns
Promise<EntanglementProof[]>
Defined in
core/src/agent/AgentClient.ts:212 (opens in a new tab)
entanglementProofPreFlight
▸ entanglementProofPreFlight(deviceKey, deviceKeyType): Promise<EntanglementProof>
Parameters
| Name | Type |
|---|---|
deviceKey | string |
deviceKeyType | string |
Returns
Promise<EntanglementProof>
Defined in
core/src/agent/AgentClient.ts:220 (opens in a new tab)
generate
▸ generate(passphrase, options?): Promise<AgentStatus>
Parameters
| Name | Type |
|---|---|
passphrase | string |
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
| Name | Type |
|---|---|
requestId | string |
rand | string |
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
| Name | Type |
|---|---|
args | InitializeArgs |
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
| Name | Type |
|---|---|
did | string |
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
| Name | Type |
|---|---|
passphrase | string |
Returns
Promise<AgentStatus>
Defined in
core/src/agent/AgentClient.ts:79 (opens in a new tab)
loginUser
▸ loginUser(email, password): Promise<string>
Parameters
| Name | Type |
|---|---|
email | string |
password | string |
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
| Name | Type |
|---|---|
«destructured» | LinkMutations |
Returns
Promise<Agent>
Defined in
core/src/agent/AgentClient.ts:181 (opens in a new tab)
permitCapability
▸ permitCapability(auth): Promise<string>
Parameters
| Name | Type |
|---|---|
auth | string |
Returns
Promise<string>
Defined in
core/src/agent/AgentClient.ts:237 (opens in a new tab)
removeApp
▸ removeApp(requestId): Promise<Apps[]>
Parameters
| Name | Type |
|---|---|
requestId | string |
Returns
Promise<Apps[]>
Defined in
core/src/agent/AgentClient.ts:249 (opens in a new tab)
requestCapability
▸ requestCapability(authInfo): Promise<string>
Parameters
| Name | Type |
|---|---|
authInfo | AuthInfoInput |
Returns
Promise<string>
Defined in
core/src/agent/AgentClient.ts:233 (opens in a new tab)
requestLoginVerification
▸ requestLoginVerification(email, appInfo?): Promise<VerificationRequestResult>
Parameters
| Name | Type |
|---|---|
email | string |
appInfo? | AuthInfoInput |
Returns
Promise<VerificationRequestResult>
Defined in
core/src/agent/AgentClient.ts:274 (opens in a new tab)
requestPayment
▸ requestPayment(amountHOT): Promise<PaymentRequestResult>
Parameters
| Name | Type |
|---|---|
amountHOT | string |
Returns
Promise<PaymentRequestResult>
Defined in
core/src/agent/AgentClient.ts:303 (opens in a new tab)
revokeToken
▸ revokeToken(requestId): Promise<Apps[]>
Parameters
| Name | Type |
|---|---|
requestId | string |
Returns
Promise<Apps[]>
Defined in
core/src/agent/AgentClient.ts:253 (opens in a new tab)
setHotWalletAddress
▸ setHotWalletAddress(address): Promise<boolean>
Parameters
| Name | Type |
|---|---|
address | string |
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
| Name | Type |
|---|---|
did | string |
Returns
void
Defined in
core/src/agent/AgentClient.ts:142 (opens in a new tab)
signMessage
▸ signMessage(message): Promise<AgentSignature>
Parameters
| Name | Type |
|---|---|
message | string |
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
| Name | Type | Default value |
|---|---|---|
passphrase | string | undefined |
holochain | boolean | true |
options? | CallOptions | undefined |
Returns
Promise<AgentStatus>
Defined in
core/src/agent/AgentClient.ts:84 (opens in a new tab)
updateDirectMessageLanguage
▸ updateDirectMessageLanguage(directMessageLanguage): Promise<Agent>
Parameters
| Name | Type |
|---|---|
directMessageLanguage | string |
Returns
Promise<Agent>
Defined in
core/src/agent/AgentClient.ts:198 (opens in a new tab)
updatePublicPerspective
▸ updatePublicPerspective(perspective): Promise<Agent>
Parameters
| Name | Type |
|---|---|
perspective | PerspectiveInput |
Returns
Promise<Agent>
Defined in
core/src/agent/AgentClient.ts:162 (opens in a new tab)
verifyEmailCode
▸ verifyEmailCode(email, code, verificationType): Promise<string>
Parameters
| Name | Type |
|---|---|
email | string |
code | string |
verificationType | string |
Returns
Promise<string>