pdf-lite 1.0.0 → 1.0.1-alpha.2
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.
- package/.github/workflows/docs.yaml +2 -0
- package/EXAMPLES.md +1 -4
- package/docs/README.md +127 -0
- package/docs/core/README.md +43 -0
- package/docs/core/decoder/README.md +11 -0
- package/docs/core/decoder/classes/PdfDecoder.md +362 -0
- package/docs/core/generators/README.md +14 -0
- package/docs/core/generators/functions/bytesToPdfObjects.md +26 -0
- package/docs/core/generators/functions/pdfDecoder.md +36 -0
- package/docs/core/generators/functions/pdfDecoderAsync.md +26 -0
- package/docs/core/generators/functions/stringToPdfObjects.md +25 -0
- package/docs/core/incremental-parser/README.md +13 -0
- package/docs/core/incremental-parser/classes/EofReachedError.md +55 -0
- package/docs/core/incremental-parser/classes/IncrementalParser.md +299 -0
- package/docs/core/incremental-parser/classes/NoMoreTokensError.md +55 -0
- package/docs/core/objects/pdf-array/README.md +11 -0
- package/docs/core/objects/pdf-array/classes/PdfArray.md +305 -0
- package/docs/core/objects/pdf-boolean/README.md +11 -0
- package/docs/core/objects/pdf-boolean/classes/PdfBoolean.md +265 -0
- package/docs/core/objects/pdf-comment/README.md +11 -0
- package/docs/core/objects/pdf-comment/classes/PdfComment.md +329 -0
- package/docs/core/objects/pdf-date/README.md +11 -0
- package/docs/core/objects/pdf-date/classes/PdfDate.md +317 -0
- package/docs/core/objects/pdf-dictionary/README.md +17 -0
- package/docs/core/objects/pdf-dictionary/classes/PdfDictionary.md +396 -0
- package/docs/core/objects/pdf-dictionary/type-aliases/PdfDictionaryEntries.md +9 -0
- package/docs/core/objects/pdf-dictionary/type-aliases/PdfDictionaryEntry.md +9 -0
- package/docs/core/objects/pdf-dictionary/type-aliases/PdfDictionaryMap.md +9 -0
- package/docs/core/objects/pdf-hexadecimal/README.md +11 -0
- package/docs/core/objects/pdf-hexadecimal/classes/PdfHexadecimal.md +320 -0
- package/docs/core/objects/pdf-indirect-object/README.md +11 -0
- package/docs/core/objects/pdf-indirect-object/classes/PdfIndirectObject.md +411 -0
- package/docs/core/objects/pdf-name/README.md +11 -0
- package/docs/core/objects/pdf-name/classes/PdfName.md +271 -0
- package/docs/core/objects/pdf-null/README.md +11 -0
- package/docs/core/objects/pdf-null/classes/PdfNull.md +259 -0
- package/docs/core/objects/pdf-number/README.md +12 -0
- package/docs/core/objects/pdf-number/classes/PdfByteOffsetNumber.md +369 -0
- package/docs/core/objects/pdf-number/classes/PdfNumber.md +345 -0
- package/docs/core/objects/pdf-object/README.md +11 -0
- package/docs/core/objects/pdf-object/classes/PdfObject.md +214 -0
- package/docs/core/objects/pdf-object-reference/README.md +11 -0
- package/docs/core/objects/pdf-object-reference/classes/PdfObjectReference.md +279 -0
- package/docs/core/objects/pdf-start-xref/README.md +11 -0
- package/docs/core/objects/pdf-start-xref/classes/PdfStartXRef.md +265 -0
- package/docs/core/objects/pdf-stream/README.md +23 -0
- package/docs/core/objects/pdf-stream/classes/PdfObjStream.md +699 -0
- package/docs/core/objects/pdf-stream/classes/PdfStream.md +570 -0
- package/docs/core/objects/pdf-stream/classes/PdfXRefStream.md +723 -0
- package/docs/core/objects/pdf-stream/classes/PdfXRefStreamCompressedEntry.md +51 -0
- package/docs/core/objects/pdf-stream/type-aliases/PdfXRefStreamEntry.md +9 -0
- package/docs/core/objects/pdf-stream/type-aliases/PdfXRefStreamStandardEntry.md +9 -0
- package/docs/core/objects/pdf-stream/variables/PdfXRefStreamStandardEntry.md +9 -0
- package/docs/core/objects/pdf-string/README.md +11 -0
- package/docs/core/objects/pdf-string/classes/PdfString.md +301 -0
- package/docs/core/objects/pdf-trailer/README.md +16 -0
- package/docs/core/objects/pdf-trailer/classes/PdfTrailer.md +271 -0
- package/docs/core/objects/pdf-trailer/type-aliases/PdfTrailerDictionary.md +9 -0
- package/docs/core/objects/pdf-trailer/type-aliases/PdfTrailerEntries.md +51 -0
- package/docs/core/objects/pdf-xref-table/README.md +13 -0
- package/docs/core/objects/pdf-xref-table/classes/PdfXRefTable.md +331 -0
- package/docs/core/objects/pdf-xref-table/classes/PdfXRefTableEntry.md +297 -0
- package/docs/core/objects/pdf-xref-table/classes/PdfXRefTableSectionHeader.md +277 -0
- package/docs/core/parser/README.md +11 -0
- package/docs/core/parser/classes/Parser.md +74 -0
- package/docs/core/ref/README.md +15 -0
- package/docs/core/ref/classes/Ref.md +149 -0
- package/docs/core/ref/type-aliases/RefUpdateCallback.md +33 -0
- package/docs/core/serializer/README.md +11 -0
- package/docs/core/serializer/classes/PdfTokenSerializer.md +106 -0
- package/docs/core/streams/object-stream/README.md +11 -0
- package/docs/core/streams/object-stream/classes/PdfObjectStream.md +69 -0
- package/docs/core/tokeniser/README.md +21 -0
- package/docs/core/tokeniser/classes/PdfByteStreamTokeniser.md +366 -0
- package/docs/core/tokeniser/classes/PdfObjectTokeniser.md +69 -0
- package/docs/core/tokeniser/functions/objectToTokens.md +25 -0
- package/docs/core/tokeniser/functions/pdfObjectStreamTokeniser.md +27 -0
- package/docs/core/tokeniser/type-aliases/PdfTokeniser.md +11 -0
- package/docs/core/tokens/boolean-token/README.md +11 -0
- package/docs/core/tokens/boolean-token/classes/PdfBooleanToken.md +139 -0
- package/docs/core/tokens/byte-offset-token/README.md +11 -0
- package/docs/core/tokens/byte-offset-token/classes/PdfByteOffsetToken.md +153 -0
- package/docs/core/tokens/comment-token/README.md +11 -0
- package/docs/core/tokens/comment-token/classes/PdfCommentToken.md +161 -0
- package/docs/core/tokens/end-array-token/README.md +11 -0
- package/docs/core/tokens/end-array-token/classes/PdfEndArrayToken.md +115 -0
- package/docs/core/tokens/end-dictionary-token/README.md +11 -0
- package/docs/core/tokens/end-dictionary-token/classes/PdfEndDictionaryToken.md +115 -0
- package/docs/core/tokens/end-object-token/README.md +11 -0
- package/docs/core/tokens/end-object-token/classes/PdfEndObjectToken.md +115 -0
- package/docs/core/tokens/end-stream-token/README.md +11 -0
- package/docs/core/tokens/end-stream-token/classes/PdfEndStreamToken.md +121 -0
- package/docs/core/tokens/hexadecimal-token/README.md +11 -0
- package/docs/core/tokens/hexadecimal-token/classes/PdfHexadecimalToken.md +127 -0
- package/docs/core/tokens/name-token/README.md +11 -0
- package/docs/core/tokens/name-token/classes/PdfNameToken.md +127 -0
- package/docs/core/tokens/null-token/README.md +11 -0
- package/docs/core/tokens/null-token/classes/PdfNullToken.md +115 -0
- package/docs/core/tokens/number-token/README.md +11 -0
- package/docs/core/tokens/number-token/classes/PdfNumberToken.md +271 -0
- package/docs/core/tokens/object-reference-token/README.md +11 -0
- package/docs/core/tokens/object-reference-token/classes/PdfObjectReferenceToken.md +137 -0
- package/docs/core/tokens/start-array-token/README.md +11 -0
- package/docs/core/tokens/start-array-token/classes/PdfStartArrayToken.md +115 -0
- package/docs/core/tokens/start-dictionary-token/README.md +11 -0
- package/docs/core/tokens/start-dictionary-token/classes/PdfStartDictionaryToken.md +115 -0
- package/docs/core/tokens/start-object-token/README.md +11 -0
- package/docs/core/tokens/start-object-token/classes/PdfStartObjectToken.md +147 -0
- package/docs/core/tokens/start-stream-token/README.md +11 -0
- package/docs/core/tokens/start-stream-token/classes/PdfStartStreamToken.md +147 -0
- package/docs/core/tokens/start-xref-token/README.md +11 -0
- package/docs/core/tokens/start-xref-token/classes/PdfStartXRefToken.md +115 -0
- package/docs/core/tokens/stream-chunk-token/README.md +11 -0
- package/docs/core/tokens/stream-chunk-token/classes/PdfStreamChunkToken.md +121 -0
- package/docs/core/tokens/string-token/README.md +11 -0
- package/docs/core/tokens/string-token/classes/PdfStringToken.md +127 -0
- package/docs/core/tokens/token/README.md +11 -0
- package/docs/core/tokens/token/classes/PdfToken.md +116 -0
- package/docs/core/tokens/trailer-token/README.md +11 -0
- package/docs/core/tokens/trailer-token/classes/PdfTrailerToken.md +127 -0
- package/docs/core/tokens/whitespace-token/README.md +11 -0
- package/docs/core/tokens/whitespace-token/classes/PdfWhitespaceToken.md +161 -0
- package/docs/core/tokens/xref-table-entry-token/README.md +11 -0
- package/docs/core/tokens/xref-table-entry-token/classes/PdfXRefTableEntryToken.md +157 -0
- package/docs/core/tokens/xref-table-section-start-token/README.md +11 -0
- package/docs/core/tokens/xref-table-section-start-token/classes/PdfXRefTableSectionStartToken.md +137 -0
- package/docs/core/tokens/xref-table-start-token/README.md +11 -0
- package/docs/core/tokens/xref-table-start-token/classes/PdfXRefTableStartToken.md +127 -0
- package/docs/crypto/ciphers/aes128/README.md +11 -0
- package/docs/crypto/ciphers/aes128/functions/aes128.md +39 -0
- package/docs/crypto/ciphers/aes256/README.md +11 -0
- package/docs/crypto/ciphers/aes256/functions/aes256.md +35 -0
- package/docs/crypto/ciphers/rc4/README.md +11 -0
- package/docs/crypto/ciphers/rc4/functions/rc4.md +35 -0
- package/docs/crypto/constants/README.md +11 -0
- package/docs/crypto/constants/variables/DEFAULT_PADDING.md +13 -0
- package/docs/crypto/key-derivation/key-derivation/README.md +13 -0
- package/docs/crypto/key-derivation/key-derivation/functions/computeMasterKey.md +57 -0
- package/docs/crypto/key-derivation/key-derivation/functions/deriveObjectKey.md +50 -0
- package/docs/crypto/key-derivation/key-derivation/functions/padPassword.md +33 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/README.md +13 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/functions/computeAlgorithm2bHash.md +45 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/functions/getFileKey.md +66 -0
- package/docs/crypto/key-derivation/key-derivation-aes256/functions/validatePasswordHash.md +52 -0
- package/docs/crypto/key-gen/key-gen-aes256/README.md +12 -0
- package/docs/crypto/key-gen/key-gen-aes256/functions/generateOandOe.md +44 -0
- package/docs/crypto/key-gen/key-gen-aes256/functions/generateUandUe.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/README.md +13 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/functions/computeOValueRc4_128.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/functions/computeUValueRc4_128.md +62 -0
- package/docs/crypto/key-gen/key-gen-rc4-128/functions/decryptUserPasswordRc4_128.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/README.md +14 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/computeEncryptionKeyRc4_40.md +49 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/computeORc4_40.md +38 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/computeURc4_40.md +50 -0
- package/docs/crypto/key-gen/key-gen-rc4-40/functions/decryptUserPasswordRc4_40.md +38 -0
- package/docs/crypto/types/README.md +11 -0
- package/docs/crypto/types/interfaces/Cipher.md +39 -0
- package/docs/crypto/utils/README.md +13 -0
- package/docs/crypto/utils/functions/int32ToLittleEndianBytes.md +31 -0
- package/docs/crypto/utils/functions/padPassword.md +33 -0
- package/docs/crypto/utils/functions/removePdfPasswordPadding.md +32 -0
- package/docs/filters/ascii85/README.md +11 -0
- package/docs/filters/ascii85/functions/ascii85.md +27 -0
- package/docs/filters/asciihex/README.md +11 -0
- package/docs/filters/asciihex/functions/asciiHex.md +27 -0
- package/docs/filters/flate/README.md +11 -0
- package/docs/filters/flate/functions/flate.md +26 -0
- package/docs/filters/lzw/README.md +11 -0
- package/docs/filters/lzw/functions/lzw.md +27 -0
- package/docs/filters/pass-through/README.md +11 -0
- package/docs/filters/pass-through/functions/passthroughFilter.md +25 -0
- package/docs/filters/runlength/README.md +11 -0
- package/docs/filters/runlength/functions/runLength.md +27 -0
- package/docs/filters/types/README.md +19 -0
- package/docs/filters/types/interfaces/PdfFilter.md +39 -0
- package/docs/filters/types/type-aliases/PdfStreamFilterType.md +9 -0
- package/docs/filters/types/variables/PDF_FILTER_TYPES.md +51 -0
- package/docs/index/README.md +235 -0
- package/docs/pdf/README.md +31 -0
- package/docs/pdf/errors/README.md +11 -0
- package/docs/pdf/errors/classes/FoundCompressedObjectError.md +56 -0
- package/docs/pdf/pdf-document/README.md +11 -0
- package/docs/pdf/pdf-document/classes/PdfDocument.md +876 -0
- package/docs/pdf/pdf-reader/README.md +11 -0
- package/docs/pdf/pdf-reader/classes/PdfReader.md +82 -0
- package/docs/pdf/pdf-revision/README.md +11 -0
- package/docs/pdf/pdf-revision/classes/PdfRevision.md +508 -0
- package/docs/pdf/pdf-xref-lookup/README.md +11 -0
- package/docs/pdf/pdf-xref-lookup/classes/PdfXrefLookup.md +421 -0
- package/docs/security/crypt-filters/aesv2/README.md +11 -0
- package/docs/security/crypt-filters/aesv2/classes/AesV2CryptFilter.md +274 -0
- package/docs/security/crypt-filters/aesv3/README.md +11 -0
- package/docs/security/crypt-filters/aesv3/classes/AesV3CryptFilter.md +275 -0
- package/docs/security/crypt-filters/base/README.md +15 -0
- package/docs/security/crypt-filters/base/classes/PdfCryptFilter.md +221 -0
- package/docs/security/crypt-filters/base/type-aliases/CryptFilterOptions.md +43 -0
- package/docs/security/crypt-filters/identity/README.md +11 -0
- package/docs/security/crypt-filters/identity/classes/IdentityCryptFilter.md +249 -0
- package/docs/security/crypt-filters/v2/README.md +11 -0
- package/docs/security/crypt-filters/v2/classes/V2CryptFilter.md +279 -0
- package/docs/security/handlers/base/README.md +17 -0
- package/docs/security/handlers/base/classes/PdfSecurityHandler.md +384 -0
- package/docs/security/handlers/base/classes/PdfStandardSecurityHandler.md +694 -0
- package/docs/security/handlers/base/type-aliases/PdfSecurityHandlerOptions.md +27 -0
- package/docs/security/handlers/base/type-aliases/PdfStandardSecurityHandlerOptions.md +43 -0
- package/docs/security/handlers/pubSec/README.md +11 -0
- package/docs/security/handlers/pubSec/classes/PdfPublicKeySecurityHandler.md +503 -0
- package/docs/security/handlers/utils/README.md +14 -0
- package/docs/security/handlers/utils/functions/createFromDictionary.md +56 -0
- package/docs/security/handlers/utils/functions/createFromEncryptionOptions.md +40 -0
- package/docs/security/handlers/utils/functions/createStandardSecurityHandlerFromDictionary.md +55 -0
- package/docs/security/handlers/utils/functions/getCryptFilter.md +35 -0
- package/docs/security/handlers/v1/README.md +11 -0
- package/docs/security/handlers/v1/classes/PdfV1SecurityHandler.md +779 -0
- package/docs/security/handlers/v2/README.md +11 -0
- package/docs/security/handlers/v2/classes/PdfV2SecurityHandler.md +783 -0
- package/docs/security/handlers/v4/README.md +11 -0
- package/docs/security/handlers/v4/classes/PdfV4SecurityHandler.md +907 -0
- package/docs/security/handlers/v5/README.md +11 -0
- package/docs/security/handlers/v5/classes/PdfV5SecurityHandler.md +926 -0
- package/docs/security/types/README.md +19 -0
- package/docs/security/types/type-aliases/CryptFilterType.md +15 -0
- package/docs/security/types/type-aliases/PdfCryptFilterDictionary.md +12 -0
- package/docs/security/types/type-aliases/PdfEncryptionAlgorithmOptions.md +11 -0
- package/docs/security/types/type-aliases/PdfEncryptionAlgorithmType.md +17 -0
- package/docs/security/types/type-aliases/PdfEncryptionDictionary.md +13 -0
- package/docs/security/types/type-aliases/PdfEncryptionDictionaryObject.md +11 -0
- package/docs/security/types/type-aliases/PdfEncryptionOptions.md +90 -0
- package/docs/security/types/type-aliases/PdfEncryptionRecipient.md +24 -0
- package/docs/security/types/type-aliases/PdfId.md +13 -0
- package/docs/signing/README.md +127 -0
- package/docs/signing/document-security-store/README.md +19 -0
- package/docs/signing/document-security-store/classes/PdfCertObject.md +443 -0
- package/docs/signing/document-security-store/classes/PdfCrlObject.md +443 -0
- package/docs/signing/document-security-store/classes/PdfDocumentSecurityStoreDictionary.md +416 -0
- package/docs/signing/document-security-store/classes/PdfDocumentSecurityStoreObject.md +563 -0
- package/docs/signing/document-security-store/classes/PdfOcspObject.md +443 -0
- package/docs/signing/document-security-store/type-aliases/PdfVriObject.md +12 -0
- package/docs/signing/signatures/README.md +55 -0
- package/docs/signing/signatures/adbe-pkcs7-detached/README.md +11 -0
- package/docs/signing/signatures/adbe-pkcs7-detached/classes/PdfAdbePkcs7DetachedSignatureObject.md +669 -0
- package/docs/signing/signatures/adbe-pkcs7-sha1/README.md +11 -0
- package/docs/signing/signatures/adbe-pkcs7-sha1/classes/PdfAdbePkcs7Sha1SignatureObject.md +667 -0
- package/docs/signing/signatures/adbe-x509-rsa-sha1/README.md +11 -0
- package/docs/signing/signatures/adbe-x509-rsa-sha1/classes/PdfAdbePkcsX509RsaSha1SignatureObject.md +651 -0
- package/docs/signing/signatures/base/README.md +16 -0
- package/docs/signing/signatures/base/classes/PdfSignatureDictionary.md +420 -0
- package/docs/signing/signatures/base/classes/PdfSignatureObject.md +584 -0
- package/docs/signing/signatures/base/type-aliases/PdfSignatureSignOptions.md +51 -0
- package/docs/signing/signatures/etsi-cades-detached/README.md +11 -0
- package/docs/signing/signatures/etsi-cades-detached/classes/PdfEtsiCadesDetachedSignatureObject.md +693 -0
- package/docs/signing/signatures/etsi-rfc3161/README.md +11 -0
- package/docs/signing/signatures/etsi-rfc3161/classes/PdfEtsiRfc3161SignatureObject.md +614 -0
- package/docs/signing/signer/README.md +11 -0
- package/docs/signing/signer/classes/PdfSigner.md +58 -0
- package/docs/signing/types/README.md +16 -0
- package/docs/signing/types/type-aliases/PdfSignatureDictionaryEntries.md +95 -0
- package/docs/signing/types/type-aliases/PdfSignatureSubType.md +17 -0
- package/docs/signing/types/type-aliases/PdfSignatureType.md +14 -0
- package/docs/signing/types/type-aliases/RevocationInfo.md +43 -0
- package/docs/signing/types/type-aliases/SignaturePolicyDocument.md +35 -0
- package/docs/signing/types/type-aliases/TimeStampAuthority.md +35 -0
- package/docs/signing/utils/README.md +11 -0
- package/docs/signing/utils/functions/fetchRevocationInfo.md +70 -0
- package/docs/types/README.md +21 -0
- package/docs/types/type-aliases/ByteArray.md +9 -0
- package/docs/types/type-aliases/ChangeType.md +9 -0
- package/docs/types/type-aliases/DecodeParms.md +33 -0
- package/docs/types/type-aliases/HashAlgorithm.md +9 -0
- package/docs/types/type-aliases/PdfEncryptionAlgorithm.md +9 -0
- package/docs/types/type-aliases/PdfPermissions.md +63 -0
- package/docs/types/type-aliases/PdfVersion.md +9 -0
- package/docs/types/variables/PERMISSION_FLAGS.md +9 -0
- package/docs/utils/IterableReadableStream/README.md +11 -0
- package/docs/utils/IterableReadableStream/classes/IterableReadableStream.md +103 -0
- package/docs/utils/algos/README.md +28 -0
- package/docs/utils/algos/functions/aes128CbcNoPaddingEncrypt.md +43 -0
- package/docs/utils/algos/functions/aes128cbcDecrypt.md +47 -0
- package/docs/utils/algos/functions/aes128cbcEncrypt.md +47 -0
- package/docs/utils/algos/functions/aes256CbcNoPaddingDecrypt.md +43 -0
- package/docs/utils/algos/functions/aes256CbcNoPaddingEncrypt.md +43 -0
- package/docs/utils/algos/functions/aes256cbcDecrypt.md +43 -0
- package/docs/utils/algos/functions/aes256cbcEncrypt.md +43 -0
- package/docs/utils/algos/functions/aes256ecbDecrypt.md +41 -0
- package/docs/utils/algos/functions/aes256ecbEncrypt.md +41 -0
- package/docs/utils/algos/functions/deflateData.md +31 -0
- package/docs/utils/algos/functions/getRandomBytes.md +35 -0
- package/docs/utils/algos/functions/hash.md +41 -0
- package/docs/utils/algos/functions/inflateData.md +35 -0
- package/docs/utils/algos/functions/md5.md +31 -0
- package/docs/utils/algos/functions/sha1.md +31 -0
- package/docs/utils/algos/functions/sha256.md +31 -0
- package/docs/utils/algos/functions/sha384.md +31 -0
- package/docs/utils/algos/functions/sha512.md +31 -0
- package/docs/utils/assert/README.md +12 -0
- package/docs/utils/assert/functions/assert.md +39 -0
- package/docs/utils/assert/functions/assertIfDefined.md +46 -0
- package/docs/utils/bytesToHex/README.md +11 -0
- package/docs/utils/bytesToHex/functions/bytesToHex.md +31 -0
- package/docs/utils/bytesToHexBytes/README.md +11 -0
- package/docs/utils/bytesToHexBytes/functions/bytesToHexBytes.md +32 -0
- package/docs/utils/bytesToString/README.md +11 -0
- package/docs/utils/bytesToString/functions/bytesToString.md +31 -0
- package/docs/utils/concatUint8Arrays/README.md +11 -0
- package/docs/utils/concatUint8Arrays/functions/concatUint8Arrays.md +31 -0
- package/docs/utils/escapeString/README.md +11 -0
- package/docs/utils/escapeString/functions/escapeString.md +32 -0
- package/docs/utils/hexBytesToBytes/README.md +11 -0
- package/docs/utils/hexBytesToBytes/functions/hexBytesToBytes.md +33 -0
- package/docs/utils/hexBytesToString/README.md +11 -0
- package/docs/utils/hexBytesToString/functions/hexBytesToString.md +31 -0
- package/docs/utils/hexToBytes/README.md +11 -0
- package/docs/utils/hexToBytes/functions/hexToBytes.md +31 -0
- package/docs/utils/padBytes/README.md +11 -0
- package/docs/utils/padBytes/functions/padBytes.md +41 -0
- package/docs/utils/predictors/README.md +11 -0
- package/docs/utils/predictors/classes/Predictor.md +306 -0
- package/docs/utils/replaceInBuffer/README.md +11 -0
- package/docs/utils/replaceInBuffer/functions/replaceInBuffer.md +65 -0
- package/docs/utils/stringToBytes/README.md +11 -0
- package/docs/utils/stringToBytes/functions/stringToBytes.md +32 -0
- package/docs/utils/stringToHexBytes/README.md +11 -0
- package/docs/utils/stringToHexBytes/functions/stringToHexBytes.md +33 -0
- package/docs/utils/unescapeString/README.md +11 -0
- package/docs/utils/unescapeString/functions/unescapeString.md +34 -0
- package/package.json +63 -71
- package/packages/pdf-lite/node_modules/.bin/playwright +16 -0
- package/packages/pdf-lite/node_modules/.bin/tsc +16 -0
- package/packages/pdf-lite/node_modules/.bin/tsserver +16 -0
- package/packages/pdf-lite/node_modules/.bin/vitest +16 -0
- package/packages/pdf-lite/package.json +2 -2
- package/packages/pdf-lite/scripts/create-encryption-tests.sh +0 -0
- package/packages/pdf-lite/scripts/gen-signing-keys.sh +0 -0
- package/packages/pdf-lite/scripts/generate-all-signing-keys.sh +0 -0
- package/scripts/bump-version.sh +0 -0
- package/scripts/gen-html-docs.sh +0 -0
- package/scripts/gen-md-docs.sh +0 -0
- package/scripts/prepare-release.sh +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-derivation/key-derivation](../README.md) / deriveObjectKey
|
|
6
|
+
|
|
7
|
+
# Function: deriveObjectKey()
|
|
8
|
+
|
|
9
|
+
> **deriveObjectKey**(`mkey`, `objNumber`, `objGeneration`, `useAesSalt`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Derives an object-specific encryption key from the master key.
|
|
12
|
+
Used to encrypt individual PDF objects with unique keys.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### mkey
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The master encryption key.
|
|
21
|
+
|
|
22
|
+
### objNumber
|
|
23
|
+
|
|
24
|
+
`number`
|
|
25
|
+
|
|
26
|
+
The PDF object number.
|
|
27
|
+
|
|
28
|
+
### objGeneration
|
|
29
|
+
|
|
30
|
+
`number`
|
|
31
|
+
|
|
32
|
+
The PDF object generation number.
|
|
33
|
+
|
|
34
|
+
### useAesSalt
|
|
35
|
+
|
|
36
|
+
`boolean` = `true`
|
|
37
|
+
|
|
38
|
+
Whether to include the AES salt ('sAlT'). Defaults to true.
|
|
39
|
+
|
|
40
|
+
## Returns
|
|
41
|
+
|
|
42
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
43
|
+
|
|
44
|
+
A promise that resolves to the derived object key.
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
const objectKey = await deriveObjectKey(masterKey, 5, 0)
|
|
50
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-derivation/key-derivation](../README.md) / padPassword
|
|
6
|
+
|
|
7
|
+
# Function: padPassword()
|
|
8
|
+
|
|
9
|
+
> **padPassword**(`password`): [`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
10
|
+
|
|
11
|
+
Pads a password to exactly 32 bytes using the PDF standard padding.
|
|
12
|
+
If the password is shorter than 32 bytes, it is padded with bytes from DEFAULT_PADDING.
|
|
13
|
+
If the password is 32 bytes or longer, only the first 32 bytes are used.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### password
|
|
18
|
+
|
|
19
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
20
|
+
|
|
21
|
+
The password to pad.
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
26
|
+
|
|
27
|
+
A 32-byte padded password.
|
|
28
|
+
|
|
29
|
+
## Example
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
const padded = padPassword(new Uint8Array([1, 2, 3])) // Returns 32-byte array
|
|
33
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**pdf-lite**](../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../README.md) / crypto/key-derivation/key-derivation-aes256
|
|
6
|
+
|
|
7
|
+
# crypto/key-derivation/key-derivation-aes256
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
- [computeAlgorithm2bHash](functions/computeAlgorithm2bHash.md)
|
|
12
|
+
- [getFileKey](functions/getFileKey.md)
|
|
13
|
+
- [validatePasswordHash](functions/validatePasswordHash.md)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-derivation/key-derivation-aes256](../README.md) / computeAlgorithm2bHash
|
|
6
|
+
|
|
7
|
+
# Function: computeAlgorithm2bHash()
|
|
8
|
+
|
|
9
|
+
> **computeAlgorithm2bHash**(`password`, `salt`, `userKey`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Computes the Algorithm 2.B hash for PDF 2.0 AES-256 encryption.
|
|
12
|
+
This iterative hash algorithm uses SHA-256, SHA-384, or SHA-512 based on
|
|
13
|
+
intermediate results, running for at least 64 rounds.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
### password
|
|
18
|
+
|
|
19
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
20
|
+
|
|
21
|
+
The user or owner password.
|
|
22
|
+
|
|
23
|
+
### salt
|
|
24
|
+
|
|
25
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
26
|
+
|
|
27
|
+
The 8-byte validation or key salt.
|
|
28
|
+
|
|
29
|
+
### userKey
|
|
30
|
+
|
|
31
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md) = `...`
|
|
32
|
+
|
|
33
|
+
The user key (required for owner password validation). Defaults to empty.
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
38
|
+
|
|
39
|
+
A promise that resolves to a 32-byte hash.
|
|
40
|
+
|
|
41
|
+
## Example
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const hash = await computeAlgorithm2bHash(password, salt)
|
|
45
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-derivation/key-derivation-aes256](../README.md) / getFileKey
|
|
6
|
+
|
|
7
|
+
# Function: getFileKey()
|
|
8
|
+
|
|
9
|
+
> **getFileKey**(`userPassword`, `ownerPassword`, `u`, `ue`, `o`, `oe`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Retrieves the file encryption key using user or owner password.
|
|
12
|
+
Tries owner password first, then falls back to user password.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### userPassword
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The user password to try.
|
|
21
|
+
|
|
22
|
+
### ownerPassword
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The owner password to try.
|
|
27
|
+
|
|
28
|
+
### u
|
|
29
|
+
|
|
30
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
31
|
+
|
|
32
|
+
The 48-byte /U value from the encryption dictionary.
|
|
33
|
+
|
|
34
|
+
### ue
|
|
35
|
+
|
|
36
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
37
|
+
|
|
38
|
+
The 32-byte /UE value (encrypted user key).
|
|
39
|
+
|
|
40
|
+
### o
|
|
41
|
+
|
|
42
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
43
|
+
|
|
44
|
+
The 48-byte /O value from the encryption dictionary.
|
|
45
|
+
|
|
46
|
+
### oe
|
|
47
|
+
|
|
48
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
49
|
+
|
|
50
|
+
The 32-byte /OE value (encrypted owner key).
|
|
51
|
+
|
|
52
|
+
## Returns
|
|
53
|
+
|
|
54
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
55
|
+
|
|
56
|
+
A promise that resolves to the 32-byte file encryption key.
|
|
57
|
+
|
|
58
|
+
## Throws
|
|
59
|
+
|
|
60
|
+
Error if both passwords are invalid.
|
|
61
|
+
|
|
62
|
+
## Example
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const fileKey = await getFileKey(userPw, ownerPw, U, UE, O, OE)
|
|
66
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-derivation/key-derivation-aes256](../README.md) / validatePasswordHash
|
|
6
|
+
|
|
7
|
+
# Function: validatePasswordHash()
|
|
8
|
+
|
|
9
|
+
> **validatePasswordHash**(`password`, `key`, `extra?`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Validates a password against a stored hash using the Algorithm 2.B hash.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
### password
|
|
16
|
+
|
|
17
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
18
|
+
|
|
19
|
+
The password to validate.
|
|
20
|
+
|
|
21
|
+
### key
|
|
22
|
+
|
|
23
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
24
|
+
|
|
25
|
+
The stored key containing the hash (first 32 bytes) and validation salt (bytes 32-40).
|
|
26
|
+
|
|
27
|
+
### extra?
|
|
28
|
+
|
|
29
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
30
|
+
|
|
31
|
+
Extra data for owner password validation (user key).
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
36
|
+
|
|
37
|
+
A promise that resolves to the computed hash if validation succeeds.
|
|
38
|
+
|
|
39
|
+
## Throws
|
|
40
|
+
|
|
41
|
+
Error if the password is invalid or salt/hash lengths are incorrect.
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
try {
|
|
47
|
+
await validatePasswordHash(password, storedKey)
|
|
48
|
+
console.log('Password is valid')
|
|
49
|
+
} catch (e) {
|
|
50
|
+
console.log('Invalid password')
|
|
51
|
+
}
|
|
52
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[**pdf-lite**](../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../README.md) / crypto/key-gen/key-gen-aes256
|
|
6
|
+
|
|
7
|
+
# crypto/key-gen/key-gen-aes256
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
- [generateOandOe](functions/generateOandOe.md)
|
|
12
|
+
- [generateUandUe](functions/generateUandUe.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-aes256](../README.md) / generateOandOe
|
|
6
|
+
|
|
7
|
+
# Function: generateOandOe()
|
|
8
|
+
|
|
9
|
+
> **generateOandOe**(`password`, `U`, `fileKey`): `Promise`\<\{ `O`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); `OE`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); \}\>
|
|
10
|
+
|
|
11
|
+
Generates the /O and /OE values for AES-256 PDF encryption.
|
|
12
|
+
These values are used to validate the owner password and decrypt the file key.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### password
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The owner password.
|
|
21
|
+
|
|
22
|
+
### U
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The 48-byte /U value (required for owner key derivation).
|
|
27
|
+
|
|
28
|
+
### fileKey
|
|
29
|
+
|
|
30
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
31
|
+
|
|
32
|
+
The 32-byte file encryption key.
|
|
33
|
+
|
|
34
|
+
## Returns
|
|
35
|
+
|
|
36
|
+
`Promise`\<\{ `O`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); `OE`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); \}\>
|
|
37
|
+
|
|
38
|
+
A promise that resolves to an object containing the 48-byte O and 32-byte OE values.
|
|
39
|
+
|
|
40
|
+
## Example
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const { O, OE } = await generateOandOe(ownerPassword, U, fileKey)
|
|
44
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-aes256](../README.md) / generateUandUe
|
|
6
|
+
|
|
7
|
+
# Function: generateUandUe()
|
|
8
|
+
|
|
9
|
+
> **generateUandUe**(`password`, `fileKey`): `Promise`\<\{ `U`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); `UE`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); \}\>
|
|
10
|
+
|
|
11
|
+
Generates the /U and /UE values for AES-256 PDF encryption.
|
|
12
|
+
These values are used to validate the user password and decrypt the file key.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### password
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The user password.
|
|
21
|
+
|
|
22
|
+
### fileKey
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The 32-byte file encryption key.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<\{ `U`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); `UE`: [`ByteArray`](../../../../types/type-aliases/ByteArray.md); \}\>
|
|
31
|
+
|
|
32
|
+
A promise that resolves to an object containing the 48-byte U and 32-byte UE values.
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const { U, UE } = await generateUandUe(password, fileKey)
|
|
38
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**pdf-lite**](../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../README.md) / crypto/key-gen/key-gen-rc4-128
|
|
6
|
+
|
|
7
|
+
# crypto/key-gen/key-gen-rc4-128
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
- [computeOValueRc4_128](functions/computeOValueRc4_128.md)
|
|
12
|
+
- [computeUValueRc4_128](functions/computeUValueRc4_128.md)
|
|
13
|
+
- [decryptUserPasswordRc4_128](functions/decryptUserPasswordRc4_128.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-rc4-128](../README.md) / computeOValueRc4_128
|
|
6
|
+
|
|
7
|
+
# Function: computeOValueRc4_128()
|
|
8
|
+
|
|
9
|
+
> **computeOValueRc4_128**(`ownerPassword`, `userPassword`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Computes the /O value for RC4-128 PDF encryption.
|
|
12
|
+
The /O value is used to verify the owner password.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### ownerPassword
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The owner password.
|
|
21
|
+
|
|
22
|
+
### userPassword
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The user password.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
31
|
+
|
|
32
|
+
A promise that resolves to the 32-byte /O value.
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const O = await computeOValueRc4_128(ownerPassword, userPassword)
|
|
38
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-rc4-128](../README.md) / computeUValueRc4_128
|
|
6
|
+
|
|
7
|
+
# Function: computeUValueRc4_128()
|
|
8
|
+
|
|
9
|
+
> **computeUValueRc4_128**(`userPassword`, `oValue`, `permissions`, `id`, `encryptMetadata`, `revision?`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Computes the /U value for RC4-128 PDF encryption.
|
|
12
|
+
The /U value is used to verify the user password.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### userPassword
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The user password.
|
|
21
|
+
|
|
22
|
+
### oValue
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The /O value.
|
|
27
|
+
|
|
28
|
+
### permissions
|
|
29
|
+
|
|
30
|
+
`number`
|
|
31
|
+
|
|
32
|
+
The /P value (permissions flags).
|
|
33
|
+
|
|
34
|
+
### id
|
|
35
|
+
|
|
36
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
37
|
+
|
|
38
|
+
The first element of the /ID array.
|
|
39
|
+
|
|
40
|
+
### encryptMetadata
|
|
41
|
+
|
|
42
|
+
`boolean`
|
|
43
|
+
|
|
44
|
+
Whether to encrypt metadata.
|
|
45
|
+
|
|
46
|
+
### revision?
|
|
47
|
+
|
|
48
|
+
`number`
|
|
49
|
+
|
|
50
|
+
The encryption revision number.
|
|
51
|
+
|
|
52
|
+
## Returns
|
|
53
|
+
|
|
54
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
55
|
+
|
|
56
|
+
A promise that resolves to the 32-byte /U value.
|
|
57
|
+
|
|
58
|
+
## Example
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
const U = await computeUValueRc4_128(userPassword, O, permissions, fileId, true)
|
|
62
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-rc4-128](../README.md) / decryptUserPasswordRc4_128
|
|
6
|
+
|
|
7
|
+
# Function: decryptUserPasswordRc4_128()
|
|
8
|
+
|
|
9
|
+
> **decryptUserPasswordRc4_128**(`ownerPw`, `ownerKey`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Decrypts the user password from the /O value using RC4-128.
|
|
12
|
+
Used to recover the user password when the owner password is known.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### ownerPw
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The owner password.
|
|
21
|
+
|
|
22
|
+
### ownerKey
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The /O value from the encryption dictionary.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
31
|
+
|
|
32
|
+
A promise that resolves to the decrypted user password (with padding removed).
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const userPassword = await decryptUserPasswordRc4_128(ownerPw, O)
|
|
38
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[**pdf-lite**](../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../README.md) / crypto/key-gen/key-gen-rc4-40
|
|
6
|
+
|
|
7
|
+
# crypto/key-gen/key-gen-rc4-40
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
- [computeEncryptionKeyRc4_40](functions/computeEncryptionKeyRc4_40.md)
|
|
12
|
+
- [computeORc4_40](functions/computeORc4_40.md)
|
|
13
|
+
- [computeURc4_40](functions/computeURc4_40.md)
|
|
14
|
+
- [decryptUserPasswordRc4_40](functions/decryptUserPasswordRc4_40.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-rc4-40](../README.md) / computeEncryptionKeyRc4_40
|
|
6
|
+
|
|
7
|
+
# Function: computeEncryptionKeyRc4_40()
|
|
8
|
+
|
|
9
|
+
> **computeEncryptionKeyRc4_40**(`userPw`, `oValue`, `permissions`, `fileId`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Computes the 40-bit encryption key for RC4-40 PDF encryption.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
### userPw
|
|
16
|
+
|
|
17
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
18
|
+
|
|
19
|
+
The user password.
|
|
20
|
+
|
|
21
|
+
### oValue
|
|
22
|
+
|
|
23
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
24
|
+
|
|
25
|
+
The /O value.
|
|
26
|
+
|
|
27
|
+
### permissions
|
|
28
|
+
|
|
29
|
+
`number`
|
|
30
|
+
|
|
31
|
+
The /P value (permissions flags).
|
|
32
|
+
|
|
33
|
+
### fileId
|
|
34
|
+
|
|
35
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
36
|
+
|
|
37
|
+
The first element of the /ID array.
|
|
38
|
+
|
|
39
|
+
## Returns
|
|
40
|
+
|
|
41
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
42
|
+
|
|
43
|
+
A promise that resolves to the 5-byte (40-bit) encryption key.
|
|
44
|
+
|
|
45
|
+
## Example
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const key = await computeEncryptionKeyRc4_40(userPw, O, permissions, fileId)
|
|
49
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-rc4-40](../README.md) / computeORc4_40
|
|
6
|
+
|
|
7
|
+
# Function: computeORc4_40()
|
|
8
|
+
|
|
9
|
+
> **computeORc4_40**(`ownerPw`, `userPw`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Computes the /O value for RC4-40 PDF encryption.
|
|
12
|
+
The /O value is used to verify the owner password.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### ownerPw
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The owner password.
|
|
21
|
+
|
|
22
|
+
### userPw
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The user password.
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
31
|
+
|
|
32
|
+
A promise that resolves to the 32-byte /O value.
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const O = await computeORc4_40(ownerPassword, userPassword)
|
|
38
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[**pdf-lite**](../../../../README.md)
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
[pdf-lite](../../../../README.md) / [crypto/key-gen/key-gen-rc4-40](../README.md) / computeURc4_40
|
|
6
|
+
|
|
7
|
+
# Function: computeURc4_40()
|
|
8
|
+
|
|
9
|
+
> **computeURc4_40**(`userPw`, `oValue`, `permissions`, `fileId`): `Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
10
|
+
|
|
11
|
+
Computes the /U value for RC4-40 PDF encryption.
|
|
12
|
+
The /U value is used to verify the user password.
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
### userPw
|
|
17
|
+
|
|
18
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
19
|
+
|
|
20
|
+
The user password.
|
|
21
|
+
|
|
22
|
+
### oValue
|
|
23
|
+
|
|
24
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
25
|
+
|
|
26
|
+
The /O value.
|
|
27
|
+
|
|
28
|
+
### permissions
|
|
29
|
+
|
|
30
|
+
`number`
|
|
31
|
+
|
|
32
|
+
The /P value (permissions flags).
|
|
33
|
+
|
|
34
|
+
### fileId
|
|
35
|
+
|
|
36
|
+
[`ByteArray`](../../../../types/type-aliases/ByteArray.md)
|
|
37
|
+
|
|
38
|
+
The first element of the /ID array.
|
|
39
|
+
|
|
40
|
+
## Returns
|
|
41
|
+
|
|
42
|
+
`Promise`\<[`ByteArray`](../../../../types/type-aliases/ByteArray.md)\>
|
|
43
|
+
|
|
44
|
+
A promise that resolves to the 32-byte /U value.
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
const U = await computeURc4_40(userPassword, O, permissions, fileId)
|
|
50
|
+
```
|