Skip to content

Commit 7a731ef

Browse files
tniessentargos
authored andcommitted
doc,lib,test: rename HKDF 'key' argument
PR-URL: #39474 Refs: #39471 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent e53ec68 commit 7a731ef

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Diff for: doc/api/crypto.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -3839,14 +3839,14 @@ const {
38393839
console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...]
38403840
```
38413841

3842-
### `crypto.hkdf(digest, key, salt, info, keylen, callback)`
3842+
### `crypto.hkdf(digest, ikm, salt, info, keylen, callback)`
38433843
<!-- YAML
38443844
added: v15.0.0
38453845
-->
38463846

38473847
* `digest` {string} The digest algorithm to use.
3848-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} The secret
3849-
key. It must be at least one byte in length.
3848+
* `ikm` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} The input
3849+
keying material. It must be at least one byte in length.
38503850
* `salt` {string|ArrayBuffer|Buffer|TypedArray|DataView} The salt value. Must
38513851
be provided but can be zero-length.
38523852
* `info` {string|ArrayBuffer|Buffer|TypedArray|DataView} Additional info value.
@@ -3859,7 +3859,7 @@ added: v15.0.0
38593859
* `err` {Error}
38603860
* `derivedKey` {Buffer}
38613861

3862-
HKDF is a simple key derivation function defined in RFC 5869. The given `key`,
3862+
HKDF is a simple key derivation function defined in RFC 5869. The given `ikm`,
38633863
`salt` and `info` are used with the `digest` to derive a key of `keylen` bytes.
38643864

38653865
The supplied `callback` function is called with two arguments: `err` and
@@ -3892,14 +3892,14 @@ hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => {
38923892
});
38933893
```
38943894

3895-
### `crypto.hkdfSync(digest, key, salt, info, keylen)`
3895+
### `crypto.hkdfSync(digest, ikm, salt, info, keylen)`
38963896
<!-- YAML
38973897
added: v15.0.0
38983898
-->
38993899

39003900
* `digest` {string} The digest algorithm to use.
3901-
* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} The secret
3902-
key. It must be at least one byte in length.
3901+
* `ikm` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} The input
3902+
keying material. It must be at least one byte in length.
39033903
* `salt` {string|ArrayBuffer|Buffer|TypedArray|DataView} The salt value. Must
39043904
be provided but can be zero-length.
39053905
* `info` {string|ArrayBuffer|Buffer|TypedArray|DataView} Additional info value.
@@ -3911,7 +3911,7 @@ added: v15.0.0
39113911
* Returns: {ArrayBuffer}
39123912

39133913
Provides a synchronous HKDF key derivation function as defined in RFC 5869. The
3914-
given `key`, `salt` and `info` are used with the `digest` to derive a key of
3914+
given `ikm`, `salt` and `info` are used with the `digest` to derive a key of
39153915
`keylen` bytes.
39163916

39173917
The successfully generated `derivedKey` will be returned as an {ArrayBuffer}.

Diff for: lib/internal/crypto/hkdf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function prepareKey(key) {
9191

9292
if (!isArrayBufferView(key)) {
9393
throw new ERR_INVALID_ARG_TYPE(
94-
'key',
94+
'ikm',
9595
[
9696
'string',
9797
'SecretKeyObject',

Diff for: test/parallel/test-crypto-hkdf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ const {
2929
[1, {}, [], false, Infinity].forEach((i) => {
3030
assert.throws(() => hkdf('sha256', i), {
3131
code: 'ERR_INVALID_ARG_TYPE',
32-
message: /^The "key" argument must be /
32+
message: /^The "ikm" argument must be /
3333
});
3434
assert.throws(() => hkdfSync('sha256', i), {
3535
code: 'ERR_INVALID_ARG_TYPE',
36-
message: /^The "key" argument must be /
36+
message: /^The "ikm" argument must be /
3737
});
3838
});
3939

0 commit comments

Comments
 (0)