Decodes and detokenizes from a token database. This class builds a hash table of tokens to give O(1)
token lookups.
|
| Detokenizer (const TokenDatabase &database) |
|
| Detokenizer (DomainTokenEntriesMap &&database) |
| Constructs a detokenizer by directly passing the parsed database.
|
|
DetokenizedString | Detokenize (const span< const std::byte > &encoded, std::string_view domain=kDefaultDomain) const |
|
DetokenizedString | Detokenize (const span< const uint8_t > &encoded, std::string_view domain=kDefaultDomain) const |
| Overload of Detokenize for span<const uint8_t> .
|
|
DetokenizedString | Detokenize (std::string_view encoded, std::string_view domain=kDefaultDomain) const |
| Overload of Detokenize for std::string_view .
|
|
DetokenizedString | Detokenize (const void *encoded, size_t size_bytes, std::string_view domain=kDefaultDomain) const |
| Overload of Detokenize for a pointer and length.
|
|
DetokenizedString | RecursiveDetokenize (const span< const std::byte > &encoded, std::string_view domain=kDefaultDomain) const |
|
DetokenizedString | RecursiveDetokenize (const span< const uint8_t > &encoded, std::string_view domain=kDefaultDomain) const |
| Overload of Detokenize for span<const uint8_t> .
|
|
DetokenizedString | RecursiveDetokenize (std::string_view encoded, std::string_view domain=kDefaultDomain) const |
| Overload of Detokenize for std::string_view .
|
|
DetokenizedString | RecursiveDetokenize (const void *encoded, size_t size_bytes, std::string_view domain=kDefaultDomain) const |
| Overload of Detokenize for a pointer and length.
|
|
DetokenizedString | DetokenizeBase64Message (std::string_view text) const |
|
std::string | DetokenizeText (std::string_view text) const |
|
std::string | DecodeOptionallyTokenizedData (const span< const std::byte > &optionally_tokenized_data) |
|
const DomainTokenEntriesMap & | database () const |
|
span< const TokenizedStringEntry > | DatabaseLookup (uint32_t token, std::string_view domain) const |
|
std::string pw::tokenizer::Detokenizer::DecodeOptionallyTokenizedData |
( |
const span< const std::byte > & |
optionally_tokenized_data | ) |
|
Decodes data that may or may not be tokenized, such as proto fields marked as optionally tokenized.
This function currently only supports Base64 nested tokenized messages. Support for hexadecimal-encoded string literals will be added.
This function currently assumes when data is not tokenized it is printable ASCII. Otherwise, the returned string will be base64-encoded.
- Parameters
-
[in] | optionally_tokenized_data | Data optionally tokenized. |
- Returns
- The decoded text if successfully detokenized or if the data is printable, otherwise returns the data base64-encoded.