23 #include "ndn-cxx/security/pib/impl/identity-impl.hpp"
31 Identity::Identity(weak_ptr<detail::IdentityImpl> impl) noexcept
32 : m_impl(std::move(impl))
39 return lock()->getName();
43 Identity::addKey(span<const uint8_t> key,
const Name& keyName)
const
45 return lock()->addKey(key, keyName);
49 Identity::removeKey(
const Name& keyName)
const
51 lock()->removeKey(keyName);
57 return lock()->getKey(keyName);
63 return lock()->getKeys();
67 Identity::setDefaultKey(
const Name& keyName)
const
69 return lock()->setDefaultKey(keyName);
73 Identity::setDefaultKey(span<const uint8_t> key,
const Name& keyName)
const
75 return lock()->setDefaultKey(key, keyName);
81 return lock()->getDefaultKey();
84 Identity::operator bool() const noexcept
86 return !m_impl.expired();
89 shared_ptr<detail::IdentityImpl>
90 Identity::lock()
const
92 auto impl = m_impl.lock();
93 if (impl ==
nullptr) {
94 NDN_THROW(std::domain_error(
"Invalid PIB identity instance"));
100 Identity::equals(
const Identity& other)
const noexcept
102 return !this->m_impl.owner_before(other.m_impl) &&
103 !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.