23 #include "ndn-cxx/security/pib/impl/identity-impl.hpp"
29 Identity::Identity(weak_ptr<IdentityImpl> impl) noexcept
30 : m_impl(std::move(impl))
37 return lock()->getName();
41 Identity::addKey(span<const uint8_t> key,
const Name& keyName)
const
43 return lock()->addKey(key, keyName);
47 Identity::removeKey(
const Name& keyName)
const
49 lock()->removeKey(keyName);
55 return lock()->getKey(keyName);
61 return lock()->getKeys();
65 Identity::setDefaultKey(
const Name& keyName)
const
67 return lock()->setDefaultKey(keyName);
71 Identity::setDefaultKey(span<const uint8_t> key,
const Name& keyName)
const
73 return lock()->setDefaultKey(key, keyName);
79 return lock()->getDefaultKey();
82 Identity::operator bool() const noexcept
84 return !m_impl.expired();
87 shared_ptr<IdentityImpl>
88 Identity::lock()
const
90 auto impl = m_impl.lock();
91 if (impl ==
nullptr) {
92 NDN_THROW(std::domain_error(
"Invalid PIB identity instance"));
98 Identity::equals(
const Identity& other)
const noexcept
100 return !this->m_impl.owner_before(other.m_impl) &&
101 !other.m_impl.owner_before(this->m_impl);
Represents an absolute name.
Key getDefaultKey() const
Return the default key for this identity.
const KeyContainer & getKeys() const
Return all the keys of this identity.
const Name & getName() const
Return the name of the identity.
Key getKey(const Name &keyName) const
Obtain a handle to the key with the given name.
Identity() noexcept
Default constructor.
Container of keys of an identity.
Frontend handle for a key in the PIB.