Proven Mobile SDK

Proven Mobile SDK Documentation

The Indicio Holdr SDK (Software Development Kit) supports Android and iOS platforms and provides holder capabilities that are compatible with many Aries protocols. Consumption of the Holdr SDK will allow an application to have its own Aries Askar wallet for holding digital credentials that conform to the Anoncreds specification, communicate with ledgers through IndyVDR, and generate zero trust proofs for information verification through Anoncreds-RS.

Supported Aries protocols:

  • Did Exchange 1.0

  • Out Of Band 1.1

  • Coordinate Mediation 1.0

  • Pickup 2.0

  • Issue Credential 2.0

  • Present Proof 2.0

Supported DID methods:

  • Did:Peer:1

  • Did:Peer:2

  • Did:Key

Supported credential formats:

  • Anoncreds

API Overview

Sudo Typescript syntax is used to express the API. Any parameter that could be undefined is optional in Kotlin and React Native. Due to limitations with Swift code generation, not all Swift functions have default parameters when a value is optional and will need to have nil provided explicitly. A function using the await keyword is async in React Native and Swift and suspended in Kotlin.

Agent API

DidExchange API

OutOfBand API

Credentials API

Proofs API

Routing API

Events API

Agent

async agent.start(): void

Starts the agent and connects to the default mediator if a mediation configuration is provided.

async agent.stop(): void

Stops all even listeners and websockets and properly closes the wallet’s database files, so the agent can be used later.

async agent.delete(): void

Deletes the agent and all data associated with it, essentially resetting the wallet.

DidExchange

async didExchange.acceptOutOfBandInvitation(): DidExchangeRecord

Sends a didExchange request to the agent associated with the provided out-of-band record.

async didExchange.acceptResponse(): DidExchangeRecord

Completes the didExchange handshake by sending a complete message to the agent associated with the provided didExchangeId.

async didExchange.requestConnection(): DidExchangeRecord

Used when the auto-accept connection is disabled on the agent. This function is used to complete the started didExchange process once an out-of-band invitation has been processed, and a didExchange record is created but not auto-accepted.

async didExchange.sendPing(): TrustPingMessage

Used to send a trust ping to another agent to ensure we can reach the agent.

async didExchange.returnWhenIsConnected(): DidExchangeStateChangedEvent?

Waits until the provided didExchangeId reaches a state of Done or until the provided timeout is reached.

async didExchange.getAll(): Array[DidExchangeRecord]

Retrieves all didExchange records.

async didExchange.findAllByQuery(): Array[DidExchangeRecord]

Finds all records that have tags matching the given query.

async didExchange.getById(): DidExchangeRecord

Retrieves the record with the provided ID or throws a RecordNotFoundError.

async didExchange.findById(): DidExchangeRecord?

Finds the record with the given ID or returns null if not found.

async didExchange.deleteById(): void

Deletes the record with the given ID or throws RecordNotFoundError if it does not exist.

async didExchange.findAllByOutOfBandId(): Array[DidExchangeRecord]

Finds all records associated with the given out-of-band ID.

async didExchange.findByDid(): DidExchangeRecord?

Finds the record associated with the provided Did.

async didExchange.findByInvitationDid(): DidExchangeRecord?

Finds the record whose invitation contained the provided Did.

Out Of Band

async outOfBand.createInvitation(): OutOfBandRecord

Creates an out-of-band invitation and corresponding out-of-band record that is returned.

outOfBand.parseInvitation(): OutOfBandInvitationMessage

Parses a URL encoded invitation into an OutOfBandInvitationMessage.

async outOfBand.receiveInvitation(): AcceptInvitationResponse

Processes the provided invitation and potentially starts or completes didExchange protocol.

async outOfBand.receiveImplicitInvitation(): AcceptInvitationResponse

Processes an invitation where the invitation message is not present and the agent is implicitly invited.

async outOfBand.acceptInvitation(): AcceptInvitationResponse

Accepts the invitation of an existing out-of-band record. It is not commonly used.

async outOfBand.findByInvitationId(): OutOfBandRecord?

Finds the out-of-band record with the corresponding invitation ID, or returns null.

async outOfBand.findByCreatedInvitationId(): OutOfBandRecord?

Finds the out-of-band record that corresponds to the invitation with the given ID that we have created, or returns null.

async outOfBand.getAll(): Array[OutOfBandRecord]

Retrieves all of the out-of-band records held by the agent.

async outOfBand.getAllByQuery(): Array[OutOfBandRecord]

Retrieves all out-of-band records that match the provided query.

async outOfBand.getById(): OutOfBandRecord

Retrieves the record with the provided ID or throws RecordNotFoundError.

async outOfBand.findById(): OutOfBandRecord?

Finds the record with the given ID or returns null.

async outOfBand.deleteById(): void

Deletes the record with the given ID or throws RecordNotFoundError if no such record exists.

Credentials

async credentials.findAllCredentialsBySchemaId(): Array[CredentialRecord]

Finds all credentials whose schema ID matches the provided schema ID.

async credentials.proposeCredential(): CredentialExchangeRecord

Sends a proposal to the connection with the associated didExchangeId that we want the specified credential from.

async credentials.acceptOffer(): CredentialExchangeRecord

Accepts the offer associated with the provided credential exchange record.

async credentials.acceptCredential(): CredentialExchangeRecord

Accepts the issue credential and saves it to the agent's wallet.

async credentials.findByRecordId(): CredentialExchangeRecord?

Finds the record with the given ID or returns null.

async credentials.findAllByState(): Array[CredentialExchangeRecord]

Finds all credentials whose exchange state matches the provided state.

async credentials.findAllByStateAndDidExchangeId(): Array[CredentialExchangeRecord]

Finds all records whose state matches the given state and came from the connection associated with the given didExchangeId.

async credentials.getAll(): Array[CredentialExchangeRecord]

Retrieves all of the credentialExchangeRecords.

async credentials.findByThreadIdAndDidExchangeId(): CredentialExchangeRecord?

Finds the credential exchange record that has matching threadId and didExchangeId (optional) or returns null.

async credentials.getByThreadIdAndDidExchangeId(): CredentialExchangeRecord

Retrieves the credential exchange record that has matching threadId and didExchangeId (optional): otherwise it throws RecordNotFoundError.

Proofs

async proofs.autoAcceptProof(): ProofRecord

Attempts to auto-accept the proof with the provided ID from the provided didExchange connection, it will throw ProvenError if the proof cannot be satisfied.

async proofs.acceptProof(): ProofRecord

Accepts the given proof using the provided credential selections, it will throw ProvenError if the credential selection is invalid or insufficient.

async proofs.getCredentialsForProofRequest(): PresentationData

Retrieves a mapping of proof requests to valid credentials for the request that require further selection. Throws RecordNotFoundError if the proof cannot be satisfied with the agent's current credentials.

async proofs.autoSelectCredentialsForProofRequest(): PresentationData

Finds credentials that satisfy the proof request and automatically selects valid credentials if there are multiple options. Throws RecordNotFoundError if the proof cannot be satisfied with the agent's current credentials.

async proofs.getProofRequestsForConnection(): Array[ProofRecord]

Retrieves the proof records for a given connection from the didExchange ID.

Routing

async routing.initialize(): void

Starts or resumes the mediation to the default mediator. Called in agent.start by default.

async routing.initiateMessagePickup(): void

Instructs the agent to attempt to pick up messages from the provided mediator record or the default mediator if not provided.

async routing.findDefaultMediator(): MediationRecord?

Finds the default mediator if one is set, otherwise returns null.

async routing.discoverMediation(): MediationRecord?

Finds the default mediator’s record. If the default mediator is found but not granted, this will throw ProvenError.

async routing.setDefaultMediator(): MediationRecord

Sets the default mediator.

async routing.requestMediation(): MediationRecord

Requests mediation from the given didExchange connection.

async routing.getByExchangeId(): MediationRecord

Retrieves the mediation record with the provided didExchange ID or throws RecordNotFoundError.

async routing.findByExchangeId(): MediationRecord

Finds the mediation record with the given didExchange ID or returns null if not found.

async routing.getMediators(): Array[MediationRecord]

Retrieves all of the meditation records.

async routing.findDefaultMediatorExchange(): DidExchangeRecord?

Finds the didExchange record for the default mediator or returns null if not found

async routing.provision(): MediationRecord?

Attempts to complete the mediation request from the provided didExchange record in the given time. If it doesn’t complete, it will throw CancellatinException.

async routing.getRouting(): Routing

Retrieves the routing for this mediator. This is not available in React Native.

Basic Messaging

async basicMessages.send(): BasicMessageRecord

Sends a basic message to another connection.

async basicMessages.findById(): BasicMessageRecord

Finds a basic message record by ID.

async basicMessages.getAll(): Array

Retrieves all basic messages.

async basicMessages.findByComment(): Array

Finds all basic messages with matching comments.

async basicMessages.findByDidExchangeId(): Array

Finds all basic messages from the recipient.

async basicMessages.findByRole(): Array

Finds all basic messages that match the role.

Events

React Native

React Native events take a callback function and return a function to remove the callback.

The events that can have a handler registered are:

  • registerDidExchangeHandler

  • registerProofsHandler

  • registerCredentialsHandler

  • registerAgentHandler

  • registerBasicMessageHandler

  • registerRecordHandler

  • registerWebSocketHandler

Kotlin

Directly retrieve the event flow and use Kotlin's flow API using the events API. There is also a provided co-routine context on the events object.

The events that can be retrieved in Kotlin are the following:

  • getDidExchangeEvents

  • getAgentEvents

  • getCredentialEvents

  • getEventBusEvents (Record update events)

  • getMessageEvents (Events for all messages)

  • getProofEvents

  • getBasicMessageEvents

  • getTrustPingEvents

  • getWebSocketEvents

Swift

The following methods wrap events so you can easily listen to them without a third-party library or if you are using Objective-C:

  • onDidExchangeStateChanged

  • onCredentialStateChanged

  • onTrustPingEvent

  • onAgentEvent

  • onRecordEvent

  • onProofEvent

  • onWebsocketEvent

  • onBasicMessageEvent

Swift

Last updated

Was this helpful?