File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
modules/kdf-ctr-mode-node Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,21 @@ npm install @aws-crypto/kdf-ctr-mode-node
17
17
## use
18
18
19
19
``` javascript
20
- const HKDF = require (' @aws-crypto/hkdf-node' )
21
- const expand = HKDF (' sha256' )(' some key' , ' some salt' )
22
- const info = { some: ' info' , message_id: 123 }
23
- const key = expand (32 , Buffer .from (JSON .stringify (info)))
20
+
21
+ const digestAlgorithm = ' sha256'
22
+ const initialKeyMaterial = gottenFromSomewhereSecure ()
23
+ const nonce = freshRandomData ()
24
+ const purpose = Buffer .from (' What this derived key is for.' , ' utf-8' )
25
+ const expectedLength = 32
26
+
27
+ const KDF = require (' @aws-crypto/kdf-ctr-mode-node' )
28
+ const derivedKey = KDF .kdfCounterMode ({
29
+ digestAlgorithm,
30
+ ikm: initialKeyMaterial,
31
+ nonce,
32
+ purpose,
33
+ expectedLength,
34
+ })
24
35
```
25
36
26
37
## test
You can’t perform that action at this time.
0 commit comments