@chalidade/protect-pdf 0.0.0-stage → 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 +97 -2
- package/THIRD-PARTY-NOTICES.md +18 -0
- package/dist/chunks/protect-Dz2WFVuy.js +87 -0
- package/dist/chunks/qpdf-B0sSsX-b.js +2278 -0
- package/dist/chunks/qpdf-Bycd2-RO.js +3 -0
- package/dist/element.d.ts +16 -0
- package/dist/element.js +10789 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +1 -0
- package/package.json +45 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Public types of @chalidade/protect-pdf. They mirror src/tools/protect-pdf/protect.ts;
|
|
2
|
+
// types/check.ts fails the build if they drift.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the PDF is encrypted, read with qpdf. `needsPassword` is false for a
|
|
6
|
+
* PDF that opens freely but carries print/copy/edit restrictions.
|
|
7
|
+
*/
|
|
8
|
+
export declare function encryptionInfo(input: Uint8Array): Promise<{ encrypted: boolean; needsPassword: boolean }>
|
|
9
|
+
|
|
10
|
+
export type Permission = 'print' | 'copy' | 'modify'
|
|
11
|
+
|
|
12
|
+
/** Thrown by protectPdf for a PDF that is already encrypted. */
|
|
13
|
+
export declare class AlreadyEncryptedError extends Error {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The PDF encrypted with AES-256 (qpdf, PDF security handler R6). `password`
|
|
17
|
+
* is needed to open it; the permissions are locked with a random owner
|
|
18
|
+
* password nobody knows.
|
|
19
|
+
*/
|
|
20
|
+
export declare function protectPdf(input: Uint8Array, password: string, allow: Record<Permission, boolean>): Promise<Uint8Array>
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as AlreadyEncryptedError, r as encryptionInfo, n as protectPdf } from "./chunks/protect-Dz2WFVuy.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chalidade/protect-pdf",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lock a PDF with a password (AES-256) and restrict printing, copying or editing, in the browser. Nothing is uploaded.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"web component",
|
|
7
|
+
"custom element"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Chalid Ade Rahman",
|
|
11
|
+
"homepage": "https://chalidade.github.io/tools/#/protect-pdf",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/chalidade/tools.git",
|
|
15
|
+
"directory": "packages/protect-pdf"
|
|
16
|
+
},
|
|
17
|
+
"bugs": "https://github.com/chalidade/tools/issues",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"module": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"jsdelivr": "./dist/element.js",
|
|
23
|
+
"unpkg": "./dist/element.js",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./element": {
|
|
30
|
+
"types": "./dist/element.d.ts",
|
|
31
|
+
"import": "./dist/element.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": [
|
|
35
|
+
"./dist/element.js"
|
|
36
|
+
],
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE",
|
|
41
|
+
"THIRD-PARTY-NOTICES.md"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc --noEmit -p . && vite build && cp types/*.d.ts dist/",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
}
|
|
47
|
+
}
|