Skip to content

Commit 07e5a59

Browse files
[aes-js] Counter allows for either a number or a ByteSource (DefinitelyTyped#43719)
* Counter allows for either a number or a ByteSource * Add unit test
1 parent 5dbf929 commit 07e5a59

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

types/aes-js/aes-js-tests.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ const ecb = new aesjs.ModeOfOperation.ecb(key);
88
ecb.decrypt(ecb.encrypt(data));
99

1010
const hex: string = aesjs.utils.hex.fromBytes(data);
11+
12+
const ctr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter([]));
13+
ctr.encrypt(data);

types/aes-js/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class AES {
1919
* @param initialValue The Counter initial value.
2020
*/
2121
export class Counter {
22-
constructor(initialValue: number)
22+
constructor(initialValue: number | ByteSource)
2323
setValue(value: number): void;
2424
setBytes(bytes: ByteSource): void;
2525
increment(): void;

0 commit comments

Comments
 (0)