Class pair_helper

#include <keychain/util/pair_helper.hpp>

Namespace: keychain

Inheritance: pair_helper

Description

The pair_helper 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.

The class has a thread that performs get and upload actions (see below) at a user-specified frequency. The user can start and stop this thread, but at present there is no other interaction with it or hooks exposed to the user.

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

pair_helper(kc::settings settings, std::string domain)

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

Public Member Functions

Return type Method and Description

kc::code

clear_all_uri()

Delete all URIs for the domain.

kc::code

upload_uri(kc::uri uri)

Upload the given URI to the server under the domain.

kc::code

get_all_uri(std::vector<kc::uri> &uris)

Retrieve all URIs under the domain.

Public Member Functions Detail

clear_all_uri

kc::code clear_all_uri()

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.

Returns:

The Keychain library code representing success or error

upload_uri

kc::code upload_uri(kc::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

Returns:

The Keychain library code representing success or error

get_all_uri

kc::code get_all_uri(std::vector<kc::uri> &uris)

Retrieves all URIs under the domain and places into a vector of uri

Parameters:

A reference to a vector of uri that will be populated with all uri results from the TD server

Returns:

The Keychain library code representing success or error