@@ -14,12 +14,10 @@ import { uInt32BE } from '@aws-crypto/serialize'
14
14
const SEPARATION_INDICATOR = Buffer . from ( [ 0x00 ] )
15
15
const COUNTER_START_VALUE = 1
16
16
export const INT32_MAX_LIMIT = 2147483647
17
- const SUPPORTED_IKM_LENGTHS = [ 32 ]
18
- const SUPPORTED_NONCE_LENGTHS = [ 16 ]
19
17
const SUPPORTED_DERIVED_KEY_LENGTHS = [ 32 ]
20
- const SUPPORTED_DIGEST_ALGORITHMS = [ 'sha256' ]
18
+ const SUPPORTED_DIGEST_ALGORITHMS = [ 'sha256' , 'sha384' ]
21
19
22
- export type SupportedDigestAlgorithms = 'sha256'
20
+ export type SupportedDigestAlgorithms = 'sha256' | 'sha384'
23
21
export type SupportedDerivedKeyLengths = 32
24
22
25
23
interface KdfCtrInput {
@@ -37,18 +35,8 @@ export function kdfCounterMode({
37
35
purpose,
38
36
expectedLength,
39
37
} : KdfCtrInput ) : Buffer {
40
- /* Precondition: the ikm must be 32 bytes long */
41
- needs (
42
- SUPPORTED_IKM_LENGTHS . includes ( ikm . length ) ,
43
- `Unsupported IKM length ${ ikm . length } `
44
- )
45
38
/* Precondition: the nonce is required */
46
39
needs ( nonce , 'The nonce must be provided' )
47
- /* Precondition: the nonce must be 16 bytes long */
48
- needs (
49
- SUPPORTED_NONCE_LENGTHS . includes ( nonce . length ) ,
50
- `Unsupported nonce length ${ nonce . length } `
51
- )
52
40
/* Precondition: the expected length must be 32 bytes */
53
41
/* Precondition: the expected length * 8 must be under the max 32-bit signed integer */
54
42
needs (
0 commit comments