(blob: string)
| 33 | } |
| 34 | |
| 35 | decrypt(blob: string): string { |
| 36 | const { iv, tag, ct } = JSON.parse(blob) as { iv: string; tag: string; ct: string }; |
| 37 | const d = createDecipheriv("aes-256-gcm", this.key, Buffer.from(iv, "base64")); |
| 38 | d.setAuthTag(Buffer.from(tag, "base64")); |
| 39 | return Buffer.concat([d.update(Buffer.from(ct, "base64")), d.final()]).toString("utf8"); |
| 40 | } |
| 41 | } |
no test coverage detected