Skip to content

Commit 5aadc10

Browse files
committed
add note in README about properly using options
1 parent 67b0069 commit 5aadc10

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ introduction: a proof-of-concept, or just fun.
2222
## Security details
2323

2424
Encryption is done with AES-256-GCM and key derivation with PBKDF2 with SHA-384.
25-
The Salt and Initialization Vector are generated with Crypto.getRandomValues.
25+
The Salt and Initialization Vector are generated with `Crypto.getRandomValues`.
2626
There are only three configurable options:
2727

2828
- The number of iterations for PBKDF2.
@@ -44,17 +44,23 @@ const store = subtleCryptoStore(window.crypto, backend, 'my super pass', {
4444
});
4545
```
4646

47+
*NOTE*: these options are very strictly expected to be finite, positive
48+
integer values of typr `number`. If you supply something like `'16'` or `16.1`
49+
that value will be dropped and a default used. Use predefined constants,
50+
sanitize your input or check the returned `options` member, which contains the
51+
parameters being used.
52+
4753
## Compatibility
4854

4955
Source code is written in typescript targetting es2016. By then Crypto and
5056
SubtleCrypto APIs were already available in most major browsers.
5157

5258
Crypto and SubtleCrypto APIs are only available in a
5359
[Secure Context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
54-
For browsers, this means that the Window or Worker have an HTTPS origin, and if
55-
the window belongs to an iframe, then all its ancestors are also delivered
60+
For browsers, this means that the `Window` or `Worker` have an HTTPS origin, and
61+
if the window belongs to an iframe, then all its ancestors are also delivered
5662
through HTTPS. There are other cases as well, you can read the linked document
5763
for more information. At runtime, the global and raeadonly property
5864
[isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/isSecureContext)
5965
can be used to easily detect the availability of these features, so if it
60-
returns true then you should have access to these APIs.
66+
returns `true` then you should have access to these APIs.

0 commit comments

Comments
 (0)