Update src/cleartext.js

Co-authored-by: larabr <larabr+github@protonmail.com>
This commit is contained in:
Daniel Huigens 2025-08-21 18:45:07 +02:00 committed by GitHub
parent 364eb1ee18
commit a3a934d06b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,7 @@ export class CleartextMessage {
* @param {Signature} signature - The detached signature or an empty signature for unsigned messages
*/
constructor(text, signature) {
// remove trailing whitespace from each line
// remove trailing whitespace from each line and normalize line endings to LF
this.text = util.removeTrailingSpaces(text);
if (signature && !(signature instanceof Signature)) {
throw new Error('Invalid signature input');