@@ -14,12 +14,10 @@ import { uInt32BE } from '@aws-crypto/serialize'
1414const SEPARATION_INDICATOR = Buffer . from ( [ 0x00 ] )
1515const COUNTER_START_VALUE = 1
1616export const INT32_MAX_LIMIT = 2147483647
17- const SUPPORTED_IKM_LENGTHS = [ 32 ]
18- const SUPPORTED_NONCE_LENGTHS = [ 16 ]
1917const SUPPORTED_DERIVED_KEY_LENGTHS = [ 32 ]
20- const SUPPORTED_DIGEST_ALGORITHMS = [ 'sha256' ]
18+ const SUPPORTED_DIGEST_ALGORITHMS = [ 'sha256' , 'sha384' ]
2119
22- export type SupportedDigestAlgorithms = 'sha256'
20+ export type SupportedDigestAlgorithms = 'sha256' | 'sha384'
2321export type SupportedDerivedKeyLengths = 32
2422
2523interface KdfCtrInput {
@@ -37,18 +35,8 @@ export function kdfCounterMode({
3735 purpose,
3836 expectedLength,
3937} : 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- )
4538 /* Precondition: the nonce is required */
4639 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- )
5240 /* Precondition: the expected length must be 32 bytes */
5341 /* Precondition: the expected length * 8 must be under the max 32-bit signed integer */
5442 needs (
0 commit comments