Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript Cipher.getAuthTag doesn't exists

I am trying to do encrypt/decrypt using this https://github.com/luke-park/SecureCompatibleEncryptionExamples but the Cipher definition doesn't have getAuthTag.

is there a @types should I install?

EDIT Just saw node/index.d.ts the getAuthTag and setAAD is is commented. I don't think it is right to remove the comment.

like image 518
zer09 Avatar asked Mar 17 '26 07:03

zer09


1 Answers

The reason for the issue you're having is because you're defining the algorithm as a string and it should be Cipher.CipherGCMTypes.

When you define the variable you declare the type. As Matt said, you have to pass it in as that type.

private ALGORITHM:crypto.CipherGCMTypes = 'aes-256-gcm';
let cipher:crypto.Cipher = crypto.createCipheriv(this.ALGORITHM, Buffer.from(this.encryptionKeyMessage, 'base64'), iv)
like image 188
user3486758 Avatar answered Mar 18 '26 22:03

user3486758