You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76Lines changed: 76 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,82 @@ async function storeSomeSecrets (doc) {
129
129
}
130
130
```
131
131
132
+
133
+
### Standalone usage
134
+
135
+
136
+
After requiring and invoking this module as shown above, you'll be able to call any of several available methods on the hydrated "encryptedAttributes" object. Those methods are documented below.
| keyId | ((string)) | Required(ish) | The id of the key to use for all **new encryptions**. This is _not_ necessarily the only key that will be used for decryptions though, because the key id you choose gets embedded into the encrypted string itself. Then before that string is decrypted, this module simply unpacks that key id and uses it to determine the appropriate decryption key. This approach allows for using multiple keys. (Note that this option is only _technically_ required if you need to encrypt new data. If you are only decrypting existing data, you needn't pass it in.) |
203
+
| keys | ((dictionary)) | Required | A dictionary of all relevant data encryption keys (DEKs). Since encrypted strings _contain the key id that was used to encrypt them_, it's important that `keys` contain the appropriate keys for any past key ids it might run across when attempting to decrypt those strings.
204
+
| verifyId | ((boolean)) | _Optional._ | Whether or not to (A) use the `id` property of a provided source object as an additional piece of metadata during encryption, and (B) expect that metadata to be embedded in encrypted strings during decryption, and throw an error if the expected idea does not match. Defaults to `false`.
0 commit comments