@signsealer/sdk 1.13.0 → 1.19.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/CHANGELOG.md +120 -0
- package/README.md +125 -0
- package/dist/cjs/index.cjs +193 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react.cjs +330 -0
- package/dist/cjs/react.cjs.map +1 -0
- package/dist/esm/index.d.ts +414 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +191 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react.d.ts +153 -0
- package/dist/esm/react.d.ts.map +1 -0
- package/dist/esm/react.js +321 -0
- package/dist/esm/react.js.map +1 -0
- package/package.json +19 -2
package/dist/esm/index.d.ts
CHANGED
|
@@ -326,7 +326,8 @@ export interface Ask {
|
|
|
326
326
|
* afterwards would make the seal a claim about something nobody can see.
|
|
327
327
|
*/
|
|
328
328
|
sensitive?: boolean;
|
|
329
|
-
|
|
329
|
+
/** `business` (1.16.0): answered by whoever signs for the business, and nobody else (00611). */
|
|
330
|
+
supplied_by?: "adult" | "per_child" | "staff" | "business";
|
|
330
331
|
options?: string[];
|
|
331
332
|
hint?: string;
|
|
332
333
|
/**
|
|
@@ -460,6 +461,46 @@ export interface Branding {
|
|
|
460
461
|
openingUrl?: string | null;
|
|
461
462
|
[key: string]: unknown;
|
|
462
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* 00484: one other person in a booking's party, as the person who booked
|
|
466
|
+
* describes them to `addParty`. An adult with neither `email` nor `phone`
|
|
467
|
+
* is a place kept open, taken from the party link; an empty `full_name` is
|
|
468
|
+
* a place for anybody in the party. A child is `minor: true` (or, when the
|
|
469
|
+
* party's `ages` is `dob`, a `date_of_birth` that makes them one), signed
|
|
470
|
+
* for by `guardian`: `"me"` (the person who booked), `"p1"`… (that adult in
|
|
471
|
+
* the same list) or `"other"`, with the parent's name and an address.
|
|
472
|
+
*/
|
|
473
|
+
export interface PartyPerson {
|
|
474
|
+
full_name?: string;
|
|
475
|
+
email?: string | null;
|
|
476
|
+
phone?: string | null;
|
|
477
|
+
minor?: boolean;
|
|
478
|
+
/** YYYY-MM-DD. Required for everybody when the party's `ages` is `dob`. */
|
|
479
|
+
date_of_birth?: string | null;
|
|
480
|
+
/** A child old enough to sign beside the adult, where the business asks minors to sign too. */
|
|
481
|
+
over_13?: boolean;
|
|
482
|
+
guardian?: "me" | "other" | `p${number}`;
|
|
483
|
+
guardian_name?: string | null;
|
|
484
|
+
guardian_email?: string | null;
|
|
485
|
+
guardian_phone?: string | null;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Somebody given their own link when the party was added, or when it was
|
|
489
|
+
* made again. `sent` when it went to them by email or text: then there is
|
|
490
|
+
* no link here, because it is theirs alone. Otherwise `token` and `url`,
|
|
491
|
+
* shown this once, for you to hand over.
|
|
492
|
+
*/
|
|
493
|
+
export interface PartyMemberLink {
|
|
494
|
+
signer_id: string;
|
|
495
|
+
full_name?: string;
|
|
496
|
+
email?: string | null;
|
|
497
|
+
phone?: string | null;
|
|
498
|
+
sent: boolean;
|
|
499
|
+
token: string | null;
|
|
500
|
+
url: string | null;
|
|
501
|
+
/** For a parent who is not in the party: the child they sign for. */
|
|
502
|
+
guardian_of?: string;
|
|
503
|
+
}
|
|
463
504
|
/** Where a one-time code went. The address is masked; you are not told it. */
|
|
464
505
|
export interface CodeSent {
|
|
465
506
|
channel: "email" | "sms";
|
|
@@ -530,12 +571,23 @@ export interface SignerLink {
|
|
|
530
571
|
full_name?: string;
|
|
531
572
|
role?: string;
|
|
532
573
|
participant?: boolean;
|
|
533
|
-
/**
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
574
|
+
/**
|
|
575
|
+
* The signing token. Returned once, and never again — only its hash is kept.
|
|
576
|
+
* Null for a signer held for their turn on a document signed in order
|
|
577
|
+
* (00609): their link is made and sent to them when the step before them is
|
|
578
|
+
* signed.
|
|
579
|
+
*/
|
|
580
|
+
token: string | null;
|
|
581
|
+
/** The page to send them to, built from the token (1.6.0); null when `token` is. */
|
|
582
|
+
url?: string | null;
|
|
583
|
+
/** 00609: a later step's signer on a document signed in order, sent their link at their turn. */
|
|
584
|
+
held?: true;
|
|
537
585
|
/** `embedded`: nothing was sent to them; show them `url` yourself (1.6.0). */
|
|
538
586
|
delivery?: "send" | "embedded";
|
|
587
|
+
/** The person who signs for the business, and answers its own questions (1.16.0, 00611). */
|
|
588
|
+
for_business?: boolean;
|
|
589
|
+
/** Signed only by an approval from the application it was bound to (1.18.0, 00684); it has no link. */
|
|
590
|
+
application_bound?: true;
|
|
539
591
|
}
|
|
540
592
|
/** Who has signed one document (00340): names and states, nothing else. */
|
|
541
593
|
export interface DocumentSigners {
|
|
@@ -721,12 +773,16 @@ export interface Workflow {
|
|
|
721
773
|
template_code?: string;
|
|
722
774
|
template_published: boolean;
|
|
723
775
|
public_slug?: string | null;
|
|
724
|
-
/**
|
|
776
|
+
/**
|
|
777
|
+
* 00541: with what each question is, when it is not words, so a signer's
|
|
778
|
+
* condition can be about it. `address` (1.17.0, 00654): asked on the public
|
|
779
|
+
* form as street, city, state or region and ZIP, and written as one line.
|
|
780
|
+
*/
|
|
725
781
|
form_fields: Array<{
|
|
726
782
|
key: string;
|
|
727
783
|
label: string;
|
|
728
784
|
required?: boolean;
|
|
729
|
-
kind?: "text" | "email" | "phone" | "checkbox" | "choice" | "number" | "date" | "birthdate" | "time" | "datetime";
|
|
785
|
+
kind?: "text" | "email" | "phone" | "address" | "checkbox" | "choice" | "number" | "date" | "birthdate" | "time" | "datetime";
|
|
730
786
|
options?: string[];
|
|
731
787
|
}>;
|
|
732
788
|
/** Every blank a person starting it is asked (00478); `sender_fields` are the boxes whoever sends it fills. */
|
|
@@ -748,8 +804,41 @@ export interface Workflow {
|
|
|
748
804
|
party_ages?: "tick" | "dob";
|
|
749
805
|
majority_age?: number;
|
|
750
806
|
minors_also_sign?: boolean;
|
|
807
|
+
/** 1.17.0 (00670): one document the party shares, or a document for each person, each its own signing. */
|
|
808
|
+
party_documents?: "one" | "each";
|
|
751
809
|
/** 00476: the zone its documents' times are written in. */
|
|
752
810
|
time_zone?: string | null;
|
|
811
|
+
/**
|
|
812
|
+
* 1.17.0 (00654): a visitor who signs from the public address confirms the
|
|
813
|
+
* email they typed with a code first. Free, and not the one-time passcodes
|
|
814
|
+
* setting. A start through the API or a tablet is not asked.
|
|
815
|
+
*/
|
|
816
|
+
email_check?: boolean;
|
|
817
|
+
/**
|
|
818
|
+
* 1.17.0 (00654): the public address's limits, which a start through the
|
|
819
|
+
* API or a tablet is neither stopped by nor counted toward: stop after so
|
|
820
|
+
* many documents started from the address are signed; stop after a day
|
|
821
|
+
* (`YYYY-MM-DD`, on the form's own calendar); and the same email within so
|
|
822
|
+
* many days is emailed its signed copy again instead of a new document.
|
|
823
|
+
* Null is no limit.
|
|
824
|
+
*/
|
|
825
|
+
stop_after_signed?: number | null;
|
|
826
|
+
closes_on?: string | null;
|
|
827
|
+
once_within_days?: number | null;
|
|
828
|
+
/** 1.17.0 (00654): why the public address takes no more signatures, in a visitor's words; null while it does. */
|
|
829
|
+
closed?: string | null;
|
|
830
|
+
/**
|
|
831
|
+
* 1.17.0 (00654): a live public address that fails a check of its
|
|
832
|
+
* pre-flight: the first such check, in words, and whether visitors are
|
|
833
|
+
* stopped by it (told the form is not ready) or sign as before, with only a
|
|
834
|
+
* change to the form waiting for the fix. Null while it passes.
|
|
835
|
+
*/
|
|
836
|
+
needs_attention?: {
|
|
837
|
+
key: string;
|
|
838
|
+
says: string;
|
|
839
|
+
fix: string | null;
|
|
840
|
+
stops_visitors: boolean;
|
|
841
|
+
} | null;
|
|
753
842
|
}
|
|
754
843
|
export interface ClientOptions {
|
|
755
844
|
/**
|
|
@@ -1042,6 +1131,29 @@ export declare class SignSealer {
|
|
|
1042
1131
|
}, idempotencyKey?: string): Promise<{
|
|
1043
1132
|
document_id: string;
|
|
1044
1133
|
}>;
|
|
1134
|
+
/**
|
|
1135
|
+
* A document from a PDF and the places to sign it, in one call (1.19.0,
|
|
1136
|
+
* 00685): the file is read, sanitised and drawn as a dashboard upload is,
|
|
1137
|
+
* kept as a one-time template, and the document prepared as a draft.
|
|
1138
|
+
* Each box is one `recipient`'s -- the `sign_order` you give that signer
|
|
1139
|
+
* on `send()` -- given in `fields` (fractions of the page, from its
|
|
1140
|
+
* top-left) or found from text tags in the file's words with
|
|
1141
|
+
* `text_tags: true` (`{{signature:1}}`, `{{date:1}}`, `{{initials:2}}`,
|
|
1142
|
+
* `{{text:1:Job number}}`, `{{checkbox:2:Label}}`). Needs `signing:templates`
|
|
1143
|
+
* and `signing:send` on the key. `pdf` is the file's bytes or its base64.
|
|
1144
|
+
*/
|
|
1145
|
+
documentFromPdf(input: {
|
|
1146
|
+
title: string;
|
|
1147
|
+
pdf: Uint8Array | string;
|
|
1148
|
+
filename?: string;
|
|
1149
|
+
fields?: PdfBox[];
|
|
1150
|
+
text_tags?: boolean;
|
|
1151
|
+
expires_at?: string;
|
|
1152
|
+
sequential?: boolean;
|
|
1153
|
+
external_ref?: string;
|
|
1154
|
+
metadata?: Record<string, string>;
|
|
1155
|
+
return_url?: string;
|
|
1156
|
+
}, idempotencyKey?: string): Promise<DocumentFromPdf>;
|
|
1045
1157
|
/**
|
|
1046
1158
|
* Send, and take the links back once.
|
|
1047
1159
|
*
|
|
@@ -1061,6 +1173,23 @@ export declare class SignSealer {
|
|
|
1061
1173
|
party_id?: string | null;
|
|
1062
1174
|
/** `embedded`: nothing is sent to them; you show them the page yourself (1.6.0). */
|
|
1063
1175
|
delivery?: "send" | "embedded";
|
|
1176
|
+
/**
|
|
1177
|
+
* The one person who signs for the business (1.16.0, 00611): the
|
|
1178
|
+
* template's questions marked `business` -- its own signature line,
|
|
1179
|
+
* date and name on an uploaded PDF -- are theirs, and nobody else's.
|
|
1180
|
+
*/
|
|
1181
|
+
for_business?: boolean;
|
|
1182
|
+
/**
|
|
1183
|
+
* This line is signed by an approval from the business's own
|
|
1184
|
+
* application, as this one of its people (1.18.0, 00684): `id` is the
|
|
1185
|
+
* application's, `subject` your id for the person, as your approvals
|
|
1186
|
+
* name them in `sub`. Needs `delivery: "embedded"`. The line gets no
|
|
1187
|
+
* link: its `token` and `url` are null and `application_bound` true.
|
|
1188
|
+
*/
|
|
1189
|
+
application?: {
|
|
1190
|
+
id: string;
|
|
1191
|
+
subject: string;
|
|
1192
|
+
};
|
|
1064
1193
|
}>, idempotencyKey?: string): Promise<{
|
|
1065
1194
|
links: SignerLink[];
|
|
1066
1195
|
}>;
|
|
@@ -1188,6 +1317,18 @@ export declare class SignSealer {
|
|
|
1188
1317
|
webhooks(): Promise<{
|
|
1189
1318
|
endpoints: unknown;
|
|
1190
1319
|
}>;
|
|
1320
|
+
/**
|
|
1321
|
+
* Make sure an endpoint is registered for an address (1.19.0, 00685): the
|
|
1322
|
+
* business's endpoint for `url`, its events and label set to these, or a
|
|
1323
|
+
* new one when it has none -- so calling it on every start-up never makes
|
|
1324
|
+
* a second. `created` says which; `secret` is there only when it is new.
|
|
1325
|
+
* An endpoint the business turned off stays off (`active`, `paused`).
|
|
1326
|
+
*/
|
|
1327
|
+
ensureWebhook(input: {
|
|
1328
|
+
url: string;
|
|
1329
|
+
events?: string[];
|
|
1330
|
+
label?: string;
|
|
1331
|
+
}): Promise<EnsuredWebhook>;
|
|
1191
1332
|
addWebhook(input: {
|
|
1192
1333
|
url: string;
|
|
1193
1334
|
events?: string[];
|
|
@@ -1359,6 +1500,62 @@ export declare class SignSealer {
|
|
|
1359
1500
|
report_id: string;
|
|
1360
1501
|
device_id: string;
|
|
1361
1502
|
}>;
|
|
1503
|
+
/**
|
|
1504
|
+
* The business's own applications whose servers vouch for their people's
|
|
1505
|
+
* approvals, each with its public keys (00684). Needs `signing:applications`.
|
|
1506
|
+
*/
|
|
1507
|
+
signingApplications(): Promise<SigningApplication[]>;
|
|
1508
|
+
/** Register an application. Then register the public key it signs approvals with. */
|
|
1509
|
+
addSigningApplication(name: string, idempotencyKey?: string): Promise<SigningApplication>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Register a public key, as a JWK: EC P-256 for ES256, OKP Ed25519 for
|
|
1512
|
+
* EdDSA. Only the public half; one with `d` is refused. `kid` defaults to
|
|
1513
|
+
* the key's RFC 7638 thumbprint.
|
|
1514
|
+
*/
|
|
1515
|
+
addSigningApplicationKey(applicationId: string, input: {
|
|
1516
|
+
public_jwk: {
|
|
1517
|
+
kty: "EC" | "OKP";
|
|
1518
|
+
crv: "P-256" | "Ed25519";
|
|
1519
|
+
x: string;
|
|
1520
|
+
y?: string;
|
|
1521
|
+
};
|
|
1522
|
+
kid?: string;
|
|
1523
|
+
expires_at?: string;
|
|
1524
|
+
}, idempotencyKey?: string): Promise<SigningApplication>;
|
|
1525
|
+
/** Revoke a key: every approval it signed and has not sent is refused from now on. */
|
|
1526
|
+
revokeSigningApplicationKey(applicationId: string, keyId: string, reason: string): Promise<SigningApplication>;
|
|
1527
|
+
/** Disable an application: every approval from it is refused from now on. */
|
|
1528
|
+
disableSigningApplication(applicationId: string, reason: string): Promise<SigningApplication>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Hand over one person's saved signature for one signing, server to
|
|
1531
|
+
* server (00684). The reference is single-use, short-lived and bound to
|
|
1532
|
+
* the application and the person; the image is never served back.
|
|
1533
|
+
* Possession of the reference authorises nothing on its own: only an
|
|
1534
|
+
* approval from the same application naming the same person, with
|
|
1535
|
+
* `signature.sha256` equal to `sha256` here, spends it. Needs
|
|
1536
|
+
* `signing:assert`.
|
|
1537
|
+
*/
|
|
1538
|
+
addSignatureReference(input: {
|
|
1539
|
+
application_id: string;
|
|
1540
|
+
subject: string;
|
|
1541
|
+
image: string;
|
|
1542
|
+
ttl_seconds?: number;
|
|
1543
|
+
}): Promise<SignatureReference>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Sign with an approval your application's server signed (`createApproval`).
|
|
1546
|
+
* Recorded as authenticated by your application, never as an identity
|
|
1547
|
+
* SignSealer checked. The same approval sent again answers with the
|
|
1548
|
+
* signing it made (`replayed: true`); retried with the same idempotency
|
|
1549
|
+
* key, the stored answer. Needs `signing:assert`.
|
|
1550
|
+
*/
|
|
1551
|
+
signWithApproval(input: {
|
|
1552
|
+
assertion: string;
|
|
1553
|
+
signature: ApprovalSignature;
|
|
1554
|
+
}, idempotencyKey?: string): Promise<SigningTransaction>;
|
|
1555
|
+
/** One signing an approval made. */
|
|
1556
|
+
signingTransaction(id: string): Promise<SigningTransaction>;
|
|
1557
|
+
/** The signing an approval made, by your application's id and the approval's `jti`: for a client that lost the answer. */
|
|
1558
|
+
signingTransactionByApproval(applicationId: string, approvalId: string): Promise<SigningTransaction>;
|
|
1362
1559
|
}
|
|
1363
1560
|
export interface SigningLink {
|
|
1364
1561
|
ok: boolean;
|
|
@@ -1435,8 +1632,8 @@ export interface SigningLink {
|
|
|
1435
1632
|
described?: boolean;
|
|
1436
1633
|
still_to_add: number;
|
|
1437
1634
|
/**
|
|
1438
|
-
* Whether this person may add the others now
|
|
1439
|
-
* the signing page (`/s/<token>`)
|
|
1635
|
+
* Whether this person may add the others now: with `addParty`, or on
|
|
1636
|
+
* the signing page (`/s/<token>`). They cannot sign until they have.
|
|
1440
1637
|
*/
|
|
1441
1638
|
may_add: boolean;
|
|
1442
1639
|
/** How a child is told apart (`tick`: a tick for "under 18"; `dob`: a date of birth), the age of majority, and whether minors sign too. */
|
|
@@ -1972,6 +2169,31 @@ export declare class SignSealerSigning {
|
|
|
1972
2169
|
decline(token: string, reason: string): Promise<{
|
|
1973
2170
|
declined: true;
|
|
1974
2171
|
}>;
|
|
2172
|
+
/**
|
|
2173
|
+
* 00484: the person who booked adds everybody else in the party, from
|
|
2174
|
+
* their own token, while `link(token).party.may_add` is true: exactly
|
|
2175
|
+
* `party.still_to_add` people. Each one given an email address, or a
|
|
2176
|
+
* number the business may text, is sent their own link and comes back
|
|
2177
|
+
* `sent` with no link; anybody it could not be sent to comes back with
|
|
2178
|
+
* theirs, once, for you to hand over. `party_link` is where the places
|
|
2179
|
+
* kept open are taken from: share it with the party. The person who
|
|
2180
|
+
* booked cannot sign until this is done.
|
|
2181
|
+
*/
|
|
2182
|
+
addParty(token: string, people: PartyPerson[]): Promise<{
|
|
2183
|
+
people: PartyMemberLink[];
|
|
2184
|
+
party_link: string;
|
|
2185
|
+
}>;
|
|
2186
|
+
/** 00484: a new party link for the person who booked; the last one stops working. */
|
|
2187
|
+
partyShare(token: string): Promise<{
|
|
2188
|
+
party_link: string;
|
|
2189
|
+
}>;
|
|
2190
|
+
/**
|
|
2191
|
+
* 00491: a new link for somebody the person who booked added, and theirs
|
|
2192
|
+
* stops working: sent to them where it can be (`sent`, no link), else
|
|
2193
|
+
* shown once. `address` corrects where it goes, before they have opened
|
|
2194
|
+
* it. Refused for somebody who took their own place from the party link.
|
|
2195
|
+
*/
|
|
2196
|
+
partyLink(token: string, signerId: string, address?: string): Promise<PartyMemberLink>;
|
|
1975
2197
|
/**
|
|
1976
2198
|
* Check a certificate by its printed code. No credential of any kind.
|
|
1977
2199
|
*
|
|
@@ -2211,4 +2433,187 @@ export declare function verifyWebhookRequest(opts: {
|
|
|
2211
2433
|
}): Promise<WebhookVerification & {
|
|
2212
2434
|
eventId: string | null;
|
|
2213
2435
|
}>;
|
|
2436
|
+
/** A public key an application signs approvals with. */
|
|
2437
|
+
export interface SigningApplicationKey {
|
|
2438
|
+
id: string;
|
|
2439
|
+
kid: string;
|
|
2440
|
+
alg: "ES256" | "EdDSA";
|
|
2441
|
+
public_jwk: {
|
|
2442
|
+
kty: string;
|
|
2443
|
+
crv: string;
|
|
2444
|
+
x: string;
|
|
2445
|
+
y?: string;
|
|
2446
|
+
};
|
|
2447
|
+
created_at: string;
|
|
2448
|
+
expires_at: string | null;
|
|
2449
|
+
revoked_at: string | null;
|
|
2450
|
+
revoked_reason: string | null;
|
|
2451
|
+
}
|
|
2452
|
+
/** A business's own application, registered to vouch for its people (00684). */
|
|
2453
|
+
export interface SigningApplication {
|
|
2454
|
+
id: string;
|
|
2455
|
+
name: string;
|
|
2456
|
+
created_at: string;
|
|
2457
|
+
disabled_at: string | null;
|
|
2458
|
+
disabled_reason: string | null;
|
|
2459
|
+
keys: SigningApplicationKey[];
|
|
2460
|
+
}
|
|
2461
|
+
/** A saved signature handed over for one signing: spend it within `expires_at`. */
|
|
2462
|
+
export interface SignatureReference {
|
|
2463
|
+
/** Opaque, single-use. Authorises nothing on its own. */
|
|
2464
|
+
reference: string;
|
|
2465
|
+
/** SHA-256 of the image, hex: put it in the approval's `signature.sha256`. */
|
|
2466
|
+
sha256: string;
|
|
2467
|
+
expires_at: string;
|
|
2468
|
+
}
|
|
2469
|
+
/** The signature itself, as sent beside the approval. */
|
|
2470
|
+
export type ApprovalSignature = {
|
|
2471
|
+
method: "drawn";
|
|
2472
|
+
image: string;
|
|
2473
|
+
} | {
|
|
2474
|
+
method: "typed";
|
|
2475
|
+
text: string;
|
|
2476
|
+
} | {
|
|
2477
|
+
method: "saved";
|
|
2478
|
+
reference: string;
|
|
2479
|
+
};
|
|
2480
|
+
/** What an approval signed. */
|
|
2481
|
+
export interface SigningTransaction {
|
|
2482
|
+
transaction_id: string;
|
|
2483
|
+
/** The approval's `jti`. */
|
|
2484
|
+
approval_id: string;
|
|
2485
|
+
application_id: string;
|
|
2486
|
+
document_id: string;
|
|
2487
|
+
signer_id: string;
|
|
2488
|
+
event_id: string;
|
|
2489
|
+
subject: string;
|
|
2490
|
+
status: "signed";
|
|
2491
|
+
signed_at: string;
|
|
2492
|
+
/** Where the document has got to: `completed` once everybody has signed. */
|
|
2493
|
+
document_status: string;
|
|
2494
|
+
document_sha256: string;
|
|
2495
|
+
signature_method: "drawn" | "typed" | "saved";
|
|
2496
|
+
signature_sha256: string;
|
|
2497
|
+
/** Always this: the application vouched; SignSealer did not check the person. */
|
|
2498
|
+
authentication: "external_application";
|
|
2499
|
+
/** On `signWithApproval`: true when the same approval was sent again and this is the signing it already made. */
|
|
2500
|
+
replayed?: boolean;
|
|
2501
|
+
}
|
|
2502
|
+
/** One person's approval of one exact text, as your application's server states it. */
|
|
2503
|
+
export interface ApprovalInput {
|
|
2504
|
+
/** Your application's id in SignSealer. */
|
|
2505
|
+
applicationId: string;
|
|
2506
|
+
/** The business's id: `account().tenant_id`. */
|
|
2507
|
+
tenantId: string;
|
|
2508
|
+
documentId: string;
|
|
2509
|
+
/** The document's `body_sha256_hex` as the person was shown it. */
|
|
2510
|
+
documentSha256: string;
|
|
2511
|
+
/** Optional: the line, when you have it from the send. */
|
|
2512
|
+
signerId?: string;
|
|
2513
|
+
/** Your id for the person, as the line was bound to it, and their name. */
|
|
2514
|
+
person: {
|
|
2515
|
+
subject: string;
|
|
2516
|
+
name: string;
|
|
2517
|
+
};
|
|
2518
|
+
/** How they signed in to your application: RFC 8176 methods (`pwd`, `otp`, `hwk`...), a level if you have one, and when. */
|
|
2519
|
+
auth: {
|
|
2520
|
+
methods: string[];
|
|
2521
|
+
level?: string;
|
|
2522
|
+
at: Date | number;
|
|
2523
|
+
};
|
|
2524
|
+
/** When they pressed approve. */
|
|
2525
|
+
approvedAt: Date | number;
|
|
2526
|
+
/** The signature as you will send it beside the approval: its hash goes into the approval. */
|
|
2527
|
+
signature: {
|
|
2528
|
+
method: "drawn";
|
|
2529
|
+
image: string;
|
|
2530
|
+
} | {
|
|
2531
|
+
method: "typed";
|
|
2532
|
+
text: string;
|
|
2533
|
+
} | {
|
|
2534
|
+
method: "saved";
|
|
2535
|
+
sha256: string;
|
|
2536
|
+
};
|
|
2537
|
+
/** Recorded as supplied by your application, not as anything SignSealer saw. */
|
|
2538
|
+
ip?: string;
|
|
2539
|
+
device?: string;
|
|
2540
|
+
/** `online`. `offline` is described, and refused until it is accepted. */
|
|
2541
|
+
origin?: "online" | "offline";
|
|
2542
|
+
/** The approval's id; a random one when left out. Keep it to find the signing again. */
|
|
2543
|
+
approvalId?: string;
|
|
2544
|
+
/** Seconds the approval lives, at most 300. Default 120. */
|
|
2545
|
+
ttlSeconds?: number;
|
|
2546
|
+
}
|
|
2547
|
+
/** SHA-256 of a string's UTF-8, as lowercase hex: a signature's, or a document's text. */
|
|
2548
|
+
export declare function sha256Hex(text: string): Promise<string>;
|
|
2549
|
+
/**
|
|
2550
|
+
* Sign one approval with your application's private key: a compact JWS
|
|
2551
|
+
* that `signWithApproval` sends. `privateKey` is a WebCrypto key or a
|
|
2552
|
+
* private JWK -- ECDSA P-256 (ES256) or Ed25519 (EdDSA) -- and `kid` the
|
|
2553
|
+
* name you registered its public half under.
|
|
2554
|
+
*
|
|
2555
|
+
* Make one per approval, when the person approves, and send it at once: it
|
|
2556
|
+
* lives two minutes by default and five at most, and its `jti` is spent by
|
|
2557
|
+
* the signing it makes.
|
|
2558
|
+
*/
|
|
2559
|
+
export declare function createApproval(opts: {
|
|
2560
|
+
privateKey: CryptoKey | JsonWebKey;
|
|
2561
|
+
kid: string;
|
|
2562
|
+
approval: ApprovalInput;
|
|
2563
|
+
/** For tests: the clock, in milliseconds. */
|
|
2564
|
+
now?: number;
|
|
2565
|
+
}): Promise<{
|
|
2566
|
+
assertion: string;
|
|
2567
|
+
approvalId: string;
|
|
2568
|
+
claims: Record<string, unknown>;
|
|
2569
|
+
}>;
|
|
2570
|
+
/** A box on a page of a PDF: one recipient's, in fractions of the page as a reader sees it, from its top-left. */
|
|
2571
|
+
export interface PdfBox {
|
|
2572
|
+
kind: "signature" | "initials" | "date" | "text" | "checkbox";
|
|
2573
|
+
/** The `sign_order` you give that signer on `send()`. */
|
|
2574
|
+
recipient: number;
|
|
2575
|
+
/** Defaults to `signature_1`, `date_signed_1`, `text_1_2` and so on. */
|
|
2576
|
+
key?: string;
|
|
2577
|
+
/** A `date` box labelled `Date signed` (the default) is filled with the day they sign. */
|
|
2578
|
+
label?: string;
|
|
2579
|
+
required?: boolean;
|
|
2580
|
+
page: number;
|
|
2581
|
+
x: number;
|
|
2582
|
+
y: number;
|
|
2583
|
+
w: number;
|
|
2584
|
+
h: number;
|
|
2585
|
+
}
|
|
2586
|
+
export interface DocumentFromPdf {
|
|
2587
|
+
document_id: string;
|
|
2588
|
+
template_id: string;
|
|
2589
|
+
template_code: string;
|
|
2590
|
+
pages: number;
|
|
2591
|
+
/** SHA-256 of the file as kept: sanitised, which is what is sealed. */
|
|
2592
|
+
sha256: string;
|
|
2593
|
+
/** The recipient numbers its boxes are for: give each a signer of that `sign_order`. */
|
|
2594
|
+
recipients: number[];
|
|
2595
|
+
fields: Array<Required<Omit<PdfBox, "page" | "x" | "y" | "w" | "h">> & {
|
|
2596
|
+
place: {
|
|
2597
|
+
page: number;
|
|
2598
|
+
x: number;
|
|
2599
|
+
y: number;
|
|
2600
|
+
w: number;
|
|
2601
|
+
h: number;
|
|
2602
|
+
};
|
|
2603
|
+
from: "given" | "tag";
|
|
2604
|
+
}>;
|
|
2605
|
+
/** What was taken out of the file because it could act on its own. */
|
|
2606
|
+
removed: string[];
|
|
2607
|
+
}
|
|
2608
|
+
export interface EnsuredWebhook {
|
|
2609
|
+
id: string;
|
|
2610
|
+
created: boolean;
|
|
2611
|
+
/** Only when `created`: keep it, it is not shown again. */
|
|
2612
|
+
secret: string | null;
|
|
2613
|
+
url: string;
|
|
2614
|
+
events: string[];
|
|
2615
|
+
label: string | null;
|
|
2616
|
+
active: boolean;
|
|
2617
|
+
paused: boolean;
|
|
2618
|
+
}
|
|
2214
2619
|
//# sourceMappingURL=index.d.ts.map
|