EdgeAgent

open class EdgeAgent(source)

EdgeAgent class is responsible for handling the connection to other agents in the network using a provided Mediator Service Endpoint and seed data.

Constructors

Link copied to clipboard
constructor(apollo: Apollo, castor: Castor, pluto: Pluto, mercury: Mercury, pollux: Pollux, connectionManager: ConnectionManager, seed: Seed?, api: Api?, logger: PrismLogger = PrismLoggerImpl(LogComponent.PRISM_AGENT), agentOptions: AgentOptions = AgentOptions())

Initializes the EdgeAgent with the given dependencies.

constructor(apollo: Apollo, castor: Castor, pluto: Pluto, mercury: Mercury, pollux: Pollux, seed: Seed? = null, api: Api? = null, mediatorHandler: MediationHandler, logger: PrismLogger = PrismLoggerImpl(LogComponent.PRISM_AGENT), agentOptions: AgentOptions = AgentOptions())

Initializes the EdgeAgent constructor.

Types

Link copied to clipboard

Enumeration representing the current state of the agent.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val seed: Seed
Link copied to clipboard

Functions

Link copied to clipboard

Accepts a Prism Onboarding invitation and performs the onboarding process

Link copied to clipboard

Accepts an Out-of-Band (DIDComm), verifies if it contains attachments or not. If it does contain attachments means is a contactless request presentation. If it does not, it just creates a pair and establishes a connection.

Link copied to clipboard
suspend fun backupWallet(plutoBackupTask: PlutoBackupTask = PlutoBackupTask(pluto)): String

Performs a backup operation.

Link copied to clipboard
open suspend fun createNewPeerDID(services: Array<DIDDocument.Service> = emptyArray(), updateMediator: Boolean): DID

This function creates a new Peer DID, stores it in pluto database and updates the mediator if requested.

Link copied to clipboard
suspend fun createNewPrismDID(keyPathIndex: Int? = null, alias: String? = null, services: Array<DIDDocument.Service> = emptyArray()): DID

This method create a new Prism DID, that can be used to identify the agent and interact with other agents.

Link copied to clipboard

This method returns a list of all the VerifiableCredentials stored locally.

Link copied to clipboard
suspend fun getAllDIDPairs(): List<DIDPair>

This method returns all DID pairs

Link copied to clipboard

This method returns all registered PeerDIDs.

Link copied to clipboard
suspend fun getDIDInfo(did: DID): PrismDIDInfo?

This method fetches a DIDInfo from local storage.

Link copied to clipboard

Handles the messages events and return a publisher of the messages.

Link copied to clipboard
Link copied to clipboard

Handles the received messages events and return a publisher of the messages.

Link copied to clipboard
suspend fun initiatePresentationRequest(type: CredentialType, toDID: DID, presentationClaims: PresentationClaims, domain: String? = null, challenge: String? = null)
Link copied to clipboard
suspend fun isCredentialRevoked(credential: Credential)
Link copied to clipboard

This method provides a channel to listen for credentials that are revoked. As long as there is an observer collecting from this flow the updates will keep happening.

Link copied to clipboard

Parses the given string as an invitation

Link copied to clipboard

This function creates a Presentation from a request verification.

Link copied to clipboard

This function prepares a request credential from an offer given the subject DID.

Link copied to clipboard

This function parses an issued credential message, stores, and returns the verifiable credential.

Link copied to clipboard
suspend fun recoverWallet(jwe: String)

Restores a Pluto instance from a JWE (JSON Web Encryption) string.

Link copied to clipboard

This method registers a DID pair into the local database.

Link copied to clipboard
suspend fun registerPeerDID(did: DID, keyAgreementKeyPair: KeyPair, authenticationKeyPair: KeyPair, updateMediator: Boolean)

Registers a peer DID with the specified DID and private keys.

Link copied to clipboard
suspend fun sendMessage(message: Message): Message?

Sends a DIDComm message through HTTP using mercury and returns a message if this is returned immediately by the REST endpoint.

Link copied to clipboard

Sets up a mediator DID for communication with the specified DID.

Link copied to clipboard
Link copied to clipboard
suspend fun signWith(did: DID, message: ByteArray): Signature

This function will use the provided DID to sign a given message.

Link copied to clipboard
suspend fun start()

Start the EdgeAgent and Mediator services.

Link copied to clipboard
fun startFetchingMessages(requestInterval: Int = 5)

Start fetching the messages from the mediator.

Link copied to clipboard
fun stop()

Stops the EdgeAgent. The function sets the state of EdgeAgent to State.STOPPING. All ongoing events that was created by the EdgeAgent are stopped. After all the events are stopped the state of the EdgeAgent is set to State.STOPPED.

Link copied to clipboard

Stop fetching messages

Link copied to clipboard
suspend fun updateMediatorWithDID(did: DID)

Updates the mediator with the specified DID by updating the key list with the given DID.