pdf-lite 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +3 -0
  2. package/dist/core/generators.d.ts +2 -2
  3. package/dist/core/generators.js +3 -3
  4. package/dist/core/incremental-parser.d.ts +1 -1
  5. package/dist/core/incremental-parser.js +1 -1
  6. package/dist/core/index.d.ts +48 -0
  7. package/dist/core/index.js +48 -0
  8. package/dist/core/objects/pdf-array.d.ts +3 -3
  9. package/dist/core/objects/pdf-array.js +4 -4
  10. package/dist/core/objects/pdf-boolean.d.ts +2 -2
  11. package/dist/core/objects/pdf-boolean.js +2 -2
  12. package/dist/core/objects/pdf-comment.d.ts +3 -3
  13. package/dist/core/objects/pdf-comment.js +4 -4
  14. package/dist/core/objects/pdf-date.d.ts +1 -1
  15. package/dist/core/objects/pdf-date.js +1 -1
  16. package/dist/core/objects/pdf-dictionary.d.ts +3 -3
  17. package/dist/core/objects/pdf-dictionary.js +5 -5
  18. package/dist/core/objects/pdf-hexadecimal.d.ts +3 -3
  19. package/dist/core/objects/pdf-hexadecimal.js +6 -6
  20. package/dist/core/objects/pdf-indirect-object.d.ts +5 -5
  21. package/dist/core/objects/pdf-indirect-object.js +9 -9
  22. package/dist/core/objects/pdf-name.d.ts +2 -2
  23. package/dist/core/objects/pdf-name.js +2 -2
  24. package/dist/core/objects/pdf-null.d.ts +2 -2
  25. package/dist/core/objects/pdf-null.js +2 -2
  26. package/dist/core/objects/pdf-number.d.ts +3 -3
  27. package/dist/core/objects/pdf-number.js +3 -3
  28. package/dist/core/objects/pdf-object-reference.d.ts +2 -2
  29. package/dist/core/objects/pdf-object-reference.js +2 -2
  30. package/dist/core/objects/pdf-start-xref.d.ts +4 -4
  31. package/dist/core/objects/pdf-start-xref.js +4 -4
  32. package/dist/core/objects/pdf-stream.d.ts +8 -8
  33. package/dist/core/objects/pdf-stream.js +19 -19
  34. package/dist/core/objects/pdf-string.d.ts +3 -3
  35. package/dist/core/objects/pdf-string.js +4 -4
  36. package/dist/core/objects/pdf-trailer.d.ts +8 -8
  37. package/dist/core/objects/pdf-trailer.js +6 -6
  38. package/dist/core/objects/pdf-xref-table.d.ts +7 -7
  39. package/dist/core/objects/pdf-xref-table.js +8 -8
  40. package/dist/core/serializer.d.ts +3 -3
  41. package/dist/core/serializer.js +2 -2
  42. package/dist/core/streams/object-stream.d.ts +3 -3
  43. package/dist/core/streams/object-stream.js +2 -2
  44. package/dist/core/tokens/boolean-token.d.ts +1 -1
  45. package/dist/core/tokens/boolean-token.js +1 -1
  46. package/dist/core/tokens/byte-offset-token.d.ts +2 -2
  47. package/dist/core/tokens/byte-offset-token.js +2 -2
  48. package/dist/core/tokens/comment-token.d.ts +2 -2
  49. package/dist/core/tokens/comment-token.js +4 -4
  50. package/dist/core/tokens/end-array-token.d.ts +1 -1
  51. package/dist/core/tokens/end-array-token.js +2 -2
  52. package/dist/core/tokens/end-dictionary-token.d.ts +1 -1
  53. package/dist/core/tokens/end-dictionary-token.js +2 -2
  54. package/dist/core/tokens/end-object-token.d.ts +1 -1
  55. package/dist/core/tokens/end-object-token.js +2 -2
  56. package/dist/core/tokens/end-stream-token.d.ts +2 -2
  57. package/dist/core/tokens/end-stream-token.js +2 -2
  58. package/dist/core/tokens/hexadecimal-token.d.ts +2 -2
  59. package/dist/core/tokens/hexadecimal-token.js +2 -2
  60. package/dist/core/tokens/name-token.d.ts +1 -1
  61. package/dist/core/tokens/name-token.js +2 -2
  62. package/dist/core/tokens/null-token.d.ts +1 -1
  63. package/dist/core/tokens/null-token.js +2 -2
  64. package/dist/core/tokens/number-token.d.ts +3 -3
  65. package/dist/core/tokens/number-token.js +3 -3
  66. package/dist/core/tokens/object-reference-token.d.ts +1 -1
  67. package/dist/core/tokens/object-reference-token.js +2 -2
  68. package/dist/core/tokens/start-array-token.d.ts +1 -1
  69. package/dist/core/tokens/start-array-token.js +2 -2
  70. package/dist/core/tokens/start-dictionary-token.d.ts +1 -1
  71. package/dist/core/tokens/start-dictionary-token.js +2 -2
  72. package/dist/core/tokens/start-object-token.d.ts +1 -1
  73. package/dist/core/tokens/start-object-token.js +2 -2
  74. package/dist/core/tokens/start-stream-token.d.ts +3 -3
  75. package/dist/core/tokens/start-stream-token.js +3 -3
  76. package/dist/core/tokens/start-xref-token.d.ts +1 -1
  77. package/dist/core/tokens/start-xref-token.js +2 -2
  78. package/dist/core/tokens/stream-chunk-token.d.ts +2 -2
  79. package/dist/core/tokens/stream-chunk-token.js +1 -1
  80. package/dist/core/tokens/string-token.d.ts +2 -2
  81. package/dist/core/tokens/string-token.js +3 -3
  82. package/dist/core/tokens/token.d.ts +1 -1
  83. package/dist/core/tokens/token.js +1 -1
  84. package/dist/core/tokens/trailer-token.d.ts +1 -1
  85. package/dist/core/tokens/trailer-token.js +2 -2
  86. package/dist/core/tokens/whitespace-token.d.ts +2 -2
  87. package/dist/core/tokens/whitespace-token.js +1 -1
  88. package/dist/core/tokens/xref-table-entry-token.d.ts +3 -3
  89. package/dist/core/tokens/xref-table-entry-token.js +2 -2
  90. package/dist/core/tokens/xref-table-section-start-token.d.ts +2 -2
  91. package/dist/core/tokens/xref-table-section-start-token.js +3 -3
  92. package/dist/core/tokens/xref-table-start-token.d.ts +1 -1
  93. package/dist/core/tokens/xref-table-start-token.js +2 -2
  94. package/dist/crypto/index.d.ts +11 -0
  95. package/dist/crypto/index.js +11 -0
  96. package/dist/crypto/key-derivation/key-derivation-aes256.d.ts +1 -1
  97. package/dist/crypto/key-derivation/key-derivation-aes256.js +2 -2
  98. package/dist/crypto/key-derivation/key-derivation.d.ts +0 -14
  99. package/dist/crypto/key-derivation/key-derivation.js +1 -26
  100. package/dist/crypto/key-gen/key-gen-rc4-128.d.ts +1 -1
  101. package/dist/crypto/key-gen/key-gen-rc4-128.js +5 -6
  102. package/dist/crypto/key-gen/key-gen-rc4-40.js +1 -2
  103. package/dist/crypto/types.d.ts +1 -1
  104. package/dist/filters/asciihex.d.ts +1 -1
  105. package/dist/filters/asciihex.js +2 -2
  106. package/dist/filters/index.d.ts +7 -0
  107. package/dist/filters/index.js +7 -0
  108. package/dist/filters/lzw.d.ts +1 -1
  109. package/dist/filters/types.d.ts +1 -1
  110. package/dist/index.d.ts +5 -1
  111. package/dist/index.js +5 -1
  112. package/dist/pdf/index.d.ts +5 -4
  113. package/dist/pdf/index.js +5 -4
  114. package/dist/pdf/pdf-document.d.ts +14 -14
  115. package/dist/pdf/pdf-document.js +19 -19
  116. package/dist/pdf/pdf-reader.d.ts +3 -3
  117. package/dist/pdf/pdf-reader.js +2 -2
  118. package/dist/pdf/pdf-revision.d.ts +5 -5
  119. package/dist/pdf/pdf-revision.js +4 -4
  120. package/dist/pdf/pdf-xref-lookup.d.ts +7 -7
  121. package/dist/pdf/pdf-xref-lookup.js +9 -9
  122. package/dist/security/crypt-filters/aesv2.d.ts +2 -2
  123. package/dist/security/crypt-filters/aesv2.js +2 -2
  124. package/dist/security/crypt-filters/aesv3.d.ts +2 -2
  125. package/dist/security/crypt-filters/aesv3.js +2 -2
  126. package/dist/security/crypt-filters/base.d.ts +4 -4
  127. package/dist/security/crypt-filters/base.js +3 -3
  128. package/dist/security/crypt-filters/identity.d.ts +2 -2
  129. package/dist/security/crypt-filters/identity.js +1 -1
  130. package/dist/security/crypt-filters/v2.d.ts +1 -1
  131. package/dist/security/crypt-filters/v2.js +1 -1
  132. package/dist/security/handlers/base.d.ts +4 -4
  133. package/dist/security/handlers/base.js +12 -12
  134. package/dist/security/handlers/pubSec.d.ts +3 -3
  135. package/dist/security/handlers/pubSec.js +10 -10
  136. package/dist/security/handlers/utils.d.ts +4 -4
  137. package/dist/security/handlers/utils.js +12 -12
  138. package/dist/security/handlers/v1.d.ts +4 -4
  139. package/dist/security/handlers/v1.js +7 -7
  140. package/dist/security/handlers/v2.d.ts +3 -3
  141. package/dist/security/handlers/v2.js +5 -5
  142. package/dist/security/handlers/v4.d.ts +6 -6
  143. package/dist/security/handlers/v4.js +11 -11
  144. package/dist/security/handlers/v5.d.ts +5 -5
  145. package/dist/security/handlers/v5.js +9 -9
  146. package/dist/security/index.d.ts +13 -0
  147. package/dist/security/index.js +13 -0
  148. package/dist/security/types.d.ts +9 -9
  149. package/dist/signing/document-security-store.d.ts +11 -11
  150. package/dist/signing/document-security-store.js +4 -4
  151. package/dist/signing/index.d.ts +5 -4
  152. package/dist/signing/index.js +5 -4
  153. package/dist/signing/signatures/adbe-pkcs7-detached.d.ts +4 -4
  154. package/dist/signing/signatures/adbe-pkcs7-detached.js +11 -11
  155. package/dist/signing/signatures/adbe-pkcs7-sha1.d.ts +4 -4
  156. package/dist/signing/signatures/adbe-pkcs7-sha1.js +12 -12
  157. package/dist/signing/signatures/adbe-x509-rsa-sha1.d.ts +4 -4
  158. package/dist/signing/signatures/adbe-x509-rsa-sha1.js +8 -8
  159. package/dist/signing/signatures/base.d.ts +5 -5
  160. package/dist/signing/signatures/base.js +11 -11
  161. package/dist/signing/signatures/etsi-cades-detached.d.ts +4 -4
  162. package/dist/signing/signatures/etsi-cades-detached.js +17 -17
  163. package/dist/signing/signatures/etsi-rfc3161.d.ts +2 -2
  164. package/dist/signing/signatures/etsi-rfc3161.js +9 -9
  165. package/dist/signing/signatures/index.d.ts +6 -6
  166. package/dist/signing/signatures/index.js +6 -6
  167. package/dist/signing/signer.d.ts +3 -3
  168. package/dist/signing/signer.js +10 -10
  169. package/dist/signing/types.d.ts +7 -7
  170. package/dist/signing/utils.d.ts +2 -2
  171. package/dist/signing/utils.js +1 -1
  172. package/dist/utils/algos.js +1 -1
  173. package/dist/utils/bytesToHex.d.ts +1 -1
  174. package/dist/utils/bytesToHex.js +2 -2
  175. package/dist/utils/bytesToHexBytes.d.ts +1 -1
  176. package/dist/utils/bytesToString.d.ts +1 -1
  177. package/dist/utils/concatUint8Arrays.d.ts +1 -1
  178. package/dist/utils/escapeString.d.ts +1 -1
  179. package/dist/utils/escapeString.js +1 -1
  180. package/dist/utils/hexBytesToBytes.d.ts +1 -1
  181. package/dist/utils/hexBytesToString.d.ts +1 -1
  182. package/dist/utils/hexToBytes.d.ts +1 -1
  183. package/dist/utils/hexToBytes.js +2 -2
  184. package/dist/utils/index.d.ts +17 -0
  185. package/dist/utils/index.js +17 -0
  186. package/dist/utils/padBytes.d.ts +1 -1
  187. package/dist/utils/replaceInBuffer.d.ts +1 -1
  188. package/dist/utils/stringToBytes.d.ts +1 -1
  189. package/dist/utils/stringToHexBytes.d.ts +1 -1
  190. package/dist/utils/unescapeString.d.ts +1 -1
  191. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
- import { ByteArray } from '../types';
2
- import { Parser } from './parser';
3
- import { PdfToken } from './tokens/token';
1
+ import { ByteArray } from '../types.js';
2
+ import { Parser } from './parser.js';
3
+ import { PdfToken } from './tokens/token.js';
4
4
  /**
5
5
  * Serializes PDF tokens into a byte stream.
6
6
  * Handles byte offset calculation and token serialization.
@@ -1,5 +1,5 @@
1
- import { Parser } from './parser';
2
- import { PdfByteOffsetToken } from './tokens/byte-offset-token';
1
+ import { Parser } from './parser.js';
2
+ import { PdfByteOffsetToken } from './tokens/byte-offset-token.js';
3
3
  /**
4
4
  * Serializes PDF tokens into a byte stream.
5
5
  * Handles byte offset calculation and token serialization.
@@ -1,6 +1,6 @@
1
- import { PdfObject } from '../objects/pdf-object';
2
- import { ByteArray } from '../../types';
3
- import { IterableReadableStream } from '../../utils/IterableReadableStream';
1
+ import { PdfObject } from '../objects/pdf-object.js';
2
+ import { ByteArray } from '../../types.js';
3
+ import { IterableReadableStream } from '../../utils/IterableReadableStream.js';
4
4
  export declare class PdfObjectStream extends IterableReadableStream<PdfObject> {
5
5
  constructor(input: AsyncIterable<ByteArray> | Iterable<ByteArray>);
6
6
  }
@@ -1,5 +1,5 @@
1
- import { IterableReadableStream } from '../../utils/IterableReadableStream';
2
- import { pdfDecoderAsync } from '../generators';
1
+ import { IterableReadableStream } from '../../utils/IterableReadableStream.js';
2
+ import { pdfDecoderAsync } from '../generators.js';
3
3
  export class PdfObjectStream extends IterableReadableStream {
4
4
  constructor(input) {
5
5
  super({
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfBooleanToken extends PdfToken {
3
3
  static TRUE: PdfBooleanToken;
4
4
  static FALSE: PdfBooleanToken;
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export class PdfBooleanToken extends PdfToken {
3
3
  static TRUE = new PdfBooleanToken(true);
4
4
  static FALSE = new PdfBooleanToken(false);
@@ -1,5 +1,5 @@
1
- import { Ref } from '../ref';
2
- import { PdfToken } from './token';
1
+ import { Ref } from '../ref.js';
2
+ import { PdfToken } from './token.js';
3
3
  export declare class PdfByteOffsetToken extends PdfToken {
4
4
  value: Ref<number>;
5
5
  constructor(value?: Ref<number>);
@@ -1,5 +1,5 @@
1
- import { Ref } from '../ref';
2
- import { PdfToken } from './token';
1
+ import { Ref } from '../ref.js';
2
+ import { PdfToken } from './token.js';
3
3
  export class PdfByteOffsetToken extends PdfToken {
4
4
  value;
5
5
  constructor(value = new Ref(0)) {
@@ -1,5 +1,5 @@
1
- import { PdfToken } from './token';
2
- import { ByteArray } from '../../types';
1
+ import { PdfToken } from './token.js';
2
+ import { ByteArray } from '../../types.js';
3
3
  export declare class PdfCommentToken extends PdfToken {
4
4
  static EOF: PdfCommentToken;
5
5
  comment: ByteArray;
@@ -1,7 +1,7 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { concatUint8Arrays } from '../../utils/concatUint8Arrays';
3
- import { PdfToken } from './token';
4
- import { bytesToString } from '../../utils/bytesToString';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { concatUint8Arrays } from '../../utils/concatUint8Arrays.js';
3
+ import { PdfToken } from './token.js';
4
+ import { bytesToString } from '../../utils/bytesToString.js';
5
5
  export class PdfCommentToken extends PdfToken {
6
6
  static EOF = new PdfCommentToken('%EOF');
7
7
  comment;
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfEndArrayToken extends PdfToken {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const END_ARRAY_BYTES = stringToBytes(']');
4
4
  export class PdfEndArrayToken extends PdfToken {
5
5
  constructor() {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfEndDictionaryToken extends PdfToken {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const END_DICTIONARY_BYTES = stringToBytes('>>');
4
4
  export class PdfEndDictionaryToken extends PdfToken {
5
5
  constructor() {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfEndObjectToken extends PdfToken {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const END_OBJECT_BYTES = stringToBytes('endobj');
4
4
  export class PdfEndObjectToken extends PdfToken {
5
5
  constructor() {
@@ -1,5 +1,5 @@
1
- import { ByteArray } from '../../types';
2
- import { PdfToken } from './token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { PdfToken } from './token.js';
3
3
  export declare class PdfEndStreamToken extends PdfToken {
4
4
  constructor(bytes?: ByteArray);
5
5
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const END_STREAM_BYTES = stringToBytes('endstream');
4
4
  export class PdfEndStreamToken extends PdfToken {
5
5
  constructor(bytes) {
@@ -1,5 +1,5 @@
1
- import { ByteArray } from '../../types';
2
- import { PdfToken } from './token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { PdfToken } from './token.js';
3
3
  export declare class PdfHexadecimalToken extends PdfToken {
4
4
  raw: ByteArray;
5
5
  constructor(hexadecimal: string | ByteArray);
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  export class PdfHexadecimalToken extends PdfToken {
4
4
  raw;
5
5
  constructor(hexadecimal) {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfNameToken extends PdfToken {
3
3
  name: string;
4
4
  constructor(name: string);
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  export class PdfNameToken extends PdfToken {
4
4
  name;
5
5
  constructor(name) {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfNullToken extends PdfToken {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const NULL = stringToBytes('null');
4
4
  export class PdfNullToken extends PdfToken {
5
5
  constructor() {
@@ -1,6 +1,6 @@
1
- import { ByteArray } from '../../types';
2
- import { Ref } from '../ref';
3
- import { PdfToken } from './token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { Ref } from '../ref.js';
3
+ import { PdfToken } from './token.js';
4
4
  export declare class PdfNumberToken extends PdfToken {
5
5
  #private;
6
6
  padTo: number;
@@ -1,6 +1,6 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { Ref } from '../ref';
3
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { Ref } from '../ref.js';
3
+ import { PdfToken } from './token.js';
4
4
  export class PdfNumberToken extends PdfToken {
5
5
  #value;
6
6
  padTo;
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfObjectReferenceToken extends PdfToken {
3
3
  objectNumber: number;
4
4
  generationNumber: number;
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  export class PdfObjectReferenceToken extends PdfToken {
4
4
  objectNumber;
5
5
  generationNumber;
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfStartArrayToken extends PdfToken {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const START_ARRAY_BYTES = stringToBytes('[');
4
4
  export class PdfStartArrayToken extends PdfToken {
5
5
  constructor() {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfStartDictionaryToken extends PdfToken {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const START_DICTIONARY_BYTES = stringToBytes('<<');
4
4
  export class PdfStartDictionaryToken extends PdfToken {
5
5
  constructor() {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfStartObjectToken extends PdfToken {
3
3
  objectNumber: number;
4
4
  generationNumber: number;
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  export class PdfStartObjectToken extends PdfToken {
4
4
  objectNumber;
5
5
  generationNumber;
@@ -1,6 +1,6 @@
1
- import { ByteArray } from '../../types';
2
- import { PdfToken } from './token';
3
- import { PdfWhitespaceToken } from './whitespace-token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { PdfToken } from './token.js';
3
+ import { PdfWhitespaceToken } from './whitespace-token.js';
4
4
  export declare class PdfStartStreamToken extends PdfToken {
5
5
  constructor(bytes?: ByteArray);
6
6
  getTrailingWhitespaceTokens(): PdfWhitespaceToken[];
@@ -1,6 +1,6 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
3
- import { PdfWhitespaceToken } from './whitespace-token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
+ import { PdfWhitespaceToken } from './whitespace-token.js';
4
4
  const START_STREAM_WITHOUT_WHITESPACE_BYTES = stringToBytes('stream');
5
5
  const START_STREAM_BYTES = stringToBytes('stream\n');
6
6
  export class PdfStartStreamToken extends PdfToken {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfStartXRefToken extends PdfToken {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const START_XREF = stringToBytes('startxref');
4
4
  export class PdfStartXRefToken extends PdfToken {
5
5
  constructor() {
@@ -1,5 +1,5 @@
1
- import { ByteArray } from '../../types';
2
- import { PdfToken } from './token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { PdfToken } from './token.js';
3
3
  export declare class PdfStreamChunkToken extends PdfToken {
4
4
  constructor(bytes: ByteArray);
5
5
  }
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export class PdfStreamChunkToken extends PdfToken {
3
3
  constructor(bytes) {
4
4
  super(bytes);
@@ -1,5 +1,5 @@
1
- import { ByteArray } from '../../types';
2
- import { PdfToken } from './token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { PdfToken } from './token.js';
3
3
  export declare class PdfStringToken extends PdfToken {
4
4
  value: ByteArray;
5
5
  constructor(value: string | ByteArray);
@@ -1,6 +1,6 @@
1
- import { escapeString } from '../../utils/escapeString';
2
- import { stringToBytes } from '../../utils/stringToBytes';
3
- import { PdfToken } from './token';
1
+ import { escapeString } from '../../utils/escapeString.js';
2
+ import { stringToBytes } from '../../utils/stringToBytes.js';
3
+ import { PdfToken } from './token.js';
4
4
  export class PdfStringToken extends PdfToken {
5
5
  value;
6
6
  constructor(value) {
@@ -1,4 +1,4 @@
1
- import { ByteArray } from '../../types';
1
+ import { ByteArray } from '../../types.js';
2
2
  export declare abstract class PdfToken {
3
3
  protected rawBytes: ByteArray;
4
4
  constructor(bytes?: ByteArray);
@@ -1,4 +1,4 @@
1
- import { bytesToString } from '../../utils/bytesToString';
1
+ import { bytesToString } from '../../utils/bytesToString.js';
2
2
  export class PdfToken {
3
3
  rawBytes;
4
4
  constructor(bytes) {
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfTrailerToken extends PdfToken {
3
3
  byteOffset?: number;
4
4
  constructor(byteOffset?: number);
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const TRAILER = stringToBytes('trailer');
4
4
  export class PdfTrailerToken extends PdfToken {
5
5
  byteOffset;
@@ -1,5 +1,5 @@
1
- import { ByteArray } from '../../types';
2
- import { PdfToken } from './token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { PdfToken } from './token.js';
3
3
  export declare class PdfWhitespaceToken extends PdfToken {
4
4
  static NEWLINE: PdfWhitespaceToken;
5
5
  static SPACE: PdfWhitespaceToken;
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export class PdfWhitespaceToken extends PdfToken {
3
3
  static NEWLINE = new PdfWhitespaceToken('\n');
4
4
  static SPACE = new PdfWhitespaceToken(' ');
@@ -1,6 +1,6 @@
1
- import { ByteArray } from '../../types';
2
- import { Ref } from '../ref';
3
- import { PdfNumberToken } from './number-token';
1
+ import { ByteArray } from '../../types.js';
2
+ import { Ref } from '../ref.js';
3
+ import { PdfNumberToken } from './number-token.js';
4
4
  import { PdfToken } from './token.js';
5
5
  export declare class PdfXRefTableEntryToken extends PdfToken {
6
6
  objectNumber: PdfNumberToken;
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfNumberToken } from './number-token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfNumberToken } from './number-token.js';
3
3
  import { PdfToken } from './token.js';
4
4
  export class PdfXRefTableEntryToken extends PdfToken {
5
5
  objectNumber;
@@ -1,5 +1,5 @@
1
- import { PdfNumberToken } from './number-token';
2
- import { PdfToken } from './token';
1
+ import { PdfNumberToken } from './number-token.js';
2
+ import { PdfToken } from './token.js';
3
3
  export declare class PdfXRefTableSectionStartToken extends PdfToken {
4
4
  start: PdfNumberToken;
5
5
  count: PdfNumberToken;
@@ -1,6 +1,6 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfNumberToken } from './number-token';
3
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfNumberToken } from './number-token.js';
3
+ import { PdfToken } from './token.js';
4
4
  export class PdfXRefTableSectionStartToken extends PdfToken {
5
5
  start;
6
6
  count;
@@ -1,4 +1,4 @@
1
- import { PdfToken } from './token';
1
+ import { PdfToken } from './token.js';
2
2
  export declare class PdfXRefTableStartToken extends PdfToken {
3
3
  byteOffset?: number;
4
4
  constructor(byteOffset?: number);
@@ -1,5 +1,5 @@
1
- import { stringToBytes } from '../../utils/stringToBytes';
2
- import { PdfToken } from './token';
1
+ import { stringToBytes } from '../../utils/stringToBytes.js';
2
+ import { PdfToken } from './token.js';
3
3
  const XREF = stringToBytes('xref');
4
4
  export class PdfXRefTableStartToken extends PdfToken {
5
5
  byteOffset;
@@ -0,0 +1,11 @@
1
+ export * from './ciphers/aes128.js';
2
+ export * from './ciphers/aes256.js';
3
+ export * from './ciphers/rc4.js';
4
+ export * from './constants.js';
5
+ export * from './key-derivation/key-derivation-aes256.js';
6
+ export * from './key-derivation/key-derivation.js';
7
+ export * from './key-gen/key-gen-aes256.js';
8
+ export * from './key-gen/key-gen-rc4-128.js';
9
+ export * from './key-gen/key-gen-rc4-40.js';
10
+ export * from './types.js';
11
+ export * from './utils.js';
@@ -0,0 +1,11 @@
1
+ export * from './ciphers/aes128.js';
2
+ export * from './ciphers/aes256.js';
3
+ export * from './ciphers/rc4.js';
4
+ export * from './constants.js';
5
+ export * from './key-derivation/key-derivation-aes256.js';
6
+ export * from './key-derivation/key-derivation.js';
7
+ export * from './key-gen/key-gen-aes256.js';
8
+ export * from './key-gen/key-gen-rc4-128.js';
9
+ export * from './key-gen/key-gen-rc4-40.js';
10
+ export * from './types.js';
11
+ export * from './utils.js';
@@ -1,4 +1,4 @@
1
- import { ByteArray } from '../../types';
1
+ import { ByteArray } from '../../types.js';
2
2
  /**
3
3
  * Computes the Algorithm 2.B hash for PDF 2.0 AES-256 encryption.
4
4
  * This iterative hash algorithm uses SHA-256, SHA-384, or SHA-512 based on
@@ -1,5 +1,5 @@
1
- import { aes128CbcNoPaddingEncrypt, aes256CbcNoPaddingDecrypt, sha256, sha384, sha512, } from '../../utils/algos';
2
- import { assert } from '../../utils/assert';
1
+ import { aes128CbcNoPaddingEncrypt, aes256CbcNoPaddingDecrypt, sha256, sha384, sha512, } from '../../utils/algos.js';
2
+ import { assert } from '../../utils/assert.js';
3
3
  /**
4
4
  * Converts the first 16 bytes of input to a big-endian bigint.
5
5
  *
@@ -1,18 +1,4 @@
1
1
  import { ByteArray } from '../../types.js';
2
- /**
3
- * Pads a password to exactly 32 bytes using the PDF standard padding.
4
- * If the password is shorter than 32 bytes, it is padded with bytes from DEFAULT_PADDING.
5
- * If the password is 32 bytes or longer, only the first 32 bytes are used.
6
- *
7
- * @param password - The password to pad.
8
- * @returns A 32-byte padded password.
9
- *
10
- * @example
11
- * ```typescript
12
- * const padded = padPassword(new Uint8Array([1, 2, 3])) // Returns 32-byte array
13
- * ```
14
- */
15
- export declare function padPassword(password: ByteArray): ByteArray;
16
2
  /**
17
3
  * Compute the master encryption key for a PDF file.
18
4
  *
@@ -1,31 +1,6 @@
1
- import { DEFAULT_PADDING } from '../constants.js';
2
1
  import { md5 } from '../../utils/algos.js';
3
- import { int32ToLittleEndianBytes } from '../utils.js';
2
+ import { int32ToLittleEndianBytes, padPassword } from '../utils.js';
4
3
  import { concatUint8Arrays } from '../../utils/concatUint8Arrays.js';
5
- /**
6
- * Pads a password to exactly 32 bytes using the PDF standard padding.
7
- * If the password is shorter than 32 bytes, it is padded with bytes from DEFAULT_PADDING.
8
- * If the password is 32 bytes or longer, only the first 32 bytes are used.
9
- *
10
- * @param password - The password to pad.
11
- * @returns A 32-byte padded password.
12
- *
13
- * @example
14
- * ```typescript
15
- * const padded = padPassword(new Uint8Array([1, 2, 3])) // Returns 32-byte array
16
- * ```
17
- */
18
- export function padPassword(password) {
19
- const padded = new Uint8Array(32);
20
- if (password.length >= 32) {
21
- padded.set(password.subarray(0, 32));
22
- }
23
- else {
24
- padded.set(password);
25
- padded.set(DEFAULT_PADDING.subarray(0, 32 - password.length), password.length);
26
- }
27
- return padded;
28
- }
29
4
  /**
30
5
  * Compute the master encryption key for a PDF file.
31
6
  *
@@ -1,4 +1,4 @@
1
- import { ByteArray } from '../../types';
1
+ import { ByteArray } from '../../types.js';
2
2
  /**
3
3
  * Decrypts the user password from the /O value using RC4-128.
4
4
  * Used to recover the user password when the owner password is known.
@@ -1,9 +1,8 @@
1
- import { md5 } from '../../utils/algos';
2
- import { concatUint8Arrays } from '../../utils/concatUint8Arrays';
3
- import { rc4 } from '../ciphers/rc4';
4
- import { DEFAULT_PADDING } from '../constants';
5
- import { padPassword } from '../key-derivation/key-derivation';
6
- import { int32ToLittleEndianBytes, removePdfPasswordPadding } from '../utils';
1
+ import { md5 } from '../../utils/algos.js';
2
+ import { concatUint8Arrays } from '../../utils/concatUint8Arrays.js';
3
+ import { rc4 } from '../ciphers/rc4.js';
4
+ import { DEFAULT_PADDING } from '../constants.js';
5
+ import { int32ToLittleEndianBytes, padPassword, removePdfPasswordPadding, } from '../utils.js';
7
6
  /**
8
7
  * Encrypts data with RC4 using the provided key.
9
8
  *
@@ -1,7 +1,6 @@
1
- import { padPassword } from '../key-derivation/key-derivation.js';
2
1
  import { rc4 } from '../ciphers/rc4.js';
3
2
  import { DEFAULT_PADDING } from '../constants.js';
4
- import { int32ToLittleEndianBytes, removePdfPasswordPadding } from '../utils.js';
3
+ import { int32ToLittleEndianBytes, padPassword, removePdfPasswordPadding, } from '../utils.js';
5
4
  import { md5 } from '../../utils/algos.js';
6
5
  import { concatUint8Arrays } from '../../utils/concatUint8Arrays.js';
7
6
  /**