Skip to content

utilAesDecrypt and utilAesEncrypt key parameter should be optional in type definition #300

@bhousel

Description

@bhousel

The key parameter in utilAesDecrypt and utilAesEncrypt has a default value at runtime (DEFAULT_128), but the TypeScript type definition marks it as required.

In src/aes.ts:

export function utilAesDecrypt(cipherText: string, key: number[]): string {
  key = key || DEFAULT_128;  // runtime default exists
  ...
}

The type signature should be:

export function utilAesDecrypt(cipherText: string, key?: number[]): string;
export function utilAesEncrypt(plainText: string, key?: number[]): string;

This would allow calling the function without providing a key, matching the runtime behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions