@l1yp/file-viewer 0.1.0
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/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//#region src/lib/viewerFormats.ts
|
|
2
|
+
var e = [
|
|
3
|
+
{
|
|
4
|
+
key: "hex",
|
|
5
|
+
label: "十六进制",
|
|
6
|
+
icon: "hex",
|
|
7
|
+
patch: {
|
|
8
|
+
lang: "",
|
|
9
|
+
hex: !0
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: "text",
|
|
14
|
+
label: "文本 / 源码",
|
|
15
|
+
icon: "code",
|
|
16
|
+
patch: { lang: "" }
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: "markdown",
|
|
20
|
+
label: "Markdown",
|
|
21
|
+
icon: "fileOutline",
|
|
22
|
+
patch: { lang: "markdown" }
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: "html",
|
|
26
|
+
label: "HTML",
|
|
27
|
+
icon: "globe",
|
|
28
|
+
patch: {
|
|
29
|
+
lang: "xml",
|
|
30
|
+
html: !0
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: "svg",
|
|
35
|
+
label: "SVG",
|
|
36
|
+
icon: "image",
|
|
37
|
+
patch: {
|
|
38
|
+
lang: "xml",
|
|
39
|
+
svg: !0
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "image",
|
|
44
|
+
label: "图片",
|
|
45
|
+
icon: "image",
|
|
46
|
+
patch: {
|
|
47
|
+
lang: "",
|
|
48
|
+
image: !0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "audio",
|
|
53
|
+
label: "音频",
|
|
54
|
+
icon: "music",
|
|
55
|
+
patch: {
|
|
56
|
+
lang: "",
|
|
57
|
+
audio: !0
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "video",
|
|
62
|
+
label: "视频",
|
|
63
|
+
icon: "play",
|
|
64
|
+
patch: {
|
|
65
|
+
lang: "",
|
|
66
|
+
video: !0
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
function t(t) {
|
|
71
|
+
return e.find((e) => e.key === t);
|
|
72
|
+
}
|
|
73
|
+
function n(e, t) {
|
|
74
|
+
return {
|
|
75
|
+
name: e.name,
|
|
76
|
+
url: e.url,
|
|
77
|
+
size: e.size,
|
|
78
|
+
content: e.content,
|
|
79
|
+
...t.patch
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { e as VIEWER_FORMATTERS, n as applyFormatter, t as findFormatter };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ViewerFile } from '@/composables/useFileViewer';
|
|
2
|
+
export interface ClassifyOpts {
|
|
3
|
+
/** Display name (becomes {@link ViewerFile.name}). */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Fetch / download URL — the real endpoint, or a `blob:` URL for an extracted archive entry. */
|
|
6
|
+
url: string;
|
|
7
|
+
/** Provider mime when known; null for archive entries (extension-driven detection). */
|
|
8
|
+
mime?: string | null;
|
|
9
|
+
/** Byte size when known (drives the large-file / log routing). */
|
|
10
|
+
size?: number;
|
|
11
|
+
/** Name used for TYPE detection when it differs from the display name (e.g. a chip captioned "16×16 PNG"). */
|
|
12
|
+
detectName?: string;
|
|
13
|
+
/** Fall-back hint when nothing matches and the extension is ambiguous (archive NUL-sniff says "looks textual"). */
|
|
14
|
+
textHint?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Classify a file into the {@link ViewerFile} the side viewer should render. Pure — no lightbox / fetching
|
|
18
|
+
* side effects (FileChip handles the lightbox before calling this). Never returns image/video for the main
|
|
19
|
+
* chip flow (FileChip routes those itself); archive callers DO get image/video/binary.
|
|
20
|
+
*/
|
|
21
|
+
export declare function classifyViewerFile(o: ClassifyOpts): ViewerFile;
|
|
22
|
+
/** Best-effort media MIME for an extracted archive entry's Blob (see {@link MEDIA_MIME}); '' when not media. */
|
|
23
|
+
export declare function mediaMimeForName(name: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Does this file render WITHOUT the panel-loaded text — i.e. a self-fetching sub-viewer (it pulls its own
|
|
26
|
+
* bytes), or an image/video/binary (rendered straight from the URL)? When true the panel skips the text
|
|
27
|
+
* fetch and hides the copy/refresh actions; when false the content is built from fetched text (markdown /
|
|
28
|
+
* html / svg / subtitle / geo / csv / mind-map / source) or inline `content`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function skipsTextLoad(file: ViewerFile | null): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Can this file be shown both rendered and as source (so the header offers an eye/code toggle)? True for
|
|
33
|
+
* markdown / html / svg / subtitle / geo / csv, and for a mind map only once the loaded text actually looks
|
|
34
|
+
* like one (a non-mind-map `.mm` reads as plain source, no toggle).
|
|
35
|
+
*/
|
|
36
|
+
export declare function canToggleView(file: ViewerFile | null, text: string): boolean;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { ebookKind as e, fileExt as t, hljsLang as n, isAppxFile as r, isAudioFile as i, isBinaryObjFile as a, isCertFile as o, isCsvFile as s, isDicomFile as c, isDocxFile as l, isDxfFile as u, isEmlFile as d, isEplFile as f, isFontFile as p, isGeoFile as m, isHarFile as h, isHprofFile as g, isHtmlFile as _, isImageFile as v, isJavaClassFile as y, isJksFile as b, isJsonlFile as x, isLogFile as S, isLrcFile as C, isMhtFile as w, isMindMapFile as T, isModelFile as E, isMsiFile as D, isNotebookFile as O, isPdfFile as k, isPptxFile as A, isQmcAudioFile as j, isRarFile as M, isRtfFile as N, isSevenZipFile as P, isSqliteFile as F, isSubtitleFile as I, isSvgFile as L, isTarballFile as R, isTextFile as z, isVideoFile as B, isXlsxFile as V, isXmindFile as H, isZipFile as U, rasterImageKind as W } from "./fileType.js";
|
|
2
|
+
import { isDiagramFile as G } from "./diagram.js";
|
|
3
|
+
import { looksLikeMindMap as K } from "./mindmap.js";
|
|
4
|
+
//#region src/lib/viewerKind.ts
|
|
5
|
+
function q(t) {
|
|
6
|
+
let K = t.name, q = t.detectName ?? t.name, J = t.mime ?? null, Y = t.size, X = {
|
|
7
|
+
name: K,
|
|
8
|
+
url: t.url,
|
|
9
|
+
size: Y
|
|
10
|
+
}, Z = W(q, J);
|
|
11
|
+
if (Z) return {
|
|
12
|
+
...X,
|
|
13
|
+
lang: "",
|
|
14
|
+
raster: Z
|
|
15
|
+
};
|
|
16
|
+
let Q = e(q, J);
|
|
17
|
+
if (Q) return {
|
|
18
|
+
...X,
|
|
19
|
+
lang: "",
|
|
20
|
+
ebook: Q
|
|
21
|
+
};
|
|
22
|
+
let $ = G(q, J);
|
|
23
|
+
return $ ? {
|
|
24
|
+
...X,
|
|
25
|
+
lang: $ === "excalidraw" ? "json" : "xml",
|
|
26
|
+
diagram: $
|
|
27
|
+
} : v(q, J) ? {
|
|
28
|
+
...X,
|
|
29
|
+
lang: "",
|
|
30
|
+
image: !0
|
|
31
|
+
} : B(q, J) ? {
|
|
32
|
+
...X,
|
|
33
|
+
lang: "",
|
|
34
|
+
video: !0
|
|
35
|
+
} : r(q, J) ? {
|
|
36
|
+
...X,
|
|
37
|
+
lang: "",
|
|
38
|
+
appx: !0
|
|
39
|
+
} : D(q, J) ? {
|
|
40
|
+
...X,
|
|
41
|
+
lang: "",
|
|
42
|
+
msi: !0
|
|
43
|
+
} : H(q, J) ? {
|
|
44
|
+
...X,
|
|
45
|
+
lang: "",
|
|
46
|
+
xmind: !0
|
|
47
|
+
} : U(q, J) ? {
|
|
48
|
+
...X,
|
|
49
|
+
lang: "",
|
|
50
|
+
zip: !0
|
|
51
|
+
} : P(q, J) ? {
|
|
52
|
+
...X,
|
|
53
|
+
lang: "",
|
|
54
|
+
sevenZip: !0
|
|
55
|
+
} : R(q, J) ? {
|
|
56
|
+
...X,
|
|
57
|
+
lang: "",
|
|
58
|
+
archive: "tar"
|
|
59
|
+
} : M(q, J) ? {
|
|
60
|
+
...X,
|
|
61
|
+
lang: "",
|
|
62
|
+
archive: "rar"
|
|
63
|
+
} : c(q, J) ? {
|
|
64
|
+
...X,
|
|
65
|
+
lang: "",
|
|
66
|
+
dicom: !0
|
|
67
|
+
} : a(q, J) ? {
|
|
68
|
+
...X,
|
|
69
|
+
lang: "",
|
|
70
|
+
binobj: !0
|
|
71
|
+
} : f(q, J) ? {
|
|
72
|
+
...X,
|
|
73
|
+
lang: "",
|
|
74
|
+
epl: !0
|
|
75
|
+
} : y(q, J) ? {
|
|
76
|
+
...X,
|
|
77
|
+
lang: "",
|
|
78
|
+
javaClass: !0
|
|
79
|
+
} : g(q, J) ? {
|
|
80
|
+
...X,
|
|
81
|
+
lang: "",
|
|
82
|
+
hprof: !0
|
|
83
|
+
} : l(q, J) ? {
|
|
84
|
+
...X,
|
|
85
|
+
lang: "",
|
|
86
|
+
docx: !0
|
|
87
|
+
} : V(q, J) ? {
|
|
88
|
+
...X,
|
|
89
|
+
lang: "",
|
|
90
|
+
xlsx: !0
|
|
91
|
+
} : A(q, J) ? {
|
|
92
|
+
...X,
|
|
93
|
+
lang: "",
|
|
94
|
+
pptx: !0
|
|
95
|
+
} : N(q, J) ? {
|
|
96
|
+
...X,
|
|
97
|
+
lang: "",
|
|
98
|
+
rtf: !0
|
|
99
|
+
} : k(q, J) ? {
|
|
100
|
+
...X,
|
|
101
|
+
lang: "",
|
|
102
|
+
pdf: !0
|
|
103
|
+
} : T(q, J) ? {
|
|
104
|
+
...X,
|
|
105
|
+
lang: n(q, J),
|
|
106
|
+
mindmap: !0
|
|
107
|
+
} : u(q, J) ? {
|
|
108
|
+
...X,
|
|
109
|
+
lang: "",
|
|
110
|
+
dxf: !0
|
|
111
|
+
} : w(q, J) ? {
|
|
112
|
+
...X,
|
|
113
|
+
lang: "",
|
|
114
|
+
mht: !0
|
|
115
|
+
} : d(q, J) ? {
|
|
116
|
+
...X,
|
|
117
|
+
lang: "",
|
|
118
|
+
eml: !0
|
|
119
|
+
} : h(q, J) ? {
|
|
120
|
+
...X,
|
|
121
|
+
lang: "",
|
|
122
|
+
har: !0
|
|
123
|
+
} : F(q, J) ? {
|
|
124
|
+
...X,
|
|
125
|
+
lang: "",
|
|
126
|
+
sqlite: !0
|
|
127
|
+
} : I(q, J) ? {
|
|
128
|
+
...X,
|
|
129
|
+
lang: "",
|
|
130
|
+
subtitle: !0
|
|
131
|
+
} : m(q, J) ? {
|
|
132
|
+
...X,
|
|
133
|
+
lang: n(q, J),
|
|
134
|
+
geo: !0
|
|
135
|
+
} : j(q, J) ? {
|
|
136
|
+
...X,
|
|
137
|
+
lang: "",
|
|
138
|
+
qmc: !0
|
|
139
|
+
} : C(q, J) ? {
|
|
140
|
+
...X,
|
|
141
|
+
lang: "",
|
|
142
|
+
lrc: !0
|
|
143
|
+
} : i(q, J) ? {
|
|
144
|
+
...X,
|
|
145
|
+
lang: "",
|
|
146
|
+
audio: !0
|
|
147
|
+
} : S(q, J, Y) ? {
|
|
148
|
+
...X,
|
|
149
|
+
lang: "",
|
|
150
|
+
log: !0
|
|
151
|
+
} : s(q, J) ? {
|
|
152
|
+
...X,
|
|
153
|
+
lang: "",
|
|
154
|
+
csv: !0
|
|
155
|
+
} : x(q, J) ? {
|
|
156
|
+
...X,
|
|
157
|
+
lang: "json",
|
|
158
|
+
jsonl: !0
|
|
159
|
+
} : E(q, J) ? {
|
|
160
|
+
...X,
|
|
161
|
+
lang: "",
|
|
162
|
+
model: !0
|
|
163
|
+
} : p(q, J) ? {
|
|
164
|
+
...X,
|
|
165
|
+
lang: "",
|
|
166
|
+
font: !0
|
|
167
|
+
} : O(q, J) ? {
|
|
168
|
+
...X,
|
|
169
|
+
lang: "",
|
|
170
|
+
ipynb: !0
|
|
171
|
+
} : b(q, J) ? {
|
|
172
|
+
...X,
|
|
173
|
+
lang: "",
|
|
174
|
+
jks: !0
|
|
175
|
+
} : o(q, J) ? {
|
|
176
|
+
...X,
|
|
177
|
+
lang: "",
|
|
178
|
+
cert: !0
|
|
179
|
+
} : L(q, J) ? {
|
|
180
|
+
...X,
|
|
181
|
+
lang: n(q, J),
|
|
182
|
+
svg: !0
|
|
183
|
+
} : _(q, J) ? {
|
|
184
|
+
...X,
|
|
185
|
+
lang: n(q, J),
|
|
186
|
+
html: !0
|
|
187
|
+
} : z(q, J) || t.textHint ? {
|
|
188
|
+
...X,
|
|
189
|
+
lang: n(q, J)
|
|
190
|
+
} : {
|
|
191
|
+
...X,
|
|
192
|
+
lang: "",
|
|
193
|
+
binary: !0
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
var J = {
|
|
197
|
+
png: "image/png",
|
|
198
|
+
jpg: "image/jpeg",
|
|
199
|
+
jpeg: "image/jpeg",
|
|
200
|
+
jfif: "image/jpeg",
|
|
201
|
+
gif: "image/gif",
|
|
202
|
+
webp: "image/webp",
|
|
203
|
+
bmp: "image/bmp",
|
|
204
|
+
ico: "image/x-icon",
|
|
205
|
+
avif: "image/avif",
|
|
206
|
+
apng: "image/apng",
|
|
207
|
+
svg: "image/svg+xml",
|
|
208
|
+
mp4: "video/mp4",
|
|
209
|
+
m4v: "video/mp4",
|
|
210
|
+
webm: "video/webm",
|
|
211
|
+
ogv: "video/ogg",
|
|
212
|
+
mov: "video/quicktime",
|
|
213
|
+
mkv: "video/x-matroska",
|
|
214
|
+
mp3: "audio/mpeg",
|
|
215
|
+
wav: "audio/wav",
|
|
216
|
+
flac: "audio/flac",
|
|
217
|
+
ogg: "audio/ogg",
|
|
218
|
+
oga: "audio/ogg",
|
|
219
|
+
m4a: "audio/mp4",
|
|
220
|
+
aac: "audio/aac",
|
|
221
|
+
opus: "audio/opus"
|
|
222
|
+
};
|
|
223
|
+
function Y(e) {
|
|
224
|
+
return J[t(e)] ?? "";
|
|
225
|
+
}
|
|
226
|
+
function X(e) {
|
|
227
|
+
return e ? !!(e.zip || e.sevenZip || e.xmind || e.dxf || e.archive || e.binobj || e.epl || e.javaClass || e.hprof || e.msi || e.appx || e.dicom || e.docx || e.xlsx || e.pptx || e.rtf || e.pdf || e.eml || e.mht || e.har || e.sqlite || e.cert || e.jks || e.font || e.ipynb || e.audio || e.qmc || e.lrc || e.log || e.model || e.raster || e.ebook || e.image || e.video || e.binary || e.hex) : !1;
|
|
228
|
+
}
|
|
229
|
+
function Z(e, n) {
|
|
230
|
+
return e ? e.lang === "markdown" || e.html === !0 || e.svg === !0 || e.subtitle === !0 || e.geo === !0 || e.csv === !0 || e.jsonl === !0 || e.diagram != null ? !0 : e.mindmap === !0 ? K(n, t(e.name)) : !1 : !1;
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
export { Z as canToggleView, q as classifyViewerFile, Y as mediaMimeForName, X as skipsTextLoad };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-dependency X.509 / PKCS#10 reading on top of the ASN.1 decoder (lib/asn1.ts), for the certificate
|
|
3
|
+
* viewer (CertViewer.vue). It extracts the human-meaningful fields — subject / issuer, validity, serial,
|
|
4
|
+
* signature + public-key algorithm, SANs, key usages, CA flag — from a DER certificate or CSR, and splits a
|
|
5
|
+
* PEM file into its blocks. This is a READ-ONLY visualizer: it does NOT verify signatures or trust chains, so
|
|
6
|
+
* a malformed or untrusted file is shown, not rejected. Anything it can't map to a friendly field still shows
|
|
7
|
+
* in the raw ASN.1 structure tree the viewer renders alongside.
|
|
8
|
+
*/
|
|
9
|
+
export declare function oidName(oid: string): string;
|
|
10
|
+
export interface RDN {
|
|
11
|
+
oid: string;
|
|
12
|
+
name: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
export type CertKind = 'certificate' | 'request' | 'key' | 'crl' | 'pkcs12' | 'pkcs7' | 'unknown';
|
|
16
|
+
export interface CertSummary {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
kind: CertKind;
|
|
19
|
+
label: string;
|
|
20
|
+
subject: RDN[];
|
|
21
|
+
issuer: RDN[];
|
|
22
|
+
subjectCN?: string;
|
|
23
|
+
issuerCN?: string;
|
|
24
|
+
serialHex?: string;
|
|
25
|
+
version?: number;
|
|
26
|
+
sigAlg?: string;
|
|
27
|
+
pubKeyAlg?: string;
|
|
28
|
+
pubKeyBits?: number;
|
|
29
|
+
pubKeyCurve?: string;
|
|
30
|
+
notBefore?: string;
|
|
31
|
+
notAfter?: string;
|
|
32
|
+
notBeforeMs?: number;
|
|
33
|
+
notAfterMs?: number;
|
|
34
|
+
sans: string[];
|
|
35
|
+
keyUsages: string[];
|
|
36
|
+
extKeyUsages: string[];
|
|
37
|
+
isCa?: boolean;
|
|
38
|
+
pathLen?: number;
|
|
39
|
+
der: Uint8Array;
|
|
40
|
+
fingerprintSha256?: string;
|
|
41
|
+
note?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface PemBlock {
|
|
44
|
+
label: string;
|
|
45
|
+
der: Uint8Array;
|
|
46
|
+
}
|
|
47
|
+
/** Split a PEM document into its `-----BEGIN X-----`…`-----END X-----` blocks (base64 → DER bytes). */
|
|
48
|
+
export declare function parsePemBlocks(text: string): PemBlock[];
|
|
49
|
+
/** Does this text look like a PEM document (has at least one BEGIN marker)? */
|
|
50
|
+
export declare function looksLikePem(text: string): boolean;
|
|
51
|
+
/** Parse a DER X.509 Certificate into its friendly fields (best effort; `ok=false` + `note` on failure). */
|
|
52
|
+
export declare function parseCertificate(der: Uint8Array, label?: string): CertSummary;
|
|
53
|
+
/** Parse a DER PKCS#10 CertificationRequest (CSR): subject + public key (best effort). */
|
|
54
|
+
export declare function parseCsr(der: Uint8Array, label?: string): CertSummary;
|
|
55
|
+
/** Pick a parser from a PEM block label (CERTIFICATE / CERTIFICATE REQUEST / *KEY* / *CRL* / fallback). */
|
|
56
|
+
export declare function summarizeBlock(label: string, der: Uint8Array): CertSummary;
|
|
57
|
+
/**
|
|
58
|
+
* Best-effort algorithm / size read from a DER PKCS#8 PrivateKeyInfo (never throws) — shared by the keystore
|
|
59
|
+
* viewers (lib/jks.ts, lib/pkcs12.ts) to label a decrypted private key. Returns the friendly algorithm name
|
|
60
|
+
* plus, for RSA, the modulus bit-length, and for EC, the named curve (+ its bit size when the name encodes it).
|
|
61
|
+
*/
|
|
62
|
+
export declare function describePrivateKey(pkcs8: Uint8Array): {
|
|
63
|
+
algorithm: string;
|
|
64
|
+
bits?: number;
|
|
65
|
+
curve?: string;
|
|
66
|
+
};
|
|
67
|
+
/** SHA-256 fingerprint of DER bytes, as colon-separated hex (e.g. `AB:CD:…`). */
|
|
68
|
+
export declare function sha256Hex(der: Uint8Array): Promise<string>;
|
package/dist/lib/x509.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { TAG as e, asn1String as t, asn1Time as n, bytesToHex as r, decodeAsn1 as i, oidToString as a } from "./asn1.js";
|
|
2
|
+
//#region src/lib/x509.ts
|
|
3
|
+
var o = {
|
|
4
|
+
"2.5.4.3": "CN",
|
|
5
|
+
"2.5.4.4": "SN",
|
|
6
|
+
"2.5.4.5": "serialNumber",
|
|
7
|
+
"2.5.4.6": "C",
|
|
8
|
+
"2.5.4.7": "L",
|
|
9
|
+
"2.5.4.8": "ST",
|
|
10
|
+
"2.5.4.9": "street",
|
|
11
|
+
"2.5.4.10": "O",
|
|
12
|
+
"2.5.4.11": "OU",
|
|
13
|
+
"2.5.4.12": "title",
|
|
14
|
+
"2.5.4.42": "GN",
|
|
15
|
+
"2.5.4.43": "initials",
|
|
16
|
+
"1.2.840.113549.1.9.1": "E",
|
|
17
|
+
"0.9.2342.19200300.100.1.25": "DC",
|
|
18
|
+
"0.9.2342.19200300.100.1.1": "UID",
|
|
19
|
+
"1.2.840.113549.1.1.1": "RSA",
|
|
20
|
+
"1.2.840.113549.1.1.5": "sha1WithRSA",
|
|
21
|
+
"1.2.840.113549.1.1.11": "sha256WithRSA",
|
|
22
|
+
"1.2.840.113549.1.1.12": "sha384WithRSA",
|
|
23
|
+
"1.2.840.113549.1.1.13": "sha512WithRSA",
|
|
24
|
+
"1.2.840.113549.1.1.10": "RSASSA-PSS",
|
|
25
|
+
"1.2.840.10045.2.1": "EC",
|
|
26
|
+
"1.2.840.10045.4.3.2": "ecdsa-with-SHA256",
|
|
27
|
+
"1.2.840.10045.4.3.3": "ecdsa-with-SHA384",
|
|
28
|
+
"1.2.840.10045.4.3.4": "ecdsa-with-SHA512",
|
|
29
|
+
"1.3.101.112": "Ed25519",
|
|
30
|
+
"1.3.101.113": "Ed448",
|
|
31
|
+
"1.2.840.10045.3.1.7": "P-256 (secp256r1)",
|
|
32
|
+
"1.3.132.0.34": "P-384 (secp384r1)",
|
|
33
|
+
"1.3.132.0.35": "P-521 (secp521r1)",
|
|
34
|
+
"1.3.132.0.10": "secp256k1",
|
|
35
|
+
"2.5.29.14": "subjectKeyIdentifier",
|
|
36
|
+
"2.5.29.15": "keyUsage",
|
|
37
|
+
"2.5.29.17": "subjectAltName",
|
|
38
|
+
"2.5.29.19": "basicConstraints",
|
|
39
|
+
"2.5.29.31": "cRLDistributionPoints",
|
|
40
|
+
"2.5.29.32": "certificatePolicies",
|
|
41
|
+
"2.5.29.35": "authorityKeyIdentifier",
|
|
42
|
+
"2.5.29.37": "extKeyUsage",
|
|
43
|
+
"1.3.6.1.5.5.7.1.1": "authorityInfoAccess",
|
|
44
|
+
"1.3.6.1.5.5.7.3.1": "serverAuth",
|
|
45
|
+
"1.3.6.1.5.5.7.3.2": "clientAuth",
|
|
46
|
+
"1.3.6.1.5.5.7.3.3": "codeSigning",
|
|
47
|
+
"1.3.6.1.5.5.7.3.4": "emailProtection",
|
|
48
|
+
"1.3.6.1.5.5.7.3.8": "timeStamping"
|
|
49
|
+
};
|
|
50
|
+
function s(e) {
|
|
51
|
+
return o[e] ?? e;
|
|
52
|
+
}
|
|
53
|
+
function c(e) {
|
|
54
|
+
let t = atob(e), n = new Uint8Array(t.length);
|
|
55
|
+
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
56
|
+
return n;
|
|
57
|
+
}
|
|
58
|
+
function l(e) {
|
|
59
|
+
let t = [], n = /-----BEGIN ([^-]+)-----([\s\S]*?)-----END \1-----/g, r;
|
|
60
|
+
for (; (r = n.exec(e)) !== null;) {
|
|
61
|
+
let e = r[2].replace(/[^A-Za-z0-9+/=]/g, "");
|
|
62
|
+
if (e) try {
|
|
63
|
+
t.push({
|
|
64
|
+
label: r[1].trim(),
|
|
65
|
+
der: c(e)
|
|
66
|
+
});
|
|
67
|
+
} catch {}
|
|
68
|
+
}
|
|
69
|
+
return t;
|
|
70
|
+
}
|
|
71
|
+
function u(e) {
|
|
72
|
+
return /-----BEGIN [^-]+-----/.test(e);
|
|
73
|
+
}
|
|
74
|
+
function d(e, t, n) {
|
|
75
|
+
return {
|
|
76
|
+
ok: !1,
|
|
77
|
+
kind: t,
|
|
78
|
+
label: e,
|
|
79
|
+
subject: [],
|
|
80
|
+
issuer: [],
|
|
81
|
+
sans: [],
|
|
82
|
+
keyUsages: [],
|
|
83
|
+
extKeyUsages: [],
|
|
84
|
+
der: n
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function f(e) {
|
|
88
|
+
let t = 0;
|
|
89
|
+
for (let n of e.content) t = t * 256 + n;
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
function p(e) {
|
|
93
|
+
return e.length > 1 && e[0] === 0 ? e.subarray(1) : e;
|
|
94
|
+
}
|
|
95
|
+
function m(e) {
|
|
96
|
+
return e.find((e) => e.name === "CN")?.value;
|
|
97
|
+
}
|
|
98
|
+
function h(e) {
|
|
99
|
+
let t = e?.children[0];
|
|
100
|
+
return t ? s(a(t.content)) : "";
|
|
101
|
+
}
|
|
102
|
+
function g(e) {
|
|
103
|
+
let n = [];
|
|
104
|
+
if (!e) return n;
|
|
105
|
+
for (let r of e.children) for (let e of r.children) {
|
|
106
|
+
let r = e.children[0], i = e.children[1];
|
|
107
|
+
if (!r || !i) continue;
|
|
108
|
+
let o = a(r.content);
|
|
109
|
+
n.push({
|
|
110
|
+
oid: o,
|
|
111
|
+
name: s(o),
|
|
112
|
+
value: t(i)
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return n;
|
|
116
|
+
}
|
|
117
|
+
function _(e, t) {
|
|
118
|
+
let n = t?.children[0], r = t?.children[1], o = n?.children[0];
|
|
119
|
+
if (!o) return;
|
|
120
|
+
let c = a(o.content);
|
|
121
|
+
if (e.pubKeyAlg = s(c), c === "1.2.840.113549.1.1.1" && r) {
|
|
122
|
+
let t = i(r.content.subarray(1))[0]?.children[0];
|
|
123
|
+
t && (e.pubKeyBits = p(t.content).length * 8);
|
|
124
|
+
} else if (c === "1.2.840.10045.2.1") {
|
|
125
|
+
let t = n?.children[1];
|
|
126
|
+
if (t) {
|
|
127
|
+
e.pubKeyCurve = s(a(t.content));
|
|
128
|
+
let n = e.pubKeyCurve.match(/(\d{3})/);
|
|
129
|
+
n && (e.pubKeyBits = parseInt(n[1], 10));
|
|
130
|
+
}
|
|
131
|
+
} else c === "1.3.101.112" && (e.pubKeyBits = 256);
|
|
132
|
+
}
|
|
133
|
+
var v = [
|
|
134
|
+
"digitalSignature",
|
|
135
|
+
"nonRepudiation",
|
|
136
|
+
"keyEncipherment",
|
|
137
|
+
"dataEncipherment",
|
|
138
|
+
"keyAgreement",
|
|
139
|
+
"keyCertSign",
|
|
140
|
+
"cRLSign",
|
|
141
|
+
"encipherOnly",
|
|
142
|
+
"decipherOnly"
|
|
143
|
+
];
|
|
144
|
+
function y(e) {
|
|
145
|
+
let t = e.content;
|
|
146
|
+
if (t.length < 2) return [];
|
|
147
|
+
let n = t.subarray(1), r = n.length * 8 - t[0], i = [];
|
|
148
|
+
for (let e = 0; e < r && e < v.length; e++) n[Math.floor(e / 8)] & 128 >> e % 8 && i.push(v[e]);
|
|
149
|
+
return i;
|
|
150
|
+
}
|
|
151
|
+
function b(e) {
|
|
152
|
+
if (e.length === 4) return Array.from(e).join(".");
|
|
153
|
+
if (e.length === 16) {
|
|
154
|
+
let t = [];
|
|
155
|
+
for (let n = 0; n < 16; n += 2) t.push((e[n] << 8 | e[n + 1]).toString(16));
|
|
156
|
+
return t.join(":");
|
|
157
|
+
}
|
|
158
|
+
return r(e);
|
|
159
|
+
}
|
|
160
|
+
function x(e) {
|
|
161
|
+
let t = [];
|
|
162
|
+
for (let n of e.children) {
|
|
163
|
+
if (n.tagClass !== 2) continue;
|
|
164
|
+
let e = new TextDecoder("latin1").decode(n.content);
|
|
165
|
+
n.tagNumber === 2 ? t.push(`DNS:${e}`) : n.tagNumber === 1 ? t.push(`email:${e}`) : n.tagNumber === 6 ? t.push(`URI:${e}`) : n.tagNumber === 7 && t.push(`IP:${b(n.content)}`);
|
|
166
|
+
}
|
|
167
|
+
return t;
|
|
168
|
+
}
|
|
169
|
+
function S(t, n) {
|
|
170
|
+
for (let r of n.children) {
|
|
171
|
+
let n = r.children[0];
|
|
172
|
+
if (!n) continue;
|
|
173
|
+
let o = a(n.content), c = r.children[r.children.length - 1], l = c ? i(c.content)[0] : void 0;
|
|
174
|
+
if (l) if (o === "2.5.29.17") t.sans = x(l);
|
|
175
|
+
else if (o === "2.5.29.19") {
|
|
176
|
+
let n = l.children.find((t) => t.tagNumber === e.BOOLEAN);
|
|
177
|
+
t.isCa = n ? n.content[0] !== 0 : !1;
|
|
178
|
+
let r = l.children.find((t) => t.tagNumber === e.INTEGER);
|
|
179
|
+
r && (t.pathLen = f(r));
|
|
180
|
+
} else if (o === "2.5.29.37") for (let e of l.children) t.extKeyUsages.push(s(a(e.content)));
|
|
181
|
+
else o === "2.5.29.15" && (t.keyUsages = y(l));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function C(t, a = "CERTIFICATE") {
|
|
185
|
+
let o = d(a, "certificate", t);
|
|
186
|
+
try {
|
|
187
|
+
let a = i(t)[0], s = a?.children[0];
|
|
188
|
+
if (!a || a.tagNumber !== e.SEQUENCE || !s) return o.note = "不是有效的 X.509 证书结构", o;
|
|
189
|
+
let c = s.children, l = 0;
|
|
190
|
+
if (c[l] && c[l].tagClass === 2 && c[l].tagNumber === 0) {
|
|
191
|
+
let e = c[l].children[0];
|
|
192
|
+
o.version = e ? f(e) + 1 : 1, l++;
|
|
193
|
+
} else o.version = 1;
|
|
194
|
+
if (c[l] && (o.serialHex = r(p(c[l++].content), ":")), c[l] && (o.sigAlg = h(c[l++])), c[l] && (o.issuer = g(c[l++])), c[l]) {
|
|
195
|
+
let e = c[l].children[0] && n(c[l].children[0]), t = c[l].children[1] && n(c[l].children[1]);
|
|
196
|
+
e && (o.notBefore = e.text, o.notBeforeMs = e.ms), t && (o.notAfter = t.text, o.notAfterMs = t.ms), l++;
|
|
197
|
+
}
|
|
198
|
+
c[l] && (o.subject = g(c[l++])), c[l] && _(o, c[l++]);
|
|
199
|
+
let u = c.find((e) => e.tagClass === 2 && e.tagNumber === 3);
|
|
200
|
+
u && u.children[0] && S(o, u.children[0]), o.subjectCN = m(o.subject), o.issuerCN = m(o.issuer), o.ok = !0;
|
|
201
|
+
} catch (e) {
|
|
202
|
+
o.note = e instanceof Error ? e.message : String(e);
|
|
203
|
+
}
|
|
204
|
+
return o;
|
|
205
|
+
}
|
|
206
|
+
function w(e, t = "CERTIFICATE REQUEST") {
|
|
207
|
+
let n = d(t, "request", e);
|
|
208
|
+
try {
|
|
209
|
+
let t = i(e)[0]?.children[0];
|
|
210
|
+
if (!t) return n.note = "不是有效的 PKCS#10 请求结构", n;
|
|
211
|
+
n.subject = g(t.children[1]), _(n, t.children[2]), n.subjectCN = m(n.subject), n.ok = !0;
|
|
212
|
+
} catch (e) {
|
|
213
|
+
n.note = e instanceof Error ? e.message : String(e);
|
|
214
|
+
}
|
|
215
|
+
return n;
|
|
216
|
+
}
|
|
217
|
+
function T(t, n) {
|
|
218
|
+
let r = t.toUpperCase();
|
|
219
|
+
if (r.includes("CERTIFICATE REQUEST")) return w(n, t);
|
|
220
|
+
if (r.includes("CERTIFICATE")) return C(n, t);
|
|
221
|
+
if (r.includes("CRL")) {
|
|
222
|
+
let e = d(t, "crl", n);
|
|
223
|
+
return e.ok = !0, e.note = "X.509 证书吊销列表(CRL)—— 展开下方结构树查看条目。", e;
|
|
224
|
+
}
|
|
225
|
+
if (r.includes("KEY")) {
|
|
226
|
+
let a = d(t, "key", n);
|
|
227
|
+
a.ok = !0;
|
|
228
|
+
try {
|
|
229
|
+
let t = i(n)[0]?.children.find((t) => t.tagNumber === e.SEQUENCE);
|
|
230
|
+
E(a, t);
|
|
231
|
+
} catch {}
|
|
232
|
+
return a.note = r.includes("PUBLIC") ? "公钥文件 —— 仅展示算法与结构,不含私密材料。" : "私钥文件 —— 仅展示算法与结构,密钥材料请勿外泄。", a;
|
|
233
|
+
}
|
|
234
|
+
let a = C(n, t);
|
|
235
|
+
if (a.ok) return a;
|
|
236
|
+
let o = d(t, "unknown", n);
|
|
237
|
+
return o.ok = !0, o;
|
|
238
|
+
}
|
|
239
|
+
function E(t, n) {
|
|
240
|
+
let r = n?.children[0];
|
|
241
|
+
r && r.tagNumber === e.OID && (t.pubKeyAlg = s(a(r.content)));
|
|
242
|
+
}
|
|
243
|
+
function D(t) {
|
|
244
|
+
try {
|
|
245
|
+
let n = i(t)[0], r = n?.children[1], o = r?.children[0], c = o ? a(o.content) : "", l = { algorithm: c ? s(c) : "未知" };
|
|
246
|
+
if (c === "1.2.840.113549.1.1.1") {
|
|
247
|
+
let e = n?.children[2], t = (e ? i(e.content)[0] : void 0)?.children[1];
|
|
248
|
+
t && (l.bits = p(t.content).length * 8);
|
|
249
|
+
} else if (c === "1.2.840.10045.2.1") {
|
|
250
|
+
let t = r?.children[1];
|
|
251
|
+
if (t && t.tagNumber === e.OID) {
|
|
252
|
+
l.curve = s(a(t.content));
|
|
253
|
+
let e = l.curve.match(/(\d{3})/);
|
|
254
|
+
e && (l.bits = parseInt(e[1], 10));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return l;
|
|
258
|
+
} catch {
|
|
259
|
+
return { algorithm: "未知" };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
async function O(e) {
|
|
263
|
+
let t = e.slice(), n = await crypto.subtle.digest("SHA-256", t);
|
|
264
|
+
return r(new Uint8Array(n), ":").toUpperCase();
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
export { D as describePrivateKey, u as looksLikePem, s as oidName, C as parseCertificate, w as parseCsr, l as parsePemBlocks, O as sha256Hex, T as summarizeBlock };
|