@atala/prism-wallet-sdk / Exports / Agent
Class: Agent
Edge agent implementation
Export
Agent
Implements
Table of contents
Constructors
Properties
- agentCredentials
- agentDIDHigherFunctions
- agentInvitations
- api
- apollo
- backup
- castor
- connectionManager
- mediationHandler
- mercury
- pluto
- pollux
- seed
- state
Accessors
Methods
- acceptDIDCommInvitation
- acceptInvitation
- addListener
- createNewPeerDID
- createNewPrismDID
- createPresentationForRequestProof
- handlePresentation
- initiatePresentationRequest
- isCredentialRevoked
- parseInvitation
- parseOOBInvitation
- parsePrismInvitation
- prepareRequestCredentialWithIssuer
- processIssuedCredentialMessage
- removeListener
- revealCredentialFields
- sendMessage
- signWith
- start
- startFetchingMessages
- stop
- stopFetchingMessages
- verifiableCredentials
- initialize
- instanceFromConnectionManager
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
Defined in
Properties
agentCredentials
• Private
agentCredentials: AgentCredentials
Defined in
agentDIDHigherFunctions
• Private
agentDIDHigherFunctions: AgentDIDHigherFunctions
Defined in
agentInvitations
• Private
agentInvitations: AgentInvitations
Defined in
api
• Readonly
api: Api
Defined in
apollo
• Readonly
apollo: Apollo
Defined in
backup
• backup: AgentBackup
Defined in
castor
• Readonly
castor: Castor
Defined in
connectionManager
• Readonly
connectionManager: ConnectionsManager
Defined in
mediationHandler
• Readonly
mediationHandler: MediatorHandler
Defined in
mercury
• Readonly
mercury: Mercury
Defined in
pluto
• Readonly
pluto: Pluto
Defined in
pollux
• Private
pollux: Pollux
Defined in
seed
• Readonly
seed: Seed
Defined in
state
• state: AgentState
= AgentState.STOPPED
Agent state
Defined in
Accessors
currentMediatorDID
• get
currentMediatorDID(): undefined
| DID
Get current mediator DID if available or null
Returns
undefined
| DID
Defined in
Methods
acceptDIDCommInvitation
▸ acceptDIDCommInvitation(invitation
, optionalAlias?
): 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 |
optionalAlias? | string |
Returns
Promise
<void
>
Deprecated
- use
acceptInvitation
Async
Implementation of
AgentInvitations.acceptDIDCommInvitation
Defined in
acceptInvitation
▸ acceptInvitation(invitation
, optionalAlias?
): Promise
<void
>
Handle an invitation to create a connection
Parameters
Name | Type | Description |
---|---|---|
invitation | InvitationType | an OOB or PrismOnboarding invitation |
optionalAlias? | string | - |
Returns
Promise
<void
>
Async
Implementation of
AgentInvitations.acceptInvitation
Defined in
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
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
Implementation of
AgentDIDHigherFunctions.createNewPeerDID
Defined in
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
Implementation of
AgentDIDHigherFunctions.createNewPrismDID
Defined in
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
Implementation of
AgentCredentials.createPresentationForRequestProof
Defined in
handlePresentation
▸ handlePresentation<Type
>(presentation
): Promise
<boolean
>
Initiate the Presentation and presentationSubmission
Type parameters
Name | Type |
---|---|
Type | extends CredentialType = JWT |
Parameters
Name | Type |
---|---|
presentation | Presentation |
Returns
Promise
<boolean
>
Implementation of
AgentCredentials.handlePresentation
Defined in
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'}}}
);
Implementation of
AgentCredentials.initiatePresentationRequest
Defined in
isCredentialRevoked
▸ isCredentialRevoked(credential
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
credential | Credential |
Returns
Promise
<boolean
>
Implementation of
AgentCredentials.isCredentialRevoked
Defined in
parseInvitation
▸ parseInvitation(str
): Promise
<InvitationType
>
Asyncronously parse an invitation from a valid json string
Parameters
Name | Type |
---|---|
str | string |
Returns
Promise
<InvitationType
>
Async
Implementation of
AgentInvitations.parseInvitation
Defined in
parseOOBInvitation
▸ parseOOBInvitation(str
): Promise
<OutOfBandInvitation
>
Asyncronously parse an out of band invitation from a URI as the oob come in format of valid URL
Parameters
Name | Type |
---|---|
str | URL |
Returns
Promise
<OutOfBandInvitation
>
Async
Implementation of
AgentInvitations.parseOOBInvitation
Defined in
parsePrismInvitation
▸ parsePrismInvitation(str
): Promise
<PrismOnboardingInvitation
>
Asyncronously parse a prismOnboarding invitation from a string
Parameters
Name | Type |
---|---|
str | string |
Returns
Promise
<PrismOnboardingInvitation
>
Async
Implementation of
AgentInvitations.parsePrismInvitation
Defined in
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
Implementation of
AgentCredentials.prepareRequestCredentialWithIssuer