aboutsummaryrefslogtreecommitdiff
path: root/cc/primitive_set.h
diff options
context:
space:
mode:
authorambrosin <ambrosin@google.com>2022-04-01 06:38:38 -0700
committerCopybara-Service <copybara-worker@google.com>2022-04-01 06:39:39 -0700
commit7455daebf3c2d31823b79f696eb5c8bdc3b84f2e (patch)
tree6860e5ab7016347181cee292708a4c4d4bf8a732 /cc/primitive_set.h
parent93d62555c84905ebe754373c3dc8552175a6eba7 (diff)
downloadtink-7455daebf3c2d31823b79f696eb5c8bdc3b84f2e.tar.gz
Add type_url to PrimitiveSet entries.
This is exposed through a getter `get_type_url`. PiperOrigin-RevId: 438811451
Diffstat (limited to 'cc/primitive_set.h')
-rw-r--r--cc/primitive_set.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/cc/primitive_set.h b/cc/primitive_set.h
index 96ce200d9..76ae5ce09 100644
--- a/cc/primitive_set.h
+++ b/cc/primitive_set.h
@@ -74,7 +74,8 @@ class PrimitiveSet {
std::string identifier = identifier_result.value();
return absl::WrapUnique(new Entry(std::move(primitive), identifier,
key_info.status(), key_info.key_id(),
- key_info.output_prefix_type()));
+ key_info.output_prefix_type(),
+ key_info.type_url()));
}
P2& get_primitive() const { return *primitive_; }
@@ -89,21 +90,26 @@ class PrimitiveSet {
return output_prefix_type_;
}
+ absl::string_view get_key_type_url() const { return key_type_url_; }
+
private:
Entry(std::unique_ptr<P2> primitive, const std::string& identifier,
google::crypto::tink::KeyStatusType status, uint32_t key_id,
- google::crypto::tink::OutputPrefixType output_prefix_type)
+ google::crypto::tink::OutputPrefixType output_prefix_type,
+ absl::string_view key_type_url)
: primitive_(std::move(primitive)),
identifier_(identifier),
status_(status),
key_id_(key_id),
- output_prefix_type_(output_prefix_type) {}
+ output_prefix_type_(output_prefix_type),
+ key_type_url_(key_type_url) {}
std::unique_ptr<P> primitive_;
std::string identifier_;
google::crypto::tink::KeyStatusType status_;
uint32_t key_id_;
google::crypto::tink::OutputPrefixType output_prefix_type_;
+ const std::string key_type_url_;
};
typedef std::vector<std::unique_ptr<Entry<P>>> Primitives;