* Parse and validate the encryption version.
(dict: PdfDict)
| 166 | * Parse and validate the encryption version. |
| 167 | */ |
| 168 | function parseVersion(dict: PdfDict): EncryptionVersion { |
| 169 | const version = dict.getNumber("V")?.value; |
| 170 | |
| 171 | if (version === undefined) { |
| 172 | throw new EncryptionDictError("Missing /V (version) in encryption dictionary"); |
| 173 | } |
| 174 | |
| 175 | if (!isEncryptionVersion(version)) { |
| 176 | throw new EncryptionDictError(`Unsupported encryption version: ${version}`); |
| 177 | } |
| 178 | |
| 179 | return version; |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Parse and validate the encryption revision. |
no test coverage detected