What changes
A recoverable key is still verified by its hash. We also store an encrypted copy, using encryption keys unique to your workspace, andkeys.getKey and apis.listKeys decrypt it when you pass decrypt: true.
A key is only recoverable if its keyspace has Store encrypted keys turned on (ask support@unkey.com) and the key was created with recoverable: true after that. Older keys can’t be recovered.
Two separate permissions
Creating a recoverable key needsapi.*.encrypt_key or api.<api_id>.encrypt_key on top of create_key. Reading a key back needs api.*.decrypt_key or api.<api_id>.decrypt_key on top of read_key. Without decrypt_key, a root key can create and list keys but never read them back. Give decrypt_key only to the one service that needs to show keys, for the one keyspace that needs it.
Limiting the exposure
With recovery on, a copy of our database is no longer useless on its own. Someone who also got your workspace’s encryption keys, or a leaked root key withdecrypt_key, could read your keys. To limit that:
- Only turn on recovery for keyspaces that need it.
- Never pass
decrypt: truein code that serves end users. - Use the developer portal, where users roll their own keys instead of reading them back.
- Watch the audit log for unexpected
key.createentries in keyspaces with encryption on.