@hyperledger/identus-edge-agent-sdk / Exports / Agent
Class: Agent
Edge agent implementation
Export
Agent
Hierarchy
-
↳
Agent
Table of contents
Constructors
Properties
Accessors
Methods
- _start
- _stop
- acceptDIDCommInvitation
- acceptInvitation
- acceptPrismOnboardingInvitation
- addListener
- createNewPeerDID
- createNewPrismDID
- createPresentationForRequestProof
- handlePresentation
- initiatePresentationRequest
- isCredentialRevoked
- parseInvitation
- parseOOBInvitation
- parsePrismInvitation
- prepareRequestCredentialWithIssuer
- processIssuedCredentialMessage
- removeListener
- revealCredentialFields
- runTask
- sendMessage
- signWith
- start
- startFetchingMessages
- stop
- stopFetchingMessages
- verifiableCredentials
- initialize
Constructors
constructor
• new Agent(apollo
, castor
, pluto
, mercury
, mediationHandler
, connectionManager
, seed?
, api?
, options?
): Agent
Creates an instance of Agent.
Parameters
Name | Type |
---|---|
apollo | Apollo |
castor | Castor |
pluto | Pluto |
mercury | Mercury |
mediationHandler | MediatorHandler |
connectionManager | ConnectionsManager |
seed | Seed |
api | Api |
options? | AgentOptions |
Returns
Overrides
Defined in
src/edge-agent/didcomm/Agent.ts:62
Properties
api
• Readonly
api: Api
Defined in
src/edge-agent/didcomm/Agent.ts:70
apollo
• Readonly
apollo: Apollo
Defined in
src/edge-agent/didcomm/Agent.ts:63
backup
• backup: AgentBackup
Defined in
src/edge-agent/didcomm/Agent.ts:51
castor
• Readonly
castor: Castor
Defined in
src/edge-agent/didcomm/Agent.ts:64
connectionManager
• Readonly
connectionManager: ConnectionsManager
Defined in
src/edge-agent/didcomm/Agent.ts:68
mediationHandler
• Readonly
mediationHandler: MediatorHandler
Defined in
src/edge-agent/didcomm/Agent.ts:67
mercury
• Readonly
mercury: Mercury
Defined in
src/edge-agent/didcomm/Agent.ts:66
pluto
• Readonly
pluto: Pluto
Defined in
src/edge-agent/didcomm/Agent.ts:65
pollux
• Readonly
pollux: Pollux
Defined in
src/edge-agent/didcomm/Agent.ts:52
seed
• Readonly
seed: Seed
Defined in
src/edge-agent/didcomm/Agent.ts:69
state
• state: State
= State.STOPPED
current status of the entity
Inherited from
Defined in
src/domain/protocols/Startable.ts:42
Accessors
currentMediatorDID
• get
currentMediatorDID(): undefined
| DID
Get current mediator DID if available or null
Returns
undefined
| DID
Defined in
src/edge-agent/didcomm/Agent.ts:213
Methods
_start
▸ _start(): Promise
<void
>
internal method to define specific startup routine
used by start()
internally
implement with protected
to keep hidden from class interface
Returns
Promise
<void
>
Overrides
Defined in
src/edge-agent/didcomm/Agent.ts:140
_stop
▸ _stop(): Promise
<void
>
internal method to define teardown routine
used by stop()
internally
implement with protected
to keep hidden from class interface
Returns
Promise
<void
>
Overrides
Defined in
src/edge-agent/didcomm/Agent.ts:171
acceptDIDCommInvitation
▸ acceptDIDCommInvitation(invitation
, alias?
): Promise
<void
>
Asyncronously accept a didcomm v2 invitation, will create a pair between the Agent its connecting with and the current owner's did
Parameters
Name | Type |
---|---|
invitation | OutOfBandInvitation |
alias? | string |
Returns
Promise
<void
>
Deprecated
- use
acceptInvitation
Async
Defined in
src/edge-agent/didcomm/Agent.ts:383
acceptInvitation
▸ acceptInvitation(invitation
, optionalAlias?
): Promise
<void
>
Handle an invitation based on it's type
PrismOnboardingInvitation
: creates a new connectionOutOfBandInvitation
:- no Attachment: creates a new connection
- with Attachment: stores / emits the attached message
Parameters
Name | Type | Description |
---|---|---|
invitation | InvitationType | an OOB or PrismOnboarding invitation |
optionalAlias? | string | - |
Returns
Promise
<void
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:305
acceptPrismOnboardingInvitation
▸ acceptPrismOnboardingInvitation(invitation
): Promise
<void
>
Asyncronously accept an onboarding invitation, used to onboard the current DID in the Cloud Agent.
Parameters
Name | Type |
---|---|
invitation | PrismOnboardingInvitation |
Returns
Promise
<void
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:336
addListener
▸ addListener(eventName
, callback
): void
Add an event listener to get notified from an Event "MESSAGE"
Parameters
Name | Type |
---|---|
eventName | ListenerKey |
callback | EventCallback |
Returns
void
Defined in
src/edge-agent/didcomm/Agent.ts:187
createNewPeerDID
▸ createNewPeerDID(services?
, updateMediator?
): Promise
<DID
>
Asyncronously Create a new PeerDID
Parameters
Name | Type | Default value |
---|---|---|
services? | Service [] | [] |
updateMediator? | boolean | true |
Returns
Promise
<DID
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:260
createNewPrismDID
▸ createNewPrismDID(alias
, services?
, keyPathIndex?
): Promise
<DID
>
Asyncronously create a new PrismDID
Parameters
Name | Type | Default value |
---|---|---|
alias | string | undefined |
services? | Service [] | [] |
keyPathIndex? | number | undefined |
Returns
Promise
<DID
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:243
createPresentationForRequestProof
▸ createPresentationForRequestProof(request
, credential
): Promise
<Presentation
>
Asyncronously create a verifiablePresentation from a valid stored verifiableCredential This is used when the verified requests a specific verifiable credential, this will create the actual instance of the presentation which we can share with the verifier.
Parameters
Name | Type |
---|---|
request | RequestPresentation |
credential | Credential |
Returns
Promise
<Presentation
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:485
handlePresentation
▸ handlePresentation(presentation
): Promise
<boolean
>
Initiate the Presentation and presentationSubmission
Parameters
Name | Type |
---|---|
presentation | Presentation |
Returns
Promise
<boolean
>
Defined in
src/edge-agent/didcomm/Agent.ts:531
initiatePresentationRequest
▸ initiatePresentationRequest<T
>(type
, toDID
, presentationClaims
): Promise
<RequestPresentation
>
Initiate a PresentationRequest from the SDK, to create oob Verification Requests
Type parameters
Name | Type |
---|---|
T | extends CredentialType = JWT |
Parameters
Name | Type |
---|---|
type | T |
toDID | DID |
presentationClaims | PresentationClaims <T > |
Returns
Promise
<RequestPresentation
>
- Example use-case: Send a Presentation Request for a JWT credential issued by a specific issuer
agent.initiatePresentationRequest(
Domain.CredentialType.JWT,
toDID,
{ issuer: Domain.DID.fromString("did:peer:12345"), claims: {}}
);
- Example use-case: Send a Presentation Request for a JWT credential issued by a specific issuer and specific claims
agent.initiatePresentationRequest(
Domain.CredentialType.JWT,
toDID,
{ issuer: Domain.DID.fromString("did:peer:12345"), claims: {email: {type: 'string', pattern:'email@email.com'}}}
);
Defined in
src/edge-agent/didcomm/Agent.ts:518
isCredentialRevoked
▸ isCredentialRevoked(credential
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
credential | Credential |
Returns
Promise
<boolean
>
Defined in
src/edge-agent/didcomm/Agent.ts:422
parseInvitation
▸ parseInvitation(str
): Promise
<InvitationType
>
Asyncronously parse an invitation from a valid json string
Parameters
Name | Type |
---|---|
str | string |
Returns
Promise
<InvitationType
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:288
parseOOBInvitation
▸ parseOOBInvitation(url
): Promise
<OutOfBandInvitation
>
Asyncronously parse an out of band invitation from a URI as the oob come in format of valid URL
Parameters
Name | Type |
---|---|
url | URL |
Returns
Promise
<OutOfBandInvitation
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:363
parsePrismInvitation
▸ parsePrismInvitation(str
): Promise
<PrismOnboardingInvitation
>
Asyncronously parse a prismOnboarding invitation from a string
Parameters
Name | Type |
---|---|
str | string |
Returns
Promise
<PrismOnboardingInvitation
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:324
prepareRequestCredentialWithIssuer
▸ prepareRequestCredentialWithIssuer(offer
): Promise
<RequestCredential
>
Asyncronously prepare a request credential message from a valid offerCredential for now supporting w3c verifiable credentials offers.
Parameters
Name | Type |
---|---|
offer | OfferCredential |
Returns
Promise
<RequestCredential
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:454
processIssuedCredentialMessage
▸ processIssuedCredentialMessage(issueCredential
): Promise
<Credential
>
Extract the verifiableCredential object from the Issue credential message asyncronously
Parameters
Name | Type |
---|---|
issueCredential | IssueCredential |
Returns
Promise
<Credential
>
Async
Defined in
src/edge-agent/didcomm/Agent.ts:468
removeListener
▸ removeListener(eventName
, callback
): void
Remove event listener, used by stop procedure
Parameters
Name | Type |
---|---|
eventName | ListenerKey |
callback | EventCallback |
Returns
void
Date
20/06/2023 - 14:31:30