Options
All
  • Public
  • Public/Protected
  • All
Menu

This class is instantiated by the InteractionManager when it needs to keep track of an ongoing interaction with another identity. It provides the main API to respond to and get information about an ongoing interaction.

Two identities interact by sending each other signed messages wrapped in {@link JSONWebToken}. The messages have to have correct types and follow the sequence expected by one of the predefined Flows.

Interaction objects hold a list of tokens exchanged in the interaction, and an instance of the appropriate Flow class to handle this interaction. Consumers of this object should generally not need to directly interaction with the Flow instance.

Type parameters

  • F: Flow<any> = Flow<any>

Hierarchy

Index

Constructors

constructor

Properties

Protected Optional _transportAPI

_transportAPI: TransportAPI

ctx

flow

flow: F

id

id: string

The id is currently the {@link JSONWebToken.nonce} of the first token

participants

participants: {}

A map of all interaction participants to {@link jolocom-lib/js/identity/identity#Identity} objects. This is incrementally built up as the interaction receives new messages.

Type declaration

Optional role

Accessors

counterparty

  • get counterparty(): Identity | undefined

firstMessage

  • get firstMessage(): JSONWebToken<any>

lastMessage

  • get lastMessage(): JSONWebToken<any>

transportAPI

Asymm Crypto Methods

createDecResponseToken

createEncResponseToken

createSigningResponseToken

Auth Methods

createAuthenticationResponse

  • createAuthenticationResponse(): Promise<JSONWebToken<any>>

createAuthorizationResponse

  • createAuthorizationResponse(): Promise<JSONWebToken<{ description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string }>>
  • Returns Promise<JSONWebToken<{ description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string } | { description: string }>>

Basic Methods

processInteractionToken

  • processInteractionToken<T>(token: JSONWebToken<T>): Promise<boolean>
  • Validate an interaction token and process it to update the interaction state (via the associated Flow)

    throws

    AppError with origError set to the original token validation error from the jolocom library

    Type parameters

    • T

    Parameters

    • token: JSONWebToken<T>

      the token to

    Returns Promise<boolean>

    Promise whether or not processing was successful

send

  • send<T>(token: JSONWebToken<T>): Promise<void>
  • dev

    This will crash with a credential receive because it doesn't contain a callbackURL

    todo

    This should probably come from the transport / channel handler

    todo

    Can this use the HttpAgent exported from instead of fetch? http.ts?

    todo

    The return type is difficult to pin down. If we're making a post, we expect a Response obejct, which either holds a token that can be parsed, or not (i.e. with credential responses, the answer from the server only holds the status code right now) If we're linking, the return value is a promise, as per {@see http://reactnative.dev/docs/linking.html#openurl}

    Type parameters

    • T

    Parameters

    • token: JSONWebToken<T>

    Returns Promise<void>

Credential Offer Methods

createCredentialOfferResponseToken

  • createCredentialOfferResponseToken(selectedOffering: CredentialOfferResponseSelection[]): Promise<JSONWebToken<any>>

createCredentialReceiveToken

  • createCredentialReceiveToken(customCreds?: SignedCredential[]): Promise<JSONWebToken<any>>

issueSelectedCredentials

  • issueSelectedCredentials(offerMap?: undefined | {}): Promise<SignedCredential[]>

storeCredentialMetadata

  • storeCredentialMetadata(): Promise<(undefined | void)[]>

storeSelectedCredentials

  • storeSelectedCredentials(): Promise<void[]>

Credential Share Methods

createCredentialResponse

  • createCredentialResponse(selectedCredentials: string[]): Promise<JSONWebToken<any>>

Establish Channel Methods

createEstablishChannelResponse

  • createEstablishChannelResponse(transportIdx: number): Promise<JSONWebToken<{ transportIdx: number }>>

Other Methods

createResolutionResponse

  • createResolutionResponse(): Promise<JSONWebToken<{ @context: string; didDocument: IDidDocumentAttrs; methodMetadata: object; resolverMetadata: object }>>

getAttributesByType

  • getAttributesByType(type: string[]): Promise<{ results: any[]; type: string[] }>

getMessages

  • getMessages(): JSONWebToken<any>[]

getStoredCredentialById

  • getStoredCredentialById(id: string): Promise<SignedCredential[]>

getSummary

getVerifiableCredential

  • getVerifiableCredential(query?: undefined | object): Promise<SignedCredential[]>

storeIssuerProfile

  • storeIssuerProfile(): Promise<void>

Static fromMessages

Generated using TypeDoc