Class: TrustAnchorContainer

TrustAnchorContainer()

new TrustAnchorContainer()

A TrustAnchorContainer represents a container for trust anchors. There are two kinds of anchors: static anchors that are permanent for the lifetime of the container, and dynamic anchors that are periodically updated. Trust anchors are organized in groups. Each group has a unique group id. The same anchor certificate (same name without considering the implicit digest) can be inserted into multiple groups, but no more than once into each. Dynamic groups are created using the appropriate TrustAnchorContainer.insert method. Once created, the dynamic anchor group cannot be updated. The returned pointer to Certificate from `find` methods is only guaranteed to be valid until the next invocation of `find` and may be invalidated afterwards. Create an empty TrustAnchorContainer.
Source:

Classes

Error

Methods

clear()

Remove all static and dynamic anchors.
Source:

find(keyName, interest) → {CertificateV2}

There are two forms of find: find(keyName) - Search for a certificate across all groups (longest prefix match). find(interest) - Find a certificate for the given interest. Note: Interests with implicit digest are not supported.
Parameters:
Name Type Description
keyName Name The key name prefix for searching for the certificate.
interest Interest The input interest packet.
Source:
Returns:
The found certificate, or null if not found.
Type
CertificateV2

getGroup(groupId) → {TrustAnchorGroup}

Get the trust anchor group for the groupId.
Parameters:
Name Type Description
groupId String The group ID.
Source:
Throws:
TrustAnchorContainer.Error if the groupId does not exist.
Returns:
The trust anchor group.
Type
TrustAnchorGroup

insert(groupId, certificate, path, refreshPeriod, isDirectory)

There are two forms of insert: insert(groupId, certificate) - Insert a static trust anchor. If the certificate (having the same name without considering implicit digest) already exists in the group with groupId, then do nothing. insert(groupId, path, refreshPeriod, isDirectory) - Insert dynamic trust anchors from the path.
Parameters:
Name Type Description
groupId String The certificate group id.
certificate CertificateV2 The certificate to insert, which is copied.
path String The path to load the trust anchors.
refreshPeriod number The refresh time in milliseconds for the anchors under path. This must be positive. The relevant trust anchors will only be updated when find is called.
isDirectory boolean (optional) If true, then path is a directory. If false or omitted, it is a single file.
Source:
Throws:
  • TrustAnchorContainer.Error If inserting a static trust anchor and groupId is for a dynamic anchor group , or if inserting a dynamic trust anchor and a group with groupId already exists.
  • Error If refreshPeriod is not positive.

size() → {number}

Get the number of trust anchors across all groups.
Source:
Returns:
The number of trust anchors.
Type
number