Skip to content

Commit dc448dd

Browse files
committed
update readme
1 parent ac71de3 commit dc448dd

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

modules/kdf-ctr-mode-node/README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,21 @@ npm install @aws-crypto/kdf-ctr-mode-node
1717
## use
1818

1919
```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+
})
2435
```
2536

2637
## test

0 commit comments

Comments
 (0)