@majikah/sdk 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 +67 -0
- package/README.md +1112 -0
- package/dist/client/MajikahSDKClient.d.ts +308 -0
- package/dist/client/MajikahSDKClient.js +318 -0
- package/dist/errors/APIError.d.ts +7 -0
- package/dist/errors/APIError.js +14 -0
- package/dist/errors/AuthenticationError.d.ts +3 -0
- package/dist/errors/AuthenticationError.js +4 -0
- package/dist/errors/MajikahError.d.ts +4 -0
- package/dist/errors/MajikahError.js +9 -0
- package/dist/errors/QuotaExhaustedError.d.ts +3 -0
- package/dist/errors/QuotaExhaustedError.js +4 -0
- package/dist/errors/RateLimitError.d.ts +5 -0
- package/dist/errors/RateLimitError.js +10 -0
- package/dist/errors/ServiceUnavailableError.d.ts +3 -0
- package/dist/errors/ServiceUnavailableError.js +4 -0
- package/dist/errors/ValidationError.d.ts +5 -0
- package/dist/errors/ValidationError.js +10 -0
- package/dist/errors/index.d.ts +8 -0
- package/dist/errors/index.js +8 -0
- package/dist/errors/mapError.d.ts +3 -0
- package/dist/errors/mapError.js +22 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +4 -0
- package/dist/services/muid/MUIDClient.d.ts +95 -0
- package/dist/services/muid/MUIDClient.js +138 -0
- package/dist/services/muid/key-resolver.d.ts +24 -0
- package/dist/services/muid/key-resolver.js +32 -0
- package/dist/services/notary/NotaryClient.d.ts +188 -0
- package/dist/services/notary/NotaryClient.js +291 -0
- package/dist/services/notary/validation.d.ts +7 -0
- package/dist/services/notary/validation.js +19 -0
- package/dist/services/shared/encoding.d.ts +21 -0
- package/dist/services/shared/encoding.js +43 -0
- package/dist/services/shared/resolve-signature.d.ts +23 -0
- package/dist/services/shared/resolve-signature.js +31 -0
- package/dist/services/shared/sleep.d.ts +1 -0
- package/dist/services/shared/sleep.js +3 -0
- package/dist/services/shared/validation.d.ts +9 -0
- package/dist/services/shared/validation.js +16 -0
- package/dist/services/slink/SLinkClient.d.ts +174 -0
- package/dist/services/slink/SLinkClient.js +231 -0
- package/dist/services/slink/validation.d.ts +24 -0
- package/dist/services/slink/validation.js +31 -0
- package/dist/services/tsa/TSAClient.d.ts +101 -0
- package/dist/services/tsa/TSAClient.js +178 -0
- package/dist/services/tsa/validation.d.ts +2 -0
- package/dist/services/tsa/validation.js +12 -0
- package/dist/transport/HttpClient.d.ts +85 -0
- package/dist/transport/HttpClient.js +135 -0
- package/dist/transport/RouteResolver.d.ts +54 -0
- package/dist/transport/RouteResolver.js +67 -0
- package/dist/transport/retry-after.d.ts +17 -0
- package/dist/transport/retry-after.js +39 -0
- package/dist/transport/retry.d.ts +8 -0
- package/dist/transport/retry.js +61 -0
- package/dist/types/common.d.ts +133 -0
- package/dist/types/common.js +42 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +1 -0
- package/dist/types/muid.d.ts +80 -0
- package/dist/types/muid.js +1 -0
- package/dist/types/notary.d.ts +243 -0
- package/dist/types/notary.js +1 -0
- package/dist/types/slink.d.ts +60 -0
- package/dist/types/slink.js +1 -0
- package/dist/types/tsa.d.ts +144 -0
- package/dist/types/tsa.js +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { ExpectedSigner, MajikChainAnchor } from "@majikah/majik-signature";
|
|
2
|
+
export type { MajikChainAnchor } from "@majikah/majik-signature";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for polling a pending notarization request.
|
|
5
|
+
*
|
|
6
|
+
* Polling is used by convenience methods that wait for an asynchronously
|
|
7
|
+
* completed notarization or payment flow.
|
|
8
|
+
*/
|
|
9
|
+
export interface PollOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Time in milliseconds between consecutive status checks.
|
|
12
|
+
*
|
|
13
|
+
* A shorter interval detects state changes sooner but results in more
|
|
14
|
+
* requests to the gateway.
|
|
15
|
+
*
|
|
16
|
+
* @default 2000
|
|
17
|
+
*/
|
|
18
|
+
intervalMs?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum time in milliseconds to wait for the operation to complete.
|
|
21
|
+
*
|
|
22
|
+
* The default is slightly longer than the gateway's own pending timeout,
|
|
23
|
+
* allowing the client to observe a confirmation that arrives near the
|
|
24
|
+
* server-side timeout boundary.
|
|
25
|
+
*
|
|
26
|
+
* @default 130000
|
|
27
|
+
*/
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Additional options used when creating a cryptographic seal for notarization.
|
|
32
|
+
*
|
|
33
|
+
* These values are incorporated into the signing/sealing process and may
|
|
34
|
+
* affect how the resulting signature is validated.
|
|
35
|
+
*/
|
|
36
|
+
export interface SignSealOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Content type associated with the payload being sealed.
|
|
39
|
+
*
|
|
40
|
+
* This should describe the logical content being notarized and may be
|
|
41
|
+
* embedded in the generated signature/seal metadata.
|
|
42
|
+
*
|
|
43
|
+
* @example "document"
|
|
44
|
+
*/
|
|
45
|
+
contentType?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Timestamp associated with the signature or seal.
|
|
48
|
+
*
|
|
49
|
+
* Expected to be an ISO 8601 timestamp when supplied.
|
|
50
|
+
*
|
|
51
|
+
* @example "2026-09-15T01:30:00.000Z"
|
|
52
|
+
*/
|
|
53
|
+
timestamp?: string;
|
|
54
|
+
/**
|
|
55
|
+
* MIME type of the content being notarized.
|
|
56
|
+
*
|
|
57
|
+
* This is typically derived from the original file and is useful when
|
|
58
|
+
* consumers need to preserve or validate the content format.
|
|
59
|
+
*
|
|
60
|
+
* @example "application/pdf"
|
|
61
|
+
*/
|
|
62
|
+
mimeType?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Optional list of signers that are expected to participate in the seal.
|
|
65
|
+
*
|
|
66
|
+
* When provided, the resulting signature can be validated against the
|
|
67
|
+
* expected signer set.
|
|
68
|
+
*/
|
|
69
|
+
expectedSigners?: ExpectedSigner[];
|
|
70
|
+
/**
|
|
71
|
+
* Timestamp after which the generated signature or seal should no longer
|
|
72
|
+
* be considered valid.
|
|
73
|
+
*
|
|
74
|
+
* Expected to be an ISO 8601 timestamp when supplied.
|
|
75
|
+
*
|
|
76
|
+
* @example "2026-12-31T23:59:59.000Z"
|
|
77
|
+
*/
|
|
78
|
+
validUntil?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Timestamp representing when the notarization seal itself was created.
|
|
81
|
+
*
|
|
82
|
+
* Expected to be an ISO 8601 timestamp when supplied.
|
|
83
|
+
*
|
|
84
|
+
* @example "2026-09-15T01:30:00.000Z"
|
|
85
|
+
*/
|
|
86
|
+
sealTimestamp?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Payment checkout information returned by the notarization payment service.
|
|
90
|
+
*
|
|
91
|
+
* This payload contains everything required for a client to present the
|
|
92
|
+
* payment checkout to a user and track its expiration.
|
|
93
|
+
*/
|
|
94
|
+
export interface NotaryPaymentCheckout {
|
|
95
|
+
/**
|
|
96
|
+
* Unique payment order identifier assigned by the payment service.
|
|
97
|
+
*
|
|
98
|
+
* Use this identifier when referring to the associated payment transaction.
|
|
99
|
+
*/
|
|
100
|
+
order_id: string;
|
|
101
|
+
/**
|
|
102
|
+
* Data URL containing the QR code for checkout.
|
|
103
|
+
*
|
|
104
|
+
* The value is formatted as a `data:image/png;base64,...` URL and can be
|
|
105
|
+
* supplied directly to an HTML `<img src>` attribute.
|
|
106
|
+
*
|
|
107
|
+
* @example "data:image/png;base64,..."
|
|
108
|
+
*/
|
|
109
|
+
checkout_url: string;
|
|
110
|
+
/**
|
|
111
|
+
* Payment amount expressed in the smallest unit of the currency.
|
|
112
|
+
*
|
|
113
|
+
* For example, `5000` with `currency: "PHP"` represents ₱50.00.
|
|
114
|
+
*/
|
|
115
|
+
amount_cents: number;
|
|
116
|
+
/**
|
|
117
|
+
* ISO 4217 currency code used for the payment.
|
|
118
|
+
*
|
|
119
|
+
* @example "PHP"
|
|
120
|
+
*/
|
|
121
|
+
currency: string;
|
|
122
|
+
/**
|
|
123
|
+
* ISO 8601 timestamp indicating when the checkout expires.
|
|
124
|
+
*
|
|
125
|
+
* Clients should avoid presenting an expired checkout to users.
|
|
126
|
+
*
|
|
127
|
+
* @example "2026-09-15T02:00:00.000Z"
|
|
128
|
+
*/
|
|
129
|
+
expires_at: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Response returned by `POST /notary/v1/payment`.
|
|
133
|
+
*
|
|
134
|
+
* The result is a discriminated union:
|
|
135
|
+
*
|
|
136
|
+
* - `already_anchored` means the document has already been notarized and no
|
|
137
|
+
* payment is required.
|
|
138
|
+
* - `checkout_required` means payment must be completed before notarization
|
|
139
|
+
* can be finalized.
|
|
140
|
+
*
|
|
141
|
+
* The server removes its internal `outcome` discriminant before returning
|
|
142
|
+
* the response, so the client determines the variant from the response
|
|
143
|
+
* `status`.
|
|
144
|
+
*/
|
|
145
|
+
export type NotaryPaymentResult =
|
|
146
|
+
/**
|
|
147
|
+
* The document is already anchored on the notarization chain.
|
|
148
|
+
*
|
|
149
|
+
* No additional payment or notarization step is required.
|
|
150
|
+
*/
|
|
151
|
+
{
|
|
152
|
+
/** Indicates that the document is already notarized. */
|
|
153
|
+
status: "already_anchored";
|
|
154
|
+
/** Existing blockchain/notarization chain anchor. */
|
|
155
|
+
anchor: MajikChainAnchor;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Payment is required before the notarization can be finalized.
|
|
159
|
+
*
|
|
160
|
+
* Includes the payment checkout information needed to continue the flow.
|
|
161
|
+
*/
|
|
162
|
+
| ({
|
|
163
|
+
/** Indicates that the caller must complete the checkout flow. */
|
|
164
|
+
status: "checkout_required";
|
|
165
|
+
} & NotaryPaymentCheckout);
|
|
166
|
+
/**
|
|
167
|
+
* Result returned by the two-phase `initiateNotarization()` convenience flow.
|
|
168
|
+
*
|
|
169
|
+
* This discriminated union represents the complete set of states that can
|
|
170
|
+
* occur while preparing a notarization:
|
|
171
|
+
*
|
|
172
|
+
* - `anchored`: the document was already notarized and the existing anchor
|
|
173
|
+
* is available.
|
|
174
|
+
* - `payment_required`: payment must be completed before finalization.
|
|
175
|
+
* - `ready_to_finalize`: payment is complete or not required and the caller
|
|
176
|
+
* can proceed with finalization.
|
|
177
|
+
*/
|
|
178
|
+
export type InitiateNotarizationResult =
|
|
179
|
+
/**
|
|
180
|
+
* The document is already notarized.
|
|
181
|
+
*
|
|
182
|
+
* The returned blob contains the resulting notarization artifact and
|
|
183
|
+
* `anchor` contains the existing chain anchor.
|
|
184
|
+
*/
|
|
185
|
+
{
|
|
186
|
+
/** Indicates that notarization has already been completed. */
|
|
187
|
+
status: "anchored";
|
|
188
|
+
/** Resulting notarized artifact. */
|
|
189
|
+
blob: Blob;
|
|
190
|
+
/** Existing notarization chain anchor. */
|
|
191
|
+
anchor: MajikChainAnchor;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Payment is required before notarization can proceed.
|
|
195
|
+
*
|
|
196
|
+
* The sealed artifact is returned unchanged so the caller can retain it
|
|
197
|
+
* while the payment is completed. The same artifact should be supplied to
|
|
198
|
+
* `finalizeNotarization()` together with `sealHash`.
|
|
199
|
+
*/
|
|
200
|
+
| {
|
|
201
|
+
/** Indicates that payment must be completed before finalization. */
|
|
202
|
+
status: "payment_required";
|
|
203
|
+
/**
|
|
204
|
+
* SHA-256-derived seal hash identifying this sealed notarization
|
|
205
|
+
* payload.
|
|
206
|
+
*
|
|
207
|
+
* Pass this value to `finalizeNotarization()` after payment succeeds.
|
|
208
|
+
*/
|
|
209
|
+
sealHash: string;
|
|
210
|
+
/**
|
|
211
|
+
* The sealed artifact associated with `sealHash`.
|
|
212
|
+
*
|
|
213
|
+
* This is returned before payment so the caller can retain the exact
|
|
214
|
+
* sealed file that will later receive the chain anchor.
|
|
215
|
+
*/
|
|
216
|
+
sealedBlob: Blob;
|
|
217
|
+
/** Checkout information required to complete payment. */
|
|
218
|
+
checkout: NotaryPaymentCheckout;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The notarization request is ready for finalization.
|
|
222
|
+
*
|
|
223
|
+
* Payment has already been completed. The returned `sealedBlob` and
|
|
224
|
+
* `sealHash` can be passed directly to `finalizeNotarization()`.
|
|
225
|
+
*/
|
|
226
|
+
| {
|
|
227
|
+
/** Payment has already been completed, so the returned
|
|
228
|
+
sealed artifact can be finalized immediately. */
|
|
229
|
+
status: "ready_to_finalize";
|
|
230
|
+
/**
|
|
231
|
+
* SHA-256-derived seal hash identifying the notarization payload.
|
|
232
|
+
*
|
|
233
|
+
* Pass this value to the finalization step.
|
|
234
|
+
*/
|
|
235
|
+
sealHash: string;
|
|
236
|
+
/**
|
|
237
|
+
* The sealed artifact associated with `sealHash`.
|
|
238
|
+
*
|
|
239
|
+
* This is returned before payment so the caller can retain the exact
|
|
240
|
+
* sealed file that will later receive the chain anchor.
|
|
241
|
+
*/
|
|
242
|
+
sealedBlob: Blob;
|
|
243
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { MajikIDPublicView } from "./muid";
|
|
2
|
+
import { type MajikSLinkJSON, type SLinkClaimType, type SLinkVerificationMethod, type SLinkVerificationStatus } from "@majikah/majik-slink";
|
|
3
|
+
import type { MajikSignerPublicKeys, VerificationResult } from "@majikah/majik-signature";
|
|
4
|
+
export type { MajikSLinkJSON } from "@majikah/majik-slink";
|
|
5
|
+
/**
|
|
6
|
+
* Options used when creating and registering an SLink for a URL.
|
|
7
|
+
*/
|
|
8
|
+
export interface RegisterUrlOptions {
|
|
9
|
+
/** Custom identifier for the SLink. */
|
|
10
|
+
id?: string;
|
|
11
|
+
/** Timestamp to associate with the SLink claim. */
|
|
12
|
+
timestamp?: Date;
|
|
13
|
+
/** Initial verification status of the SLink. */
|
|
14
|
+
status?: SLinkVerificationStatus;
|
|
15
|
+
/** Type of claim represented by the SLink. */
|
|
16
|
+
claimType?: SLinkClaimType;
|
|
17
|
+
/** Method used to verify the SLink claim. */
|
|
18
|
+
verificationMethod?: SLinkVerificationMethod;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* An SLink search match together with the result of local cryptographic
|
|
22
|
+
* verification of its signature.
|
|
23
|
+
*/
|
|
24
|
+
export interface VerifiedSLinkMatch {
|
|
25
|
+
/** Public SLink and MUID data returned by the API. */
|
|
26
|
+
match: SLinkPublicView;
|
|
27
|
+
/** Result of locally verifying the SLink signature. */
|
|
28
|
+
result: VerificationResult;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolves the public signing keys required to verify an SLink signature.
|
|
32
|
+
*
|
|
33
|
+
* The resolver receives the MUID and signer ID from the SLink and may resolve
|
|
34
|
+
* keys from the MUID API, a local registry, or another trusted source.
|
|
35
|
+
*
|
|
36
|
+
* @param muid MUID associated with the SLink.
|
|
37
|
+
* @param signerId Signer ID recorded in the SLink signature.
|
|
38
|
+
* @returns Public keys required by `MajikSLink.verifySignature()`.
|
|
39
|
+
*/
|
|
40
|
+
export type PublicKeyResolver = (muid: string, signerId: string) => MajikSignerPublicKeys | Promise<MajikSignerPublicKeys>;
|
|
41
|
+
/**
|
|
42
|
+
* Public view of an SLink together with the public identity of its owner.
|
|
43
|
+
*/
|
|
44
|
+
export interface SLinkPublicView {
|
|
45
|
+
/** Public SLink data. */
|
|
46
|
+
slink: MajikSLinkJSON;
|
|
47
|
+
/** Public MUID information for the SLink owner. */
|
|
48
|
+
muid: MajikIDPublicView;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Result returned when searching for SLinks by hash.
|
|
52
|
+
*/
|
|
53
|
+
export interface SLinkSearchResult {
|
|
54
|
+
/** Hash used to identify matching SLinks. */
|
|
55
|
+
hash: string;
|
|
56
|
+
/** SLinks associated with the requested hash. */
|
|
57
|
+
matches: SLinkPublicView[];
|
|
58
|
+
/** Number of matching SLinks returned. */
|
|
59
|
+
count: number;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { EnvelopeInput, ExpectedSigner, MajikSignature, MajikSignatureEnvelope } from "@majikah/majik-signature";
|
|
2
|
+
export type { MajikTSARequest, MajikTimestamp, MajikTSAPayload, } from "@majikah/majik-signature";
|
|
3
|
+
/**
|
|
4
|
+
* Represents the gateway-side TSA credit quota available to a caller.
|
|
5
|
+
*
|
|
6
|
+
* This is an API and billing concern only. The quota ledger tracks
|
|
7
|
+
* promotional free stamps and purchased credits and is intentionally
|
|
8
|
+
* not part of the underlying cryptographic library or its signing
|
|
9
|
+
* primitives.
|
|
10
|
+
*
|
|
11
|
+
* Free credits are subject to a daily reset, while paid credits remain
|
|
12
|
+
* available until consumed or otherwise expired according to the
|
|
13
|
+
* gateway's billing policy.
|
|
14
|
+
*/
|
|
15
|
+
export interface TSAQuota {
|
|
16
|
+
/**
|
|
17
|
+
* Number of free TSA timestamps remaining in the current quota period.
|
|
18
|
+
*
|
|
19
|
+
* This value is decremented when a timestamp operation consumes a
|
|
20
|
+
* free stamp and is replenished when the quota resets.
|
|
21
|
+
*/
|
|
22
|
+
free_remaining: number;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum number of free TSA timestamps granted during each quota period.
|
|
25
|
+
*
|
|
26
|
+
* This represents the full free allowance before any stamps are consumed.
|
|
27
|
+
*/
|
|
28
|
+
free_daily_limit: number;
|
|
29
|
+
/**
|
|
30
|
+
* Number of purchased TSA timestamp credits currently available.
|
|
31
|
+
*
|
|
32
|
+
* Paid credits are consumed when the request is charged against the
|
|
33
|
+
* purchased-credit balance rather than the free allowance.
|
|
34
|
+
*/
|
|
35
|
+
paid_credits: number;
|
|
36
|
+
/**
|
|
37
|
+
* ISO 8601 timestamp indicating when the current free quota period resets.
|
|
38
|
+
*
|
|
39
|
+
* This field describes the next reset boundary for `free_remaining` and
|
|
40
|
+
* does not indicate when paid credits expire.
|
|
41
|
+
*/
|
|
42
|
+
resets_at: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for signing a file and embedding a trusted timestamp into it.
|
|
46
|
+
*/
|
|
47
|
+
export interface StampFileOptions {
|
|
48
|
+
/** MIME type of the source file. */
|
|
49
|
+
contentType?: string;
|
|
50
|
+
/** Existing timestamp value to include in the signature flow. */
|
|
51
|
+
timestamp?: string;
|
|
52
|
+
/** MIME type used when re-embedding the signed file. */
|
|
53
|
+
mimeType?: string;
|
|
54
|
+
/** Signers expected to participate in the resulting signature. */
|
|
55
|
+
expectedSigners?: ExpectedSigner[];
|
|
56
|
+
/** Optional validity period for the resulting signature. */
|
|
57
|
+
validUntil?: string;
|
|
58
|
+
/** Optional message associated with the signature chain. */
|
|
59
|
+
message?: string;
|
|
60
|
+
/** Previously signed file used to continue an existing signature chain. */
|
|
61
|
+
priorSignedFile?: Blob;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options for signing a file and returning its signature envelope separately
|
|
65
|
+
* instead of embedding the signature back into the file.
|
|
66
|
+
*/
|
|
67
|
+
export interface StampFileDetachedOptions {
|
|
68
|
+
/** MIME type of the source file. */
|
|
69
|
+
contentType?: string;
|
|
70
|
+
/** Existing timestamp value to include in the signature flow. */
|
|
71
|
+
timestamp?: string;
|
|
72
|
+
/** MIME type associated with the signed file. */
|
|
73
|
+
mimeType?: string;
|
|
74
|
+
/** Signers expected to participate in the resulting signature. */
|
|
75
|
+
expectedSigners?: ExpectedSigner[];
|
|
76
|
+
/** Optional validity period for the resulting signature. */
|
|
77
|
+
validUntil?: string;
|
|
78
|
+
/** Existing detached envelope to extend or update. */
|
|
79
|
+
existingEnvelope?: EnvelopeInput;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Result returned after signing a file and embedding a trusted timestamp.
|
|
83
|
+
*/
|
|
84
|
+
export interface StampResult {
|
|
85
|
+
/** Final file containing the updated signature and TSA timestamp. */
|
|
86
|
+
blob: Blob;
|
|
87
|
+
/** Signature created for the file. */
|
|
88
|
+
signature: MajikSignature;
|
|
89
|
+
/** Handler used to process the file format. */
|
|
90
|
+
handler: string;
|
|
91
|
+
/** MIME type of the resulting file. */
|
|
92
|
+
mimeType: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Result returned after signing a file and creating a detached timestamped
|
|
96
|
+
* signature envelope.
|
|
97
|
+
*/
|
|
98
|
+
export interface StampDetachedResult {
|
|
99
|
+
/** Original or processed file returned by the signing operation. */
|
|
100
|
+
blob: Blob;
|
|
101
|
+
/** Updated detached signature envelope containing the TSA timestamp. */
|
|
102
|
+
envelope: MajikSignatureEnvelope;
|
|
103
|
+
/** Signature created for the file. */
|
|
104
|
+
signature: MajikSignature;
|
|
105
|
+
/** Serialized `.mjksig` representation of the updated envelope. */
|
|
106
|
+
mjksig: Blob;
|
|
107
|
+
/** Handler used to process the file format. */
|
|
108
|
+
handler: string;
|
|
109
|
+
/** MIME type of the resulting file. */
|
|
110
|
+
mimeType: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Options for attaching a trusted timestamp to an existing signature.
|
|
114
|
+
*/
|
|
115
|
+
export interface TimestampExistingOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Signer ID whose signature should receive the TSA.
|
|
118
|
+
*
|
|
119
|
+
* Required when the file or envelope contains multiple signatures.
|
|
120
|
+
*/
|
|
121
|
+
expectedSignerId?: string;
|
|
122
|
+
/** MIME type of the file being processed. */
|
|
123
|
+
mimeType?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Result returned after attaching a trusted timestamp to an embedded signature.
|
|
127
|
+
*/
|
|
128
|
+
export interface TimestampExistingResult {
|
|
129
|
+
/** File containing the updated timestamped signature. */
|
|
130
|
+
blob: Blob;
|
|
131
|
+
/** Signature that received the TSA timestamp. */
|
|
132
|
+
signature: MajikSignature;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Result returned after attaching a trusted timestamp to a detached signature.
|
|
136
|
+
*/
|
|
137
|
+
export interface TimestampExistingDetachedResult {
|
|
138
|
+
/** Updated detached signature envelope. */
|
|
139
|
+
envelope: MajikSignatureEnvelope;
|
|
140
|
+
/** Signature that received the TSA timestamp. */
|
|
141
|
+
signature: MajikSignature;
|
|
142
|
+
/** Serialized `.mjksig` representation of the updated envelope. */
|
|
143
|
+
mjksig: Blob;
|
|
144
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@majikah/sdk",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Official TypeScript client SDK for the Majikah ecosystem, providing unified access to Majik Universal ID (MUID) identity verification, Time Stamping Authority (TSA) issuing, cryptographically signed link claims (SLink), and on-chain document notarization flows.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "Majikah Solutions OPC",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/Majikah/majikah-sdk.git"
|
|
17
|
+
},
|
|
18
|
+
"funding": {
|
|
19
|
+
"type": "github",
|
|
20
|
+
"url": "https://github.com/sponsors/jedlsf"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"majikah",
|
|
24
|
+
"sdk",
|
|
25
|
+
"typescript",
|
|
26
|
+
"muid",
|
|
27
|
+
"tsa",
|
|
28
|
+
"timestamping",
|
|
29
|
+
"slink",
|
|
30
|
+
"notary",
|
|
31
|
+
"notarization",
|
|
32
|
+
"digital-signatures",
|
|
33
|
+
"cryptography",
|
|
34
|
+
"identity-verification",
|
|
35
|
+
"blockchain-anchor",
|
|
36
|
+
"majik-signature",
|
|
37
|
+
"security"
|
|
38
|
+
],
|
|
39
|
+
"homepage": "https://github.com/Majikah/majikah-sdk#readme",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/Majikah/majikah-sdk/issues"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"prepublishOnly": "npm run build",
|
|
47
|
+
"package": "npm run build && npm version patch && git push && git push --tags",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"test:tsa": "npx vitest test/sdk-tsa.test.ts",
|
|
51
|
+
"test:slink": "npx vitest test/sdk-slink.test.ts",
|
|
52
|
+
"test:notary": "npx vitest test/sdk-notary.test.ts",
|
|
53
|
+
"test:muid": "npx vitest test/sdk-muid.test.ts"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@majikah/majik-key": "^0.4.0",
|
|
57
|
+
"@majikah/majik-signature": "^0.4.1",
|
|
58
|
+
"@majikah/majik-slink": "^0.2.1",
|
|
59
|
+
"@majikah/majik-universal-id": "^0.3.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^26.5.1",
|
|
63
|
+
"dotenv": "^17.4.2",
|
|
64
|
+
"typescript": "^7.0.2",
|
|
65
|
+
"vitest": "^5.0.0"
|
|
66
|
+
}
|
|
67
|
+
}
|