@file-viewer/renderer-signature 3.0.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.
Files changed (45) hide show
  1. package/LICENSE +160 -0
  2. package/README.en.md +87 -0
  3. package/README.md +89 -0
  4. package/THIRD_PARTY_LICENSES.json +3867 -0
  5. package/THIRD_PARTY_NOTICES.md +10 -0
  6. package/dist/container.worker.d.ts +1 -0
  7. package/dist/container.worker.js +39 -0
  8. package/dist/index.d.ts +11 -0
  9. package/dist/index.js +53 -0
  10. package/dist/inspect.d.ts +7 -0
  11. package/dist/inspect.js +4 -0
  12. package/dist/openpgp/client.d.ts +16 -0
  13. package/dist/openpgp/client.js +148 -0
  14. package/dist/openpgp/formatDetection.d.ts +3 -0
  15. package/dist/openpgp/formatDetection.js +45 -0
  16. package/dist/openpgp/types.d.ts +72 -0
  17. package/dist/openpgp/types.js +1 -0
  18. package/dist/rpgp-wasm/rpgp_wrapper.d.ts +43 -0
  19. package/dist/rpgp-wasm/rpgp_wrapper.js +578 -0
  20. package/dist/rpgp-wasm/rpgp_wrapper_bg.wasm +0 -0
  21. package/dist/rpgp-wasm/rpgp_wrapper_bg.wasm.d.ts +10 -0
  22. package/dist/signature.d.ts +24 -0
  23. package/dist/signature.js +1040 -0
  24. package/dist/signature.worker.d.ts +1 -0
  25. package/dist/signature.worker.js +108 -0
  26. package/dist/signatureAsn1.d.ts +150 -0
  27. package/dist/signatureAsn1.js +1486 -0
  28. package/dist/structured/asic.d.ts +3 -0
  29. package/dist/structured/asic.js +188 -0
  30. package/dist/structured/containerClient.d.ts +12 -0
  31. package/dist/structured/containerClient.js +71 -0
  32. package/dist/structured/containerProtocol.d.ts +20 -0
  33. package/dist/structured/containerProtocol.js +1 -0
  34. package/dist/structured/jws.d.ts +3 -0
  35. package/dist/structured/jws.js +382 -0
  36. package/dist/structured/limits.d.ts +20 -0
  37. package/dist/structured/limits.js +41 -0
  38. package/dist/structured/types.d.ts +53 -0
  39. package/dist/structured/types.js +1 -0
  40. package/dist/structured/zipPreflight.d.ts +14 -0
  41. package/dist/structured/zipPreflight.js +173 -0
  42. package/dist/workerProtocol.d.ts +40 -0
  43. package/dist/workerProtocol.js +1 -0
  44. package/file-viewer.capability.json +56 -0
  45. package/package.json +106 -0
@@ -0,0 +1,10 @@
1
+ # Third-party notices
2
+
3
+ `@file-viewer/renderer-signature` contains two optional third-party runtime closures:
4
+
5
+ - rPGP / Rust crate `pgp` 0.20.0 and its locked Cargo dependencies, compiled to WebAssembly. rPGP is MIT OR Apache-2.0; this distribution selects permissive license branches only.
6
+ - JSZip 3.10.1 and its npm runtime dependencies for bounded ASiC extraction after the package's own central-directory preflight. JSZip declares MIT OR GPL-3.0-or-later; this distribution uses it under the MIT option.
7
+
8
+ `THIRD_PARTY_LICENSES.json` records every exact Cargo and npm dependency version, declared expression, selected permissive branch, source/repository metadata, and deduplicated license text. The verification gate rejects a closure that has no permissive choice.
9
+
10
+ No LGPL, AGPL, or GPL-only runtime source is used. OpenPGP.js and GnuPG are not bundled or invoked.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ /// <reference lib="webworker" />
2
+ import { inspectAsicContainer } from './structured/asic.js';
3
+ import { normalizeSignatureContainerLimits } from './structured/limits.js';
4
+ const scope = self;
5
+ const errorResponse = (id, error) => ({
6
+ id,
7
+ ok: false,
8
+ error: {
9
+ code: error instanceof Error &&
10
+ /unsafe|limit|exceed|zip|path|entry|crc|compression/iu.test(error.message)
11
+ ? 'unsafe-archive'
12
+ : error instanceof Error
13
+ ? 'invalid-input'
14
+ : 'internal-parser-error',
15
+ message: error instanceof Error ? error.message : String(error)
16
+ }
17
+ });
18
+ scope.addEventListener('message', async (event) => {
19
+ const request = event.data;
20
+ if (!request ||
21
+ typeof request.id !== 'string' ||
22
+ request.type !== 'inspect-asic' ||
23
+ !(request.input instanceof ArrayBuffer)) {
24
+ scope.postMessage(errorResponse(typeof (request === null || request === void 0 ? void 0 : request.id) === 'string' ? request.id : 'unknown', new Error('Invalid ASiC Worker request.')));
25
+ return;
26
+ }
27
+ try {
28
+ const result = await inspectAsicContainer(request.input, normalizeSignatureContainerLimits(request.limits));
29
+ const transfers = [];
30
+ for (const member of [...result.documents, ...result.signatures]) {
31
+ if (member.data)
32
+ transfers.push(member.data.buffer);
33
+ }
34
+ scope.postMessage({ id: request.id, ok: true, result }, transfers);
35
+ }
36
+ catch (error) {
37
+ scope.postMessage(errorResponse(request.id, error));
38
+ }
39
+ });
@@ -0,0 +1,11 @@
1
+ import type { FileRenderHandler, FileViewerRenderedInstance, FileViewerRendererPlugin, RendererDefinition } from '@file-viewer/core';
2
+ export declare const signatureRendererDefinition: RendererDefinition;
3
+ export declare const renderFileViewerSignature: FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>;
4
+ export declare const signatureRenderer: FileViewerRendererPlugin<FileRenderHandler<FileViewerRenderedInstance, HTMLDivElement>>;
5
+ export { inspectSignatureContainer, inspectEvidenceRecord, DEFAULT_SIGNATURE_ASN1_LIMITS, signatureOidLabels, type InspectSignatureOptions, type SignatureAsn1Limits, type SignatureCertificateSummary, type SignatureContainerKind, type SignatureInspection, type SignatureSignerSummary, type TimestampInfoSummary, type TimestampResponseSummary } from './signatureAsn1.js';
6
+ export { inspectAsicContainer, inspectJws, isProbablyJws, DEFAULT_SIGNATURE_CONTAINER_LIMITS, normalizeSignatureContainerLimits } from './inspect.js';
7
+ export type { FileViewerSignatureOptions } from './signature.js';
8
+ export default signatureRenderer;
9
+ export { OpenPgpWorkerClient, DEFAULT_SIGNATURE_PARSE_LIMITS, normalizeSignatureParseLimits } from './openpgp/client.js';
10
+ export { isProbablyOpenPgp, detectOpenPgpArmorType } from './openpgp/formatDetection.js';
11
+ export type { SignatureParseLimits, OpenPgpInspectionResult, OpenPgpVerificationResult, OpenPgpKeySummary, OpenPgpSignatureSummary, ExtractedLiteralData } from './openpgp/types.js';
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ export const signatureRendererDefinition = {
2
+ id: 'signature',
3
+ label: 'Digital signature, timestamp and evidence container',
4
+ category: 'document',
5
+ extensions: [
6
+ 'p7m',
7
+ 'p7s',
8
+ 'p7b',
9
+ 'p7c',
10
+ 'pkcs7',
11
+ 'cms',
12
+ 'cmsc',
13
+ 'tsq',
14
+ 'tsr',
15
+ 'tst',
16
+ 'tsd',
17
+ 'asics',
18
+ 'scs',
19
+ 'asice',
20
+ 'sce',
21
+ 'ers',
22
+ 'asc',
23
+ 'sig',
24
+ 'pgp',
25
+ 'gpg',
26
+ 'jws'
27
+ ],
28
+ async: true,
29
+ supportLevel: 'experimental',
30
+ status: 'experimental',
31
+ packageName: '@file-viewer/renderer-signature',
32
+ presets: [],
33
+ knownLimits: [
34
+ 'Supports bounded CMS/PKCS#7, selected CAdES attributes, RFC 3161, RFC 5544, ASiC, RFC 4998, JWS and OpenPGP inspection.',
35
+ 'Certificate trust, policy compliance, qualified status, and legal validity are not established.',
36
+ 'ASiC XML signature references and RFC 4998 renewal chains are structurally inspected; full XAdES and archival-policy validation are not claimed.',
37
+ 'OpenPGP inspection plus detached, cleartext and embedded signature verification use a lazy rPGP WebAssembly Worker; private-key operations and automatic decryption are intentionally excluded.',
38
+ 'JAdES properties are reported as metadata only. PAdES, full XMLDSig/XAdES/JAdES validation, S/MIME and PGP/MIME remain outside this renderer because they require host integration with their existing document and message renderers.'
39
+ ],
40
+ capabilities: { download: true }
41
+ };
42
+ export const renderFileViewerSignature = (buffer, target, type, context) => import('./signature.js').then(({ default: renderSignature }) => renderSignature(buffer, target, type, context));
43
+ export const signatureRenderer = {
44
+ id: 'file-viewer-renderer-signature',
45
+ label: 'Flyfish File Viewer signature renderer',
46
+ definitions: [signatureRendererDefinition],
47
+ handlers: [{ rendererId: signatureRendererDefinition.id, handler: renderFileViewerSignature }]
48
+ };
49
+ export { inspectSignatureContainer, inspectEvidenceRecord, DEFAULT_SIGNATURE_ASN1_LIMITS, signatureOidLabels } from './signatureAsn1.js';
50
+ export { inspectAsicContainer, inspectJws, isProbablyJws, DEFAULT_SIGNATURE_CONTAINER_LIMITS, normalizeSignatureContainerLimits } from './inspect.js';
51
+ export default signatureRenderer;
52
+ export { OpenPgpWorkerClient, DEFAULT_SIGNATURE_PARSE_LIMITS, normalizeSignatureParseLimits } from './openpgp/client.js';
53
+ export { isProbablyOpenPgp, detectOpenPgpArmorType } from './openpgp/formatDetection.js';
@@ -0,0 +1,7 @@
1
+ export { inspectAsicContainer } from './structured/asic.js';
2
+ export { inspectJws, isProbablyJws } from './structured/jws.js';
3
+ export { DEFAULT_SIGNATURE_ASN1_LIMITS, inspectEvidenceRecord, inspectSignatureContainer, signatureOidLabels } from './signatureAsn1.js';
4
+ export { DEFAULT_SIGNATURE_CONTAINER_LIMITS, normalizeSignatureContainerLimits } from './structured/limits.js';
5
+ export type { AsicArchiveMember, AsicInspection, AsicKind, AsicSignatureMember, InspectJwsOptions, JwsInspection, JwsSignatureInspection, JwsVerificationKey } from './structured/types.js';
6
+ export type { SignatureContainerLimits } from './structured/limits.js';
7
+ export type { EvidenceArchiveTimestampSummary, EvidenceRecordInspection, InspectEvidenceRecordOptions, InspectSignatureOptions, SignatureAsn1Limits, SignatureCertificateSummary, SignatureContainerKind, SignatureInspection, SignatureSignerSummary, TimestampInfoSummary, TimestampResponseSummary } from './signatureAsn1.js';
@@ -0,0 +1,4 @@
1
+ export { inspectAsicContainer } from './structured/asic.js';
2
+ export { inspectJws, isProbablyJws } from './structured/jws.js';
3
+ export { DEFAULT_SIGNATURE_ASN1_LIMITS, inspectEvidenceRecord, inspectSignatureContainer, signatureOidLabels } from './signatureAsn1.js';
4
+ export { DEFAULT_SIGNATURE_CONTAINER_LIMITS, normalizeSignatureContainerLimits } from './structured/limits.js';
@@ -0,0 +1,16 @@
1
+ import type { OpenPgpInspectionResult, OpenPgpVerificationResult, SignatureParseLimits } from './types.js';
2
+ export declare const DEFAULT_SIGNATURE_PARSE_LIMITS: SignatureParseLimits;
3
+ export declare const normalizeSignatureParseLimits: (limits?: Partial<SignatureParseLimits>) => SignatureParseLimits;
4
+ export declare class OpenPgpWorkerClient {
5
+ private readonly workerFactory?;
6
+ private worker?;
7
+ private readonly pending;
8
+ constructor(workerFactory?: (() => Worker) | undefined);
9
+ private ensureWorker;
10
+ private failWorker;
11
+ private request;
12
+ inspect(input: ArrayBuffer, limits?: Partial<SignatureParseLimits>, publicKeys?: ArrayBuffer[]): Promise<OpenPgpInspectionResult>;
13
+ classify(input: ArrayBuffer, limits?: Partial<SignatureParseLimits>): Promise<OpenPgpInspectionResult>;
14
+ verifyDetached(content: ArrayBuffer, signature: ArrayBuffer, publicKeys: ArrayBuffer[], limits?: Partial<SignatureParseLimits>): Promise<OpenPgpVerificationResult>;
15
+ dispose(): void;
16
+ }
@@ -0,0 +1,148 @@
1
+ export const DEFAULT_SIGNATURE_PARSE_LIMITS = {
2
+ maxInputBytes: 32 * 1024 * 1024,
3
+ maxOutputBytes: 16 * 1024 * 1024,
4
+ maxPacketCount: 4096,
5
+ maxNestingDepth: 16,
6
+ maxUserIds: 128,
7
+ maxSubkeys: 128,
8
+ maxSignatures: 256
9
+ };
10
+ const ABSOLUTE_SIGNATURE_PARSE_LIMITS = {
11
+ maxInputBytes: 64 * 1024 * 1024,
12
+ maxOutputBytes: 32 * 1024 * 1024,
13
+ maxPacketCount: 8192,
14
+ maxNestingDepth: 32,
15
+ maxUserIds: 256,
16
+ maxSubkeys: 256,
17
+ maxSignatures: 512
18
+ };
19
+ let nextRequestId = 0;
20
+ const boundedInteger = (value, fallback, ceiling) => typeof value === 'number' && Number.isSafeInteger(value) && value > 0
21
+ ? Math.min(value, ceiling)
22
+ : fallback;
23
+ export const normalizeSignatureParseLimits = (limits) => {
24
+ const result = Object.fromEntries(Object.entries(DEFAULT_SIGNATURE_PARSE_LIMITS).map(([key, fallback]) => [
25
+ key,
26
+ boundedInteger(limits === null || limits === void 0 ? void 0 : limits[key], fallback, ABSOLUTE_SIGNATURE_PARSE_LIMITS[key])
27
+ ]));
28
+ result.maxOutputBytes = Math.min(result.maxOutputBytes, result.maxInputBytes);
29
+ return result;
30
+ };
31
+ export class OpenPgpWorkerClient {
32
+ constructor(workerFactory) {
33
+ this.workerFactory = workerFactory;
34
+ this.pending = new Map();
35
+ }
36
+ ensureWorker() {
37
+ if (this.worker)
38
+ return this.worker;
39
+ if (typeof Worker === 'undefined') {
40
+ throw new Error('OpenPGP inspection requires Web Worker support.');
41
+ }
42
+ const worker = this.workerFactory
43
+ ? this.workerFactory()
44
+ : new Worker(new URL('../signature.worker.js', import.meta.url), {
45
+ type: 'module',
46
+ name: 'file-viewer-signature-openpgp'
47
+ });
48
+ worker.addEventListener('message', (event) => {
49
+ const pending = this.pending.get(event.data.id);
50
+ if (!pending)
51
+ return;
52
+ clearTimeout(pending.timer);
53
+ this.pending.delete(event.data.id);
54
+ if (event.data.ok)
55
+ pending.resolve(event.data.result);
56
+ else
57
+ pending.reject(Object.assign(new Error(event.data.error.message), { code: event.data.error.code }));
58
+ });
59
+ worker.addEventListener('error', (event) => {
60
+ this.failWorker(new Error(event.message || 'Signature Worker failed.'));
61
+ });
62
+ worker.addEventListener('messageerror', () => this.failWorker(new Error('Signature Worker returned an unreadable response.')));
63
+ this.worker = worker;
64
+ return worker;
65
+ }
66
+ failWorker(error) {
67
+ var _a;
68
+ (_a = this.worker) === null || _a === void 0 ? void 0 : _a.terminate();
69
+ this.worker = undefined;
70
+ for (const pending of this.pending.values()) {
71
+ clearTimeout(pending.timer);
72
+ pending.reject(error);
73
+ }
74
+ this.pending.clear();
75
+ }
76
+ request(request, transfers) {
77
+ if (this.pending.size >= 2)
78
+ return Promise.reject(new Error('Signature Worker request limit exceeded.'));
79
+ const worker = this.ensureWorker();
80
+ const id = `signature-${++nextRequestId}`;
81
+ return new Promise((resolve, reject) => {
82
+ const timer = setTimeout(() => {
83
+ this.failWorker(new DOMException('Signature Worker request timed out.', 'TimeoutError'));
84
+ }, 20000);
85
+ this.pending.set(id, { resolve: (value) => resolve(value), reject, timer });
86
+ try {
87
+ worker.postMessage({ ...request, id }, transfers);
88
+ }
89
+ catch (error) {
90
+ clearTimeout(timer);
91
+ this.pending.delete(id);
92
+ reject(error);
93
+ }
94
+ });
95
+ }
96
+ inspect(input, limits, publicKeys = []) {
97
+ const normalized = normalizeSignatureParseLimits(limits);
98
+ if (input.byteLength === 0 || input.byteLength > normalized.maxInputBytes) {
99
+ return Promise.reject(new Error(`OpenPGP input exceeds the ${normalized.maxInputBytes}-byte boundary.`));
100
+ }
101
+ if (publicKeys.length > 64) {
102
+ return Promise.reject(new Error('At most 64 OpenPGP verification keys may be supplied.'));
103
+ }
104
+ const keyBytes = publicKeys.reduce((sum, key) => sum + key.byteLength, 0);
105
+ if (!Number.isSafeInteger(keyBytes) || keyBytes > normalized.maxInputBytes) {
106
+ return Promise.reject(new Error(`OpenPGP public keys exceed the aggregate ${normalized.maxInputBytes}-byte boundary.`));
107
+ }
108
+ const transferable = input.slice(0);
109
+ const keyTransfers = publicKeys.map((key) => key.slice(0));
110
+ return this.request({ type: 'inspect', input: transferable, publicKeys: keyTransfers, limits: normalized }, [transferable, ...keyTransfers]);
111
+ }
112
+ classify(input, limits) {
113
+ const normalized = normalizeSignatureParseLimits(limits);
114
+ if (input.byteLength === 0 || input.byteLength > normalized.maxInputBytes) {
115
+ return Promise.reject(new Error(`OpenPGP input exceeds the ${normalized.maxInputBytes}-byte boundary.`));
116
+ }
117
+ const transferable = input.slice(0);
118
+ return this.request({ type: 'classify', input: transferable, limits: normalized }, [transferable]);
119
+ }
120
+ verifyDetached(content, signature, publicKeys, limits) {
121
+ const normalized = normalizeSignatureParseLimits(limits);
122
+ if (signature.byteLength === 0 ||
123
+ signature.byteLength > normalized.maxInputBytes ||
124
+ content.byteLength > normalized.maxInputBytes) {
125
+ return Promise.reject(new Error(`OpenPGP verification input exceeds the ${normalized.maxInputBytes}-byte boundary.`));
126
+ }
127
+ if (publicKeys.length === 0 || publicKeys.length > 64) {
128
+ return Promise.reject(new Error('OpenPGP verification requires between 1 and 64 public-key files.'));
129
+ }
130
+ const keyBytes = publicKeys.reduce((sum, key) => sum + key.byteLength, 0);
131
+ if (!Number.isSafeInteger(keyBytes) || keyBytes > normalized.maxInputBytes) {
132
+ return Promise.reject(new Error(`OpenPGP public keys exceed the aggregate ${normalized.maxInputBytes}-byte boundary.`));
133
+ }
134
+ const contentTransfer = content.slice(0);
135
+ const signatureTransfer = signature.slice(0);
136
+ const keyTransfers = publicKeys.map((key) => key.slice(0));
137
+ return this.request({
138
+ type: 'verify-detached',
139
+ content: contentTransfer,
140
+ signature: signatureTransfer,
141
+ publicKeys: keyTransfers,
142
+ limits: normalized
143
+ }, [contentTransfer, signatureTransfer, ...keyTransfers]);
144
+ }
145
+ dispose() {
146
+ this.failWorker(new DOMException('Signature Worker was terminated.', 'AbortError'));
147
+ }
148
+ }
@@ -0,0 +1,3 @@
1
+ export declare const detectOpenPgpArmorType: (bytes: Uint8Array) => "signature" | "message" | "cleartext-signed-message" | "public-key" | "private-key" | undefined;
2
+ export declare const hasPlausibleOpenPgpPacketHeader: (bytes: Uint8Array) => boolean;
3
+ export declare const isProbablyOpenPgp: (bytes: Uint8Array, filename?: string, typeHint?: string) => boolean;
@@ -0,0 +1,45 @@
1
+ const ARMOR_MARKERS = [
2
+ ['-----BEGIN PGP MESSAGE-----', 'message'],
3
+ ['-----BEGIN PGP SIGNATURE-----', 'signature'],
4
+ ['-----BEGIN PGP SIGNED MESSAGE-----', 'cleartext-signed-message'],
5
+ ['-----BEGIN PGP PUBLIC KEY BLOCK-----', 'public-key'],
6
+ ['-----BEGIN PGP PRIVATE KEY BLOCK-----', 'private-key']
7
+ ];
8
+ const OPENPGP_EXTENSIONS = new Set(['asc', 'sig', 'pgp', 'gpg']);
9
+ const extensionOf = (filename) => {
10
+ if (!filename)
11
+ return '';
12
+ const base = filename.split(/[\\/]/).pop() || filename;
13
+ const dot = base.lastIndexOf('.');
14
+ return dot >= 0 ? base.slice(dot + 1).toLowerCase() : '';
15
+ };
16
+ export const detectOpenPgpArmorType = (bytes) => {
17
+ var _a;
18
+ const head = new TextDecoder('utf-8', { fatal: false })
19
+ .decode(bytes.subarray(0, Math.min(bytes.byteLength, 512)))
20
+ .trimStart();
21
+ return (_a = ARMOR_MARKERS.find(([marker]) => head.startsWith(marker))) === null || _a === void 0 ? void 0 : _a[1];
22
+ };
23
+ export const hasPlausibleOpenPgpPacketHeader = (bytes) => {
24
+ var _a;
25
+ if (!bytes.byteLength)
26
+ return false;
27
+ const first = (_a = bytes[0]) !== null && _a !== void 0 ? _a : 0;
28
+ if ((first & 0x80) === 0)
29
+ return false;
30
+ if ((first & 0x40) !== 0) {
31
+ const tag = first & 0x3f;
32
+ return tag > 0 && tag < 64;
33
+ }
34
+ const tag = (first >> 2) & 0x0f;
35
+ return tag > 0 && tag < 16;
36
+ };
37
+ export const isProbablyOpenPgp = (bytes, filename, typeHint) => {
38
+ if (detectOpenPgpArmorType(bytes))
39
+ return true;
40
+ const type = (typeHint || '').replace(/^\./, '').toLowerCase();
41
+ if (OPENPGP_EXTENSIONS.has(type) || OPENPGP_EXTENSIONS.has(extensionOf(filename))) {
42
+ return true;
43
+ }
44
+ return hasPlausibleOpenPgpPacketHeader(bytes);
45
+ };
@@ -0,0 +1,72 @@
1
+ export type OpenPgpClassification = 'message' | 'encrypted-message' | 'detached-signature' | 'cleartext-signed-message' | 'signed-message' | 'public-key' | 'private-key' | 'literal-data' | 'compressed-data' | 'unknown-openpgp' | 'invalid-openpgp';
2
+ export interface SignatureParseLimits {
3
+ maxInputBytes: number;
4
+ maxOutputBytes: number;
5
+ maxPacketCount: number;
6
+ maxNestingDepth: number;
7
+ maxUserIds: number;
8
+ maxSubkeys: number;
9
+ maxSignatures: number;
10
+ }
11
+ export interface OpenPgpKeySummary {
12
+ kind: 'public' | 'private';
13
+ version?: string;
14
+ fingerprint?: string;
15
+ keyId?: string;
16
+ algorithm?: string;
17
+ createdAt?: string;
18
+ userIds: string[];
19
+ subkeys: Array<{
20
+ fingerprint?: string;
21
+ keyId?: string;
22
+ algorithm?: string;
23
+ createdAt?: string;
24
+ }>;
25
+ }
26
+ export interface OpenPgpSignatureSummary {
27
+ signatureType?: string;
28
+ hashAlgorithm?: string;
29
+ publicKeyAlgorithm?: string;
30
+ createdAt?: string;
31
+ expiresAt?: string;
32
+ issuerKeyIds: string[];
33
+ issuerFingerprints: string[];
34
+ cryptographicValid?: boolean;
35
+ verificationKeyFingerprint?: string;
36
+ verificationKeyId?: string;
37
+ verificationError?: string;
38
+ }
39
+ export interface ExtractedLiteralData {
40
+ filename?: string;
41
+ format?: string;
42
+ mediaType?: string;
43
+ data: Uint8Array;
44
+ }
45
+ export interface OpenPgpInspectionResult {
46
+ classification: OpenPgpClassification;
47
+ armored: boolean;
48
+ armorType?: string;
49
+ packetTypes: string[];
50
+ packetCount: number;
51
+ encrypted: boolean;
52
+ integrityProtected?: boolean;
53
+ symmetricAlgorithm?: string;
54
+ aeadMode?: string;
55
+ compressed: boolean;
56
+ keys: OpenPgpKeySummary[];
57
+ signatures: OpenPgpSignatureSummary[];
58
+ recipients: string[];
59
+ literalData?: ExtractedLiteralData;
60
+ warnings: string[];
61
+ }
62
+ export interface OpenPgpVerificationResult {
63
+ status: 'signature-valid' | 'signature-invalid' | 'public-key-required' | 'original-content-required' | 'unsupported-algorithm';
64
+ valid?: boolean;
65
+ keyFingerprint?: string;
66
+ keyId?: string;
67
+ error?: string;
68
+ }
69
+ export interface OpenPgpWorkerError {
70
+ code: 'invalid-input' | 'unsupported-format' | 'unsupported-algorithm' | 'input-too-large' | 'output-too-large' | 'packet-limit-exceeded' | 'nesting-limit-exceeded' | 'decompression-required' | 'encrypted-content' | 'public-key-required' | 'original-content-required' | 'malformed-packet' | 'wasm-initialization-failed' | 'internal-parser-error';
71
+ message: string;
72
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export function classify_openpgp(input: Uint8Array, limits: any): any;
5
+
6
+ export function inspect_openpgp(input: Uint8Array, public_keys: any, limits: any): any;
7
+
8
+ export function verify_detached_signature(content: Uint8Array, signature: Uint8Array, public_keys: any, limits: any): any;
9
+
10
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
11
+
12
+ export interface InitOutput {
13
+ readonly memory: WebAssembly.Memory;
14
+ readonly classify_openpgp: (a: number, b: number, c: number, d: number) => void;
15
+ readonly inspect_openpgp: (a: number, b: number, c: number, d: number, e: number) => void;
16
+ readonly verify_detached_signature: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
17
+ readonly __wbindgen_export: (a: number, b: number) => number;
18
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
19
+ readonly __wbindgen_export3: (a: number) => void;
20
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
21
+ }
22
+
23
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
24
+
25
+ /**
26
+ * Instantiates the given `module`, which can either be bytes or
27
+ * a precompiled `WebAssembly.Module`.
28
+ *
29
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
30
+ *
31
+ * @returns {InitOutput}
32
+ */
33
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
34
+
35
+ /**
36
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
37
+ * for everything else, calls `WebAssembly.instantiate` directly.
38
+ *
39
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
40
+ *
41
+ * @returns {Promise<InitOutput>}
42
+ */
43
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;