aboutsummaryrefslogtreecommitdiff
path: root/cc/util
diff options
context:
space:
mode:
authortholenst <tholenst@google.com>2022-05-11 04:47:34 -0700
committerCopybara-Service <copybara-worker@google.com>2022-05-11 04:48:21 -0700
commit868ff81b83a67853218efa2b788e860bbe8e4c27 (patch)
tree7cd8ba6f3c44e31c363899c3c3bfd23a47bddb8a /cc/util
parente9b5635c8e6add9d111192abc8810a297cc393db (diff)
downloadtink-868ff81b83a67853218efa2b788e860bbe8e4c27.tar.gz
Add comments to SecretValue.
PiperOrigin-RevId: 447963946
Diffstat (limited to 'cc/util')
-rw-r--r--cc/util/secret_data.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/cc/util/secret_data.h b/cc/util/secret_data.h
index f212f17f4..ab875009b 100644
--- a/cc/util/secret_data.h
+++ b/cc/util/secret_data.h
@@ -112,6 +112,12 @@ inline SecretData SecretDataFromStringView(absl::string_view secret) {
return {secret.begin(), secret.end()};
}
+// The same as SecretUniquePtr, but with value semantics.
+//
+// NOTE: SecretValue<T> will only protect the data which is stored in the
+// memory which a T object takes on the stack. In particular, std::string and
+// std::vector SHOULD NOT be used as arguments of T: they allocate memory
+// on the heap, and hence the data stored in them will NOT be protected.
template <typename T>
class SecretValue {
public: