@embedpdf/plugin-signature 2.15.1 → 3.0.0-next.13
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 +192 -21
- package/README.md +38 -0
- package/dist/contract-BvHa9Zl_.d.cts +176 -0
- package/dist/contract-C3nQtwGf.js +14 -0
- package/dist/contract-C3nQtwGf.js.map +1 -0
- package/dist/contract-CojqGdMH.cjs +43 -0
- package/dist/contract-CojqGdMH.cjs.map +1 -0
- package/dist/contract-Dg50puf7.d.ts +176 -0
- package/dist/contract.cjs +7 -0
- package/dist/contract.d.cts +2 -0
- package/dist/contract.d.ts +2 -0
- package/dist/contract.js +2 -0
- package/dist/index.cjs +498 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -1
- package/dist/index.js +450 -511
- package/dist/index.js.map +1 -1
- package/package.json +28 -58
- package/dist/lib/actions.d.ts +0 -14
- package/dist/lib/handlers/signature-ink.handler.d.ts +0 -4
- package/dist/lib/handlers/signature-stamp.handler.d.ts +0 -4
- package/dist/lib/index.d.ts +0 -12
- package/dist/lib/manifest.d.ts +0 -4
- package/dist/lib/reducer.d.ts +0 -5
- package/dist/lib/serialization.d.ts +0 -30
- package/dist/lib/signature-plugin.d.ts +0 -27
- package/dist/lib/tools.d.ts +0 -113
- package/dist/lib/types.d.ts +0 -114
- package/dist/preact/adapter.d.ts +0 -5
- package/dist/preact/annotation.d.ts +0 -1
- package/dist/preact/core.d.ts +0 -1
- package/dist/preact/index.cjs +0 -2
- package/dist/preact/index.cjs.map +0 -1
- package/dist/preact/index.d.ts +0 -1
- package/dist/preact/index.js +0 -464
- package/dist/preact/index.js.map +0 -1
- package/dist/react/adapter.d.ts +0 -2
- package/dist/react/annotation.d.ts +0 -1
- package/dist/react/core.d.ts +0 -1
- package/dist/react/index.cjs +0 -2
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -463
- package/dist/react/index.js.map +0 -1
- package/dist/shared/components/crop-canvas.d.ts +0 -14
- package/dist/shared/components/index.d.ts +0 -2
- package/dist/shared/components/signature-draw-pad.d.ts +0 -12
- package/dist/shared/components/signature-type-pad.d.ts +0 -14
- package/dist/shared/hooks/index.d.ts +0 -2
- package/dist/shared/hooks/use-signature-upload.d.ts +0 -21
- package/dist/shared/hooks/use-signature.d.ts +0 -16
- package/dist/shared/index.d.ts +0 -4
- package/dist/shared-preact/components/crop-canvas.d.ts +0 -14
- package/dist/shared-preact/components/index.d.ts +0 -2
- package/dist/shared-preact/components/signature-draw-pad.d.ts +0 -12
- package/dist/shared-preact/components/signature-type-pad.d.ts +0 -14
- package/dist/shared-preact/hooks/index.d.ts +0 -2
- package/dist/shared-preact/hooks/use-signature-upload.d.ts +0 -21
- package/dist/shared-preact/hooks/use-signature.d.ts +0 -16
- package/dist/shared-preact/index.d.ts +0 -4
- package/dist/shared-react/components/crop-canvas.d.ts +0 -14
- package/dist/shared-react/components/index.d.ts +0 -2
- package/dist/shared-react/components/signature-draw-pad.d.ts +0 -12
- package/dist/shared-react/components/signature-type-pad.d.ts +0 -14
- package/dist/shared-react/hooks/index.d.ts +0 -2
- package/dist/shared-react/hooks/use-signature-upload.d.ts +0 -21
- package/dist/shared-react/hooks/use-signature.d.ts +0 -16
- package/dist/shared-react/index.d.ts +0 -4
- package/dist/shared-vue/components/crop-canvas.d.ts +0 -14
- package/dist/svelte/components/SignatureDrawPad.svelte.d.ts +0 -12
- package/dist/svelte/components/SignatureTypePad.svelte.d.ts +0 -14
- package/dist/svelte/components/index.d.ts +0 -2
- package/dist/svelte/hooks/index.d.ts +0 -2
- package/dist/svelte/hooks/use-signature-upload.svelte.d.ts +0 -21
- package/dist/svelte/hooks/use-signature.svelte.d.ts +0 -17
- package/dist/svelte/index.cjs +0 -2
- package/dist/svelte/index.cjs.map +0 -1
- package/dist/svelte/index.d.ts +0 -4
- package/dist/svelte/index.js +0 -415
- package/dist/svelte/index.js.map +0 -1
- package/dist/vue/components/SignatureDrawPad.vue.d.ts +0 -15
- package/dist/vue/components/SignatureTypePad.vue.d.ts +0 -19
- package/dist/vue/components/index.d.ts +0 -2
- package/dist/vue/hooks/index.d.ts +0 -2
- package/dist/vue/hooks/use-signature-upload.d.ts +0 -20
- package/dist/vue/hooks/use-signature.d.ts +0 -176
- package/dist/vue/index.cjs +0 -2
- package/dist/vue/index.cjs.map +0 -1
- package/dist/vue/index.d.ts +0 -4
- package/dist/vue/index.js +0 -453
- package/dist/vue/index.js.map +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { EventHook } from "@embedpdf/core";
|
|
2
|
+
import { StampAsset } from "@embedpdf/plugin-stamp/contract";
|
|
3
|
+
import { StampPlacement } from "@embedpdf/plugin-annotation/contract";
|
|
4
|
+
import { SignatureVerdict, SignatureVerdict as SignatureVerdict$1, SignerPort, SignerPort as SignerPort$1, TrustPort, TrustPort as TrustPort$1, ValidationTime, ValidationTime as ValidationTime$1 } from "@embedpdf/core-signature";
|
|
5
|
+
import { AnalyzeInput, AnalyzeInput as AnalyzeInput$1, BinarySource, ChangeAnalysis, ChangeAnalysis as ChangeAnalysis$1, DocMdpPermission, DocMdpPermission as DocMdpPermission$1, DocumentProtection, DocumentProtection as DocumentProtection$1, FieldLockSpec, FieldLockSpec as FieldLockSpec$1, FormFieldRef, FormFieldRef as FormFieldRef$1, SignatureCompleteResult, SignatureCompleteResult as SignatureCompleteResult$1, SignatureDTO, SignatureDTO as SignatureDTO$1, SignatureSnapshot, SignatureSnapshot as SignatureSnapshot$1 } from "@embedpdf/engine-core/runtime";
|
|
6
|
+
//#region src/types.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* What placing a mark on a signature field does:
|
|
9
|
+
* - `sign` seal the field with the configured signer (the mark is the appearance);
|
|
10
|
+
* - `visual` draw the mark into the field without sealing (Preview's "signature");
|
|
11
|
+
* - `ask` neither — emit `ask` so the chrome can open its dialog and decide.
|
|
12
|
+
* Default `sign` when a signer is configured, else `visual`.
|
|
13
|
+
*/
|
|
14
|
+
type SignatureMode = 'sign' | 'visual' | 'ask';
|
|
15
|
+
interface SignatureConfig {
|
|
16
|
+
mode?: SignatureMode;
|
|
17
|
+
/** The key holder: a raw signer (the CMS is built here) or a CMS signer (a service builds it). A thunk resolves per signing. */
|
|
18
|
+
signer?: SignerPort | (() => Promise<SignerPort>);
|
|
19
|
+
/** Trust anchors for validation. None → every verdict tops out at `valid-untrusted`. */
|
|
20
|
+
trust?: TrustPort;
|
|
21
|
+
/** Let the UI offer a certification (still needs `doc.sign.certify`). Default false. */
|
|
22
|
+
allowCertify?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** The mark: a stamp-plugin asset, or bytes the embedder brings (PNG, JPEG, or a one-page PDF). */
|
|
25
|
+
type Mark = {
|
|
26
|
+
assetId: string;
|
|
27
|
+
} | {
|
|
28
|
+
source: BinarySource;
|
|
29
|
+
};
|
|
30
|
+
interface SignFieldInput {
|
|
31
|
+
field: FormFieldRef;
|
|
32
|
+
mark: Mark;
|
|
33
|
+
/** What the signature dictionary says (`/Name` `/Reason` `/Location` `/ContactInfo`); the name defaults to the certificate's subject. */
|
|
34
|
+
attribution?: {
|
|
35
|
+
name?: string;
|
|
36
|
+
reason?: string;
|
|
37
|
+
location?: string;
|
|
38
|
+
contactInfo?: string;
|
|
39
|
+
};
|
|
40
|
+
/** Instead of the mark: a ready one-page appearance PDF the embedder composed itself. */
|
|
41
|
+
appearance?: BinarySource;
|
|
42
|
+
certify?: {
|
|
43
|
+
permission: DocMdpPermission;
|
|
44
|
+
};
|
|
45
|
+
lock?: FieldLockSpec;
|
|
46
|
+
}
|
|
47
|
+
/** The stamp-library kind that holds people's marks: one library per person. */
|
|
48
|
+
declare const SIGNATURES_LIBRARY_KIND = "signatures";
|
|
49
|
+
/** The asset identifiers inside a signatures library: the full signature and the initials. */
|
|
50
|
+
declare const SIGNATURE_MARK_NAME = "signature";
|
|
51
|
+
declare const INITIALS_MARK_NAME = "initials";
|
|
52
|
+
type MarkRole = 'signature' | 'initials';
|
|
53
|
+
/** Which mark an asset of a signatures library is (anything not named `initials` is a signature). */
|
|
54
|
+
declare const markRoleOf: (asset: Pick<StampAsset, "name">) => MarkRole;
|
|
55
|
+
interface SignaturePending {
|
|
56
|
+
signingId: string;
|
|
57
|
+
field: FormFieldRef;
|
|
58
|
+
}
|
|
59
|
+
interface SignatureState {
|
|
60
|
+
snapshot: SignatureSnapshot | null;
|
|
61
|
+
verdicts: SignatureVerdict[] | null;
|
|
62
|
+
/** The field the user chose to sign next ("select the field, then pick a mark"). */
|
|
63
|
+
target: FormFieldRef | null;
|
|
64
|
+
/** A signing candidate is parked (here or, on the cloud, elsewhere): the document is read-only. */
|
|
65
|
+
pending: SignaturePending | null;
|
|
66
|
+
/** A sign/fill call is in flight. */
|
|
67
|
+
busy: boolean;
|
|
68
|
+
}
|
|
69
|
+
type SignatureAction = {
|
|
70
|
+
type: 'SNAPSHOT';
|
|
71
|
+
snapshot: SignatureSnapshot | null;
|
|
72
|
+
} | {
|
|
73
|
+
type: 'VERDICTS';
|
|
74
|
+
verdicts: SignatureVerdict[] | null;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'TARGET';
|
|
77
|
+
field: FormFieldRef | null;
|
|
78
|
+
} | {
|
|
79
|
+
type: 'PENDING';
|
|
80
|
+
pending: SignaturePending | null;
|
|
81
|
+
} | {
|
|
82
|
+
type: 'BUSY';
|
|
83
|
+
busy: boolean;
|
|
84
|
+
};
|
|
85
|
+
type SignatureChange = {
|
|
86
|
+
type: 'signed';
|
|
87
|
+
field: FormFieldRef;
|
|
88
|
+
result: SignatureCompleteResult;
|
|
89
|
+
} | {
|
|
90
|
+
type: 'filled';
|
|
91
|
+
field: FormFieldRef;
|
|
92
|
+
} | {
|
|
93
|
+
type: 'cleared';
|
|
94
|
+
field: FormFieldRef;
|
|
95
|
+
} |
|
|
96
|
+
/** Mode `ask`: a mark met a field and the chrome decides (open its dialog, then `signField`/`fillField`). */
|
|
97
|
+
{
|
|
98
|
+
type: 'ask';
|
|
99
|
+
field: FormFieldRef;
|
|
100
|
+
mark: Mark;
|
|
101
|
+
} |
|
|
102
|
+
/** A signed field was activated: show what its signature says. */
|
|
103
|
+
{
|
|
104
|
+
type: 'inspect';
|
|
105
|
+
field: FormFieldRef;
|
|
106
|
+
} | {
|
|
107
|
+
type: 'target';
|
|
108
|
+
field: FormFieldRef | null;
|
|
109
|
+
} | {
|
|
110
|
+
type: 'validated';
|
|
111
|
+
verdicts: SignatureVerdict[];
|
|
112
|
+
} |
|
|
113
|
+
/** An unsaved edit just turned a signature that held into one a save would invalidate. Once per edge. */
|
|
114
|
+
{
|
|
115
|
+
type: 'invalidating';
|
|
116
|
+
field: FormFieldRef;
|
|
117
|
+
detail: string;
|
|
118
|
+
} | {
|
|
119
|
+
type: 'protectionChanged';
|
|
120
|
+
protection: DocumentProtection;
|
|
121
|
+
};
|
|
122
|
+
interface SignatureCapability {
|
|
123
|
+
snapshot(): SignatureSnapshot | null;
|
|
124
|
+
verdicts(): SignatureVerdict[] | null;
|
|
125
|
+
protection(): DocumentProtection | null;
|
|
126
|
+
pending(): SignaturePending | null;
|
|
127
|
+
target(): FormFieldRef | null;
|
|
128
|
+
busy(): boolean;
|
|
129
|
+
mode(): SignatureMode;
|
|
130
|
+
/** The signature facts of one field, by ref or by widget, from the last snapshot. */
|
|
131
|
+
signatureOf(field: FormFieldRef | {
|
|
132
|
+
annotObjectNumber: number;
|
|
133
|
+
}): SignatureDTO | null;
|
|
134
|
+
/** The verdict of one signed field from the last validation. */
|
|
135
|
+
verdictOf(field: FormFieldRef | {
|
|
136
|
+
annotObjectNumber: number;
|
|
137
|
+
}): SignatureVerdict | null;
|
|
138
|
+
/** `doc.sign` is granted and a signer is configured (or resolvable). */
|
|
139
|
+
canSign(): boolean;
|
|
140
|
+
/** Visual fills ride `doc.forms.fill`. */
|
|
141
|
+
canFill(): boolean;
|
|
142
|
+
/** `allowCertify` and `doc.sign.certify`. */
|
|
143
|
+
canCertify(): boolean;
|
|
144
|
+
/** Seal the field: the mark's page becomes the widget's appearance, the configured signer signs. */
|
|
145
|
+
signField(input: SignFieldInput): Promise<SignatureCompleteResult>;
|
|
146
|
+
/** Visual only: the mark becomes the widget's appearance; nothing is sealed. Refused on a signed field. */
|
|
147
|
+
fillField(field: FormFieldRef, mark: Mark): Promise<void>;
|
|
148
|
+
/** Undo a visual fill (a blank appearance). Refused on a signed field. */
|
|
149
|
+
clearField(field: FormFieldRef): Promise<void>;
|
|
150
|
+
/** The destination rule in one call: a field (sign, fill, or ask by mode) or a free placement (a stamp). */
|
|
151
|
+
placeMark(mark: Mark, target: {
|
|
152
|
+
field: FormFieldRef;
|
|
153
|
+
} | StampPlacement): Promise<void>;
|
|
154
|
+
/** Name the field the next picked mark goes to (the chrome's "Sign here"); null clears. */
|
|
155
|
+
setTarget(field: FormFieldRef | null): void;
|
|
156
|
+
/** Ask the chrome to show a signed field's facts (`inspect`). */
|
|
157
|
+
inspect(field: FormFieldRef): void;
|
|
158
|
+
refresh(): Promise<SignatureSnapshot | null>;
|
|
159
|
+
/**
|
|
160
|
+
* Judge every signature. The viewer's default is the WORKING COPY: unsaved
|
|
161
|
+
* edits count, so the verdict is the one the file a save produces will get.
|
|
162
|
+
* `until: 'persisted'` judges the loaded bytes only.
|
|
163
|
+
*/
|
|
164
|
+
validate(opts?: {
|
|
165
|
+
at?: ValidationTime;
|
|
166
|
+
until?: 'persisted' | 'working-copy';
|
|
167
|
+
}): Promise<SignatureVerdict[]>;
|
|
168
|
+
analyze(input: AnalyzeInput): Promise<ChangeAnalysis>;
|
|
169
|
+
/** The exact bytes a signature's revision covers (`doc.signatures.revisionBytes`) — rides `doc.download`. */
|
|
170
|
+
revisionBytes(revisionIndex: number): Promise<Uint8Array>;
|
|
171
|
+
onChanged: EventHook<SignatureChange>;
|
|
172
|
+
}
|
|
173
|
+
declare const SignatureToken: import("@embedpdf/core").CapabilityToken<SignatureCapability>;
|
|
174
|
+
//#endregion
|
|
175
|
+
export { SignatureConfig as C, SignatureToken as D, SignatureState as E, markRoleOf as O, SignatureChange as S, SignaturePending as T, SIGNATURES_LIBRARY_KIND as _, FieldLockSpec$1 as a, SignatureAction as b, SignatureDTO$1 as c, SignerPort$1 as d, TrustPort$1 as f, MarkRole as g, Mark as h, DocumentProtection$1 as i, SignatureSnapshot$1 as l, INITIALS_MARK_NAME as m, ChangeAnalysis$1 as n, FormFieldRef$1 as o, ValidationTime$1 as p, DocMdpPermission$1 as r, SignatureCompleteResult$1 as s, AnalyzeInput$1 as t, SignatureVerdict$1 as u, SIGNATURE_MARK_NAME as v, SignatureMode as w, SignatureCapability as x, SignFieldInput as y };
|
|
176
|
+
//# sourceMappingURL=contract-Dg50puf7.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_contract = require("./contract-CojqGdMH.cjs");
|
|
3
|
+
exports.INITIALS_MARK_NAME = require_contract.INITIALS_MARK_NAME;
|
|
4
|
+
exports.SIGNATURES_LIBRARY_KIND = require_contract.SIGNATURES_LIBRARY_KIND;
|
|
5
|
+
exports.SIGNATURE_MARK_NAME = require_contract.SIGNATURE_MARK_NAME;
|
|
6
|
+
exports.SignatureToken = require_contract.SignatureToken;
|
|
7
|
+
exports.markRoleOf = require_contract.markRoleOf;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as SignatureConfig, D as SignatureToken, E as SignatureState, O as markRoleOf, S as SignatureChange, T as SignaturePending, _ as SIGNATURES_LIBRARY_KIND, a as FieldLockSpec, b as SignatureAction, c as SignatureDTO, d as SignerPort, f as TrustPort, g as MarkRole, h as Mark, i as DocumentProtection, l as SignatureSnapshot, m as INITIALS_MARK_NAME, n as ChangeAnalysis, o as FormFieldRef, p as ValidationTime, r as DocMdpPermission, s as SignatureCompleteResult, t as AnalyzeInput, u as SignatureVerdict, v as SIGNATURE_MARK_NAME, w as SignatureMode, x as SignatureCapability, y as SignFieldInput } from "./contract-BvHa9Zl_.cjs";
|
|
2
|
+
export { type AnalyzeInput, type ChangeAnalysis, type DocMdpPermission, type DocumentProtection, type FieldLockSpec, type FormFieldRef, INITIALS_MARK_NAME, type Mark, type MarkRole, SIGNATURES_LIBRARY_KIND, SIGNATURE_MARK_NAME, type SignFieldInput, type SignatureAction, type SignatureCapability, type SignatureChange, type SignatureCompleteResult, type SignatureConfig, type SignatureDTO, type SignatureMode, type SignaturePending, type SignatureSnapshot, type SignatureState, SignatureToken, type SignatureVerdict, type SignerPort, type TrustPort, type ValidationTime, markRoleOf };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as SignatureConfig, D as SignatureToken, E as SignatureState, O as markRoleOf, S as SignatureChange, T as SignaturePending, _ as SIGNATURES_LIBRARY_KIND, a as FieldLockSpec, b as SignatureAction, c as SignatureDTO, d as SignerPort, f as TrustPort, g as MarkRole, h as Mark, i as DocumentProtection, l as SignatureSnapshot, m as INITIALS_MARK_NAME, n as ChangeAnalysis, o as FormFieldRef, p as ValidationTime, r as DocMdpPermission, s as SignatureCompleteResult, t as AnalyzeInput, u as SignatureVerdict, v as SIGNATURE_MARK_NAME, w as SignatureMode, x as SignatureCapability, y as SignFieldInput } from "./contract-Dg50puf7.js";
|
|
2
|
+
export { type AnalyzeInput, type ChangeAnalysis, type DocMdpPermission, type DocumentProtection, type FieldLockSpec, type FormFieldRef, INITIALS_MARK_NAME, type Mark, type MarkRole, SIGNATURES_LIBRARY_KIND, SIGNATURE_MARK_NAME, type SignFieldInput, type SignatureAction, type SignatureCapability, type SignatureChange, type SignatureCompleteResult, type SignatureConfig, type SignatureDTO, type SignatureMode, type SignaturePending, type SignatureSnapshot, type SignatureState, SignatureToken, type SignatureVerdict, type SignerPort, type TrustPort, type ValidationTime, markRoleOf };
|
package/dist/contract.js
ADDED