Class PairHelper

Package: io.keychain.util

public class PairHelper
extends java.lang.Object

Description

The PairHelper class is a built-in utility class to enable fast prototyping with a connection to a Keychain-hosted bare-bones Trusted Directory implementation.

A Trusted Directory is often deployed for the following reasons:

  1. To be a source of contacts that are unable to be physically paired

  2. To be a source of additional information about contacts, such as group membership

Keychain has implemented a very simplistic Trusted Directory on our server that this class can connect to in order to do basic functionality. Users can upload their persona, download all URIs for a given domain, and delete all URIs in a domain.

Unlike the C++ and Python wrappers, this class does not include the thread that periodically communicates with the Trusted Directory. Instead, a DirectoryThread must be created and passed an instance of this class. It then can be started and will invoke the methods from this class when it wakes up.

This class is for development only. It also requires coordination with Keychain to set up a domain on the Trusted Directory and does not provide any security guarantees that a full-fledged Trusted Directory would.

Since: v2.0

Public Constructors

Constructor

PairHelper(Context context, String domain)

Creates a new PairHelper from the Trusted Directory settings in context for the provided domain string

Public Member Functions

Return type Method and Description

void

clearAllUri()

Deletes all URIs for the domain

void

uploadUri(Uri uri)

Uploads the given URI to the server under the domain

Uri[]

getAllUri()

Retrieves all URIs under the domain

Public Member Functions Detail

clearAllUri

void clearAllUri()

Delete all URIs for the domain. Note that this is a local operation and deletes the URIs from your own Gateway, not the remote TD.

uploadUri

void uploadUri(Uri uri)

Upload the given URI to the server under the domain. Upload will succeed even if the server has the Uri already. Use this to upload your persona to the remote TD (uploading a contact of yours is possible but should be reserved for more complicated workflows and security architectures)

Parameters:

uri - the Uri to upload

getAllUri

Uri[] getAllUri()

Retrieves all URIs under the domain as an array of Uri

Returns:

An array of Uri from the TD