lib/google/cloud/storage.rb in google-cloud-storage-0.23.1 vs lib/google/cloud/storage.rb in google-cloud-storage-0.23.2
- old
+ new
@@ -208,11 +208,10 @@
# update the metadata of an encrypted file without providing the encryption
# key.
#
# ```ruby
# require "google/cloud/storage"
- # require "digest/sha2"
#
# storage = Google::Cloud::Storage.new
# bucket = storage.bucket "my-todo-app"
#
# # Key generation shown for example purposes only. Write your own.
@@ -225,9 +224,31 @@
# encryption_key: key
#
# # Store your key and hash securely for later use.
# file = bucket.file "avatars/heidi/400x400.png",
# encryption_key: key
+ # ```
+ #
+ # Use {Google::Cloud::Storage::File#rotate} to rotate customer-supplied
+ # encryption keys.
+ #
+ # ```ruby
+ # require "google/cloud/storage"
+ #
+ # storage = Google::Cloud::Storage.new
+ # bucket = storage.bucket "my-todo-app"
+ #
+ # # Old key was stored securely for later use.
+ # old_key = "y\x03\"\x0E\xB6\xD3\x9B\x0E\xAB*\x19\xFAv\xDEY\xBEI..."
+ #
+ # file = bucket.file "path/to/my-file.ext", encryption_key: old_key
+ #
+ # # Key generation shown for example purposes only. Write your own.
+ # cipher = OpenSSL::Cipher.new "aes-256-cfb"
+ # cipher.encrypt
+ # new_key = cipher.random_key
+ #
+ # file.rotate encryption_key: old_key, new_encryption_key: new_key
# ```
#
# ## Downloading a File
#
# Files can be downloaded to the local file system. (See