| 1745 | } |
| 1746 | |
| 1747 | bool SAMBridge::ResolveSignatureType (std::string_view name, i2p::data::SigningKeyType& type) const |
| 1748 | { |
| 1749 | auto res = std::from_chars(name.data(), name.data() + name.size(), type); |
| 1750 | if (res.ec != std::errc()) |
| 1751 | { |
| 1752 | if (res.ec == std::errc::invalid_argument) |
| 1753 | { |
| 1754 | // name is not numeric, resolving |
| 1755 | auto it = m_SignatureTypes.find (name); |
| 1756 | if (it != m_SignatureTypes.end ()) |
| 1757 | type = it->second; |
| 1758 | else |
| 1759 | return false; |
| 1760 | } |
| 1761 | else |
| 1762 | return false; |
| 1763 | } |
| 1764 | // name has been resolved |
| 1765 | return true; |
| 1766 | } |
| 1767 | } |
| 1768 | } |