@majikah/majik-signature 0.8.0 → 0.8.2
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/README.md +186 -38
- package/dist/cli-core/index.d.ts +5 -5
- package/dist/cli-core/index.js +4 -4
- package/dist/cli-core/io.d.ts +1 -1
- package/dist/cli-core/key.js +1 -1
- package/dist/cli-core/operations.js +3 -3
- package/dist/cli-core/output.d.ts +1 -1
- package/dist/cli.js +3 -3
- package/dist/core/embed/canonical.d.ts +1 -1
- package/dist/core/embed/canonical.js +1 -1
- package/dist/core/embed/handlers/flac.d.ts +1 -1
- package/dist/core/embed/handlers/flac.js +1 -1
- package/dist/core/embed/handlers/index.d.ts +11 -11
- package/dist/core/embed/handlers/index.js +11 -11
- package/dist/core/embed/handlers/jpeg.d.ts +1 -1
- package/dist/core/embed/handlers/jpeg.js +1 -1
- package/dist/core/embed/handlers/mkv.d.ts +1 -1
- package/dist/core/embed/handlers/mkv.js +1 -1
- package/dist/core/embed/handlers/mp3.d.ts +1 -1
- package/dist/core/embed/handlers/mp3.js +2 -2
- package/dist/core/embed/handlers/mp4.d.ts +1 -1
- package/dist/core/embed/handlers/mp4.js +2 -3
- package/dist/core/embed/handlers/msix.d.ts +1 -1
- package/dist/core/embed/handlers/msix.js +1 -5
- package/dist/core/embed/handlers/office.d.ts +1 -1
- package/dist/core/embed/handlers/office.js +2 -2
- package/dist/core/embed/handlers/pdf.d.ts +1 -1
- package/dist/core/embed/handlers/pdf.js +1 -1
- package/dist/core/embed/handlers/png.d.ts +1 -1
- package/dist/core/embed/handlers/png.js +2 -2
- package/dist/core/embed/handlers/text.d.ts +1 -1
- package/dist/core/embed/handlers/text.js +1 -1
- package/dist/core/embed/handlers/wav.d.ts +1 -1
- package/dist/core/embed/handlers/wav.js +1 -1
- package/dist/core/embed/majik-embed.d.ts +6 -6
- package/dist/core/embed/majik-embed.js +9 -9
- package/dist/core/embed/registry.d.ts +1 -1
- package/dist/core/embed/registry.js +1 -1
- package/dist/core/embed/utils.d.ts +1 -1
- package/dist/core/embed/utils.js +2 -2
- package/dist/core/envelope.d.ts +2 -2
- package/dist/core/envelope.js +4 -4
- package/dist/core/mjksmap.d.ts +2 -2
- package/dist/core/mjksmap.js +4 -4
- package/dist/core/order.d.ts +2 -2
- package/dist/core/order.js +2 -2
- package/dist/core/payload.d.ts +1 -1
- package/dist/core/payload.js +1 -1
- package/dist/core/stamp/core/payload.d.ts +1 -1
- package/dist/core/stamp/core/stub.d.ts +1 -1
- package/dist/core/stamp/image-signature.d.ts +1 -1
- package/dist/core/stamp/image-signature.js +7 -7
- package/dist/core/stamp/index.d.ts +10 -10
- package/dist/core/stamp/index.js +8 -8
- package/dist/core/types.d.ts +3 -3
- package/dist/core/validator.d.ts +1 -1
- package/dist/core/validator.js +2 -2
- package/dist/index.d.ts +12 -12
- package/dist/index.js +10 -10
- package/dist/majik-signature.d.ts +7 -7
- package/dist/majik-signature.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,44 +11,132 @@ Beyond signing raw bytes, Majik Signature can **embed signatures directly into a
|
|
|
11
11
|
|
|
12
12
|
## Table of Contents
|
|
13
13
|
|
|
14
|
-
- [
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
- [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- [
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
14
|
+
- [Majik Signature](#majik-signature)
|
|
15
|
+
- [Table of Contents](#table-of-contents)
|
|
16
|
+
- [Why Majik Signature](#why-majik-signature)
|
|
17
|
+
- [Security Architecture](#security-architecture)
|
|
18
|
+
- [1. Hybrid Dual-Algorithm Signing](#1-hybrid-dual-algorithm-signing)
|
|
19
|
+
- [2. Canonical Payload Binding](#2-canonical-payload-binding)
|
|
20
|
+
- [3. Content-Agnostic Hashing](#3-content-agnostic-hashing)
|
|
21
|
+
- [4. File Embedding \& Detachment Integrity](#4-file-embedding--detachment-integrity)
|
|
22
|
+
- [5. Multi-Party Signing, Allowlists \& Sealing](#5-multi-party-signing-allowlists--sealing)
|
|
23
|
+
- [6. File Versioning for Visually-Mutating Multi-Sig Workflows](#6-file-versioning-for-visually-mutating-multi-sig-workflows)
|
|
24
|
+
- [7. Trusted Timestamps (TSA)](#7-trusted-timestamps-tsa)
|
|
25
|
+
- [8. Chain Anchoring](#8-chain-anchoring)
|
|
26
|
+
- [Overview](#overview)
|
|
27
|
+
- [What is a Majik Signature?](#what-is-a-majik-signature)
|
|
28
|
+
- [Use Cases](#use-cases)
|
|
29
|
+
- [Features](#features)
|
|
30
|
+
- [Security \& Post-Quantum Readiness](#security--post-quantum-readiness)
|
|
31
|
+
- [Multi-Party Signing](#multi-party-signing)
|
|
32
|
+
- [Detached Signing \& Batch Workflows](#detached-signing--batch-workflows)
|
|
33
|
+
- [Content Format Support](#content-format-support)
|
|
34
|
+
- [Developer Experience](#developer-experience)
|
|
35
|
+
- [Serialization \& Portability](#serialization--portability)
|
|
36
|
+
- [Installation](#installation)
|
|
37
|
+
- [Command-Line Interface](#command-line-interface)
|
|
38
|
+
- [`mjksig` — Sign, Verify, Seal, Inspect](#mjksig--sign-verify-seal-inspect)
|
|
39
|
+
- [Run with `npx`](#run-with-npx)
|
|
40
|
+
- [CLI Documentation](#cli-documentation)
|
|
41
|
+
- [Quick Start](#quick-start)
|
|
42
|
+
- [Signing Raw Content](#signing-raw-content)
|
|
43
|
+
- [File Embedding](#file-embedding)
|
|
44
|
+
- [Detached Signing](#detached-signing)
|
|
45
|
+
- [Multi-Signature Files \& Allowlists](#multi-signature-files--allowlists)
|
|
46
|
+
- [Sealing an Envelope](#sealing-an-envelope)
|
|
47
|
+
- [Trusted Timestamps (TSA)](#trusted-timestamps-tsa)
|
|
48
|
+
- [Batch Signing a Folder](#batch-signing-a-folder)
|
|
49
|
+
- [Verifying Signing Order](#verifying-signing-order)
|
|
50
|
+
- [Chain Anchoring](#chain-anchoring)
|
|
51
|
+
- [File Versioning \& Multi-Sig Revisions](#file-versioning--multi-sig-revisions)
|
|
52
|
+
- [API Reference](#api-reference)
|
|
53
|
+
- [Content Signing (bytes/strings)](#content-signing-bytesstrings)
|
|
54
|
+
- [`MajikSignature.sign(content, key, options?)`](#majiksignaturesigncontent-key-options)
|
|
55
|
+
- [`MajikSignature.verify(content, signature, publicKeys)`](#majiksignatureverifycontent-signature-publickeys)
|
|
56
|
+
- [`MajikSignature.verifyWithKey(content, signature, key)`](#majiksignatureverifywithkeycontent-signature-key)
|
|
57
|
+
- [`MajikSignature.publicKeysFromMajikKey(key)`](#majiksignaturepublickeysfrommajikkeykey)
|
|
58
|
+
- [`signature.extractPublicKeys()` *(instance method)*](#signatureextractpublickeys-instance-method)
|
|
59
|
+
- [`signature.validate()` / `signature.isValid()`](#signaturevalidate--signatureisvalid)
|
|
60
|
+
- [`MajikSignature.fromJSON(json)` / `MajikSignature.deserialize(base64)`](#majiksignaturefromjsonjson--majiksignaturedeserializebase64)
|
|
61
|
+
- [File Embedding API](#file-embedding-api)
|
|
62
|
+
- [`MajikSignature.signFile(file, key, options?)`](#majiksignaturesignfilefile-key-options)
|
|
63
|
+
- [`MajikSignature.verifyFile(file, keyOrPublicKeys, options?)`](#majiksignatureverifyfilefile-keyorpublickeys-options)
|
|
64
|
+
- [`signature.embedIn(file, options?)` *(instance method)*](#signatureembedinfile-options-instance-method)
|
|
65
|
+
- [`MajikSignature.extractFrom(file, options?)`](#majiksignatureextractfromfile-options)
|
|
66
|
+
- [`MajikSignature.stripFrom(file, options?)`](#majiksignaturestripfromfile-options)
|
|
67
|
+
- [`MajikSignature.isSigned(file, options?)`](#majiksignatureissignedfile-options)
|
|
68
|
+
- [Detached Signing \& MajikSignatureEnvelope API](#detached-signing--majiksignatureenvelope-api)
|
|
69
|
+
- [`MajikSignature.signFileDetached(file, key, options?)`](#majiksignaturesignfiledetachedfile-key-options)
|
|
70
|
+
- [`MajikSignature.verifyFileDetached(file, envelope, keyOrPublicKeys, options?)`](#majiksignatureverifyfiledetachedfile-envelope-keyorpublickeys-options)
|
|
71
|
+
- [`MajikSignatureEnvelope`](#majiksignatureenvelope)
|
|
72
|
+
- [Multi-Signature \& Allowlist API](#multi-signature--allowlist-api)
|
|
73
|
+
- [`MajikSignature.expectedSignerFromKey(key)`](#majiksignatureexpectedsignerfromkeykey)
|
|
74
|
+
- [`MajikSignature.getAllowlist(file, options?)`](#majiksignaturegetallowlistfile-options)
|
|
75
|
+
- [`MajikSignature.canSign(file, key, options?)`](#majiksignaturecansignfile-key-options)
|
|
76
|
+
- [`MajikSignature.getSignatories(file, options?, filter?)`](#majiksignaturegetsignatoriesfile-options-filter)
|
|
77
|
+
- [`MajikSignature.getIssuer(file, options?)`](#majiksignaturegetissuerfile-options)
|
|
78
|
+
- [`MajikSignature.getEnvelopeInfo(file, options?)`](#majiksignaturegetenvelopeinfofile-options)
|
|
79
|
+
- [`MajikSignature.isMultiSig(file, options?)`](#majiksignatureismultisigfile-options)
|
|
80
|
+
- [Sealing API](#sealing-api)
|
|
81
|
+
- [`MajikSignature.seal(file, key, options?)`](#majiksignaturesealfile-key-options)
|
|
82
|
+
- [`MajikSignature.verifySeal(file, options?)`](#majiksignatureverifysealfile-options)
|
|
83
|
+
- [`MajikSignature.getSealInfo(file, options?)`](#majiksignaturegetsealinfofile-options)
|
|
84
|
+
- [`MajikSignature.isSealed(file, options?)`](#majiksignatureissealedfile-options)
|
|
85
|
+
- [Trusted Timestamps API](#trusted-timestamps-api)
|
|
86
|
+
- [`signature.buildTSARequestPayload()`](#signaturebuildtsarequestpayload)
|
|
87
|
+
- [`MajikSignature.signTSA(request, key, tsa, options?)`](#majiksignaturesigntsarequest-key-tsa-options)
|
|
88
|
+
- [`signature.addTSA(timestamp)`](#signatureaddtsatimestamp)
|
|
89
|
+
- [`signature.verifyTSA()`](#signatureverifytsa)
|
|
90
|
+
- [`signature.hasTSA`](#signaturehastsa)
|
|
91
|
+
- [Batch Signing \& MajikSignatureMap API](#batch-signing--majiksignaturemap-api)
|
|
92
|
+
- [`MajikSignature.signBatchDetached(files, key, options?)`](#majiksignaturesignbatchdetachedfiles-key-options)
|
|
93
|
+
- [`MajikSignature.verifyFilesFromMjksMap(map, files, publicKeys, options?)`](#majiksignatureverifyfilesfrommjksmapmap-files-publickeys-options)
|
|
94
|
+
- [`MajikSignature.verifyFilesFromMjksMapWithKey(map, files, key, options?)`](#majiksignatureverifyfilesfrommjksmapwithkeymap-files-key-options)
|
|
95
|
+
- [`MajikSignature.summarizeBatchVerification(results)`](#majiksignaturesummarizebatchverificationresults)
|
|
96
|
+
- [`MajikSignatureMap`](#majiksignaturemap)
|
|
97
|
+
- [Signature Order Verification API](#signature-order-verification-api)
|
|
98
|
+
- [`MajikSignature.verifyFileOrder(file, expectedOrder, options?)`](#majiksignatureverifyfileorderfile-expectedorder-options)
|
|
99
|
+
- [`MajikSignature.verifyFileDetachedOrder(file, envelope, expectedOrder, options?)`](#majiksignatureverifyfiledetachedorderfile-envelope-expectedorder-options)
|
|
100
|
+
- [`MajikSignature.normalizeExpectedOrder(expectedOrder)`](#majiksignaturenormalizeexpectedorderexpectedorder)
|
|
101
|
+
- [Chain Anchoring API (Experimental)](#chain-anchoring-api-experimental)
|
|
102
|
+
- [`MajikSignature.canAnchor(file, options?)`](#majiksignaturecananchorfile-options)
|
|
103
|
+
- [`MajikSignature.buildChainAnchorMemo(sealHash)`](#majiksignaturebuildchainanchormemosealhash)
|
|
104
|
+
- [`MajikSignature.registerChainAnchor(file, anchor, options?)`](#majiksignatureregisterchainanchorfile-anchor-options)
|
|
105
|
+
- [`MajikSignature.getChainAnchors(file, options?)`](#majiksignaturegetchainanchorsfile-options)
|
|
106
|
+
- [File Versioning API](#file-versioning-api)
|
|
107
|
+
- [`MajikSignature.signFile(file, key, options?)` — versioning-relevant options](#majiksignaturesignfilefile-key-options--versioning-relevant-options)
|
|
108
|
+
- [`MajikSignature.verifyFileChain(file, options?)`](#majiksignatureverifyfilechainfile-options)
|
|
109
|
+
- [`MajikSignature.verifyFileRevisions(finalFile, revisions, options?)`](#majiksignatureverifyfilerevisionsfinalfile-revisions-options)
|
|
110
|
+
- [`MajikSignature.verifyCommitment(signature, publicKeys, now?)`](#majiksignatureverifycommitmentsignature-publickeys-now)
|
|
111
|
+
- [Image Stamping (Experimental)](#image-stamping-experimental)
|
|
112
|
+
- [Serialization](#serialization)
|
|
113
|
+
- [`signature.toJSON()` / `MajikSignature.fromJSON(json)`](#signaturetojson--majiksignaturefromjsonjson)
|
|
114
|
+
- [`signature.serialize()` / `MajikSignature.deserialize(base64)`](#signatureserialize--majiksignaturedeserializebase64)
|
|
115
|
+
- [`envelope.toJSON()` / `MajikSignatureEnvelope.fromJSON(json)`](#envelopetojson--majiksignatureenvelopefromjsonjson)
|
|
116
|
+
- [`envelope.serialize()` / `MajikSignatureEnvelope.deserialize(base64)`](#envelopeserialize--majiksignatureenvelopedeserializebase64)
|
|
117
|
+
- [`envelope.toMJKSIG()` / `MajikSignatureEnvelope.fromMJKSIG(input)`](#envelopetomjksig--majiksignatureenvelopefrommjksiginput)
|
|
118
|
+
- [Supported File Formats](#supported-file-formats)
|
|
119
|
+
- [Signature \& Envelope Structure](#signature--envelope-structure)
|
|
120
|
+
- [Binary Container Formats (MJKSIG / MJKSMAP)](#binary-container-formats-mjksig--mjksmap)
|
|
121
|
+
- [Error Handling](#error-handling)
|
|
122
|
+
- [Security Considerations](#security-considerations)
|
|
123
|
+
- [What is Guaranteed](#what-is-guaranteed)
|
|
124
|
+
- [What is Your Responsibility](#what-is-your-responsibility)
|
|
125
|
+
- [What NOT to Do](#what-not-to-do)
|
|
126
|
+
- [What TO Do](#what-to-do)
|
|
127
|
+
- [The Majikah Ecosystem](#the-majikah-ecosystem)
|
|
128
|
+
- [Majik Signature — Standalone App](#majik-signature--standalone-app)
|
|
129
|
+
- [🧾 Majik Buwiz](#-majik-buwiz)
|
|
130
|
+
- [💬 Majik Message](#-majik-message)
|
|
131
|
+
- [🪪 Majik Universal ID](#-majik-universal-id)
|
|
132
|
+
- [Related Projects](#related-projects)
|
|
133
|
+
- [Majik Key](#majik-key)
|
|
134
|
+
- [Majik Message](#majik-message)
|
|
135
|
+
- [Contributing](#contributing)
|
|
136
|
+
- [License](#license)
|
|
137
|
+
- [Author](#author)
|
|
138
|
+
- [Contact](#contact)
|
|
139
|
+
|
|
52
140
|
|
|
53
141
|
---
|
|
54
142
|
|
|
@@ -260,6 +348,66 @@ npm install @majikah/majik-key
|
|
|
260
348
|
|
|
261
349
|
No native bindings. Works in Node.js 18+, modern browsers, Deno, Bun, and Tauri.
|
|
262
350
|
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Command-Line Interface
|
|
354
|
+
|
|
355
|
+
### `mjksig` — Sign, Verify, Seal, Inspect
|
|
356
|
+
|
|
357
|
+
Majik Signature includes a full-featured CLI for working with signed files directly from your terminal.
|
|
358
|
+
|
|
359
|
+
The `mjksig` CLI supports:
|
|
360
|
+
|
|
361
|
+
* Embedded and detached signing
|
|
362
|
+
* MJKSMAP folder signing and verification
|
|
363
|
+
* Multi-signature allowlists and co-signing
|
|
364
|
+
* Envelope sealing
|
|
365
|
+
* Signing-permission checks
|
|
366
|
+
* Signature inspection
|
|
367
|
+
* Batch workflows
|
|
368
|
+
* Machine-readable `--json` output
|
|
369
|
+
* Interactive and non-interactive signing-key passphrases
|
|
370
|
+
|
|
371
|
+
### Run with `npx`
|
|
372
|
+
|
|
373
|
+
No global installation required:
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
npx @majikah/majik-signature --help
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Sign a file:
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
npx @majikah/majik-signature sign report.pdf --key alice.json
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Verify a file:
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
npx @majikah/majik-signature verify report.pdf
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Or install globally and use the `mjksig` command directly:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
npm install -g @majikah/majik-signature
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
mjksig --help
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
For automation and CI environments, signing-key passphrases can be supplied through `MAJIK_KEY_PASSPHRASE`.
|
|
402
|
+
|
|
403
|
+
### CLI Documentation
|
|
404
|
+
|
|
405
|
+
For the complete command reference, workflow combinations, options, compatibility rules, examples, exit codes, automation guidance, and `npx` usage, see:
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
[](./CLI_README.md)
|
|
409
|
+
|
|
410
|
+
|
|
263
411
|
---
|
|
264
412
|
|
|
265
413
|
## Quick Start
|
package/dist/cli-core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type * from "./types";
|
|
2
|
-
export * from "./io";
|
|
3
|
-
export * from "./key";
|
|
4
|
-
export * from "./output";
|
|
5
|
-
export * from "./operations";
|
|
1
|
+
export type * from "./types.js";
|
|
2
|
+
export * from "./io.js";
|
|
3
|
+
export * from "./key.js";
|
|
4
|
+
export * from "./output.js";
|
|
5
|
+
export * from "./operations.js";
|
package/dist/cli-core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./io";
|
|
2
|
-
export * from "./key";
|
|
3
|
-
export * from "./output";
|
|
4
|
-
export * from "./operations";
|
|
1
|
+
export * from "./io.js";
|
|
2
|
+
export * from "./key.js";
|
|
3
|
+
export * from "./output.js";
|
|
4
|
+
export * from "./operations.js";
|
package/dist/cli-core/io.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Node.js filesystem helpers for the Majik Signature CLI.
|
|
5
5
|
*/
|
|
6
|
-
import type { FolderFile } from "./types";
|
|
6
|
+
import type { FolderFile } from "./types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Convert a filesystem path into the normalized relative-path convention
|
|
9
9
|
* used by MajikSignatureMap.
|
package/dist/cli-core/key.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { createInterface } from "node:readline/promises";
|
|
10
10
|
import { stdin as input, stdout as output } from "node:process";
|
|
11
11
|
import { MajikKey } from "@majikah/majik-key";
|
|
12
|
-
import { readJsonFile, resolveCliPath } from "./io";
|
|
12
|
+
import { readJsonFile, resolveCliPath } from "./io.js";
|
|
13
13
|
/**
|
|
14
14
|
* Read a passphrase without echoing it to the terminal.
|
|
15
15
|
*
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { basename, extname, isAbsolute, join, relative, resolve, } from "node:path";
|
|
18
18
|
import { zipSync } from "fflate";
|
|
19
|
-
import { MajikSignature } from "../majik-signature";
|
|
20
|
-
import { MajikSignatureEnvelope } from "../core/envelope";
|
|
21
|
-
import { MajikSignatureMap } from "../core/mjksmap";
|
|
19
|
+
import { MajikSignature } from "../majik-signature.js";
|
|
20
|
+
import { MajikSignatureEnvelope } from "../core/envelope.js";
|
|
21
|
+
import { MajikSignatureMap } from "../core/mjksmap.js";
|
|
22
22
|
import { getPathKind, mimeTypeForPath, outputPathForDetachedFile, outputPathForMap, outputPathForMapBundle, readBlob, readFolderFiles, readJsonFile, resolveCliPath, summarizeFiles, writeBlob, writeBytes, } from "./io.js";
|
|
23
23
|
import { loadMajikKey, loadSigningKey, lockKey } from "./key.js";
|
|
24
24
|
function errorMessage(error) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Human-readable and machine-readable result presentation.
|
|
5
5
|
*/
|
|
6
|
-
import type { CliResult } from "./types";
|
|
6
|
+
import type { CliResult } from "./types.js";
|
|
7
7
|
export declare function printResult(result: CliResult): void;
|
|
8
8
|
export declare function printJsonResult(result: CliResult): void;
|
|
9
9
|
export declare function printFailure(error: unknown): void;
|
package/dist/cli.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { resolve } from "node:path";
|
|
8
|
-
import { runCanSign, runInspect, runSeal, runSign, runVerify, } from "./cli-core/operations";
|
|
9
|
-
import { printFailure, printJsonResult, printResult } from "./cli-core/output";
|
|
10
|
-
import { getPackageVersion } from "./cli-core/io";
|
|
8
|
+
import { runCanSign, runInspect, runSeal, runSign, runVerify, } from "./cli-core/operations.js";
|
|
9
|
+
import { printFailure, printJsonResult, printResult } from "./cli-core/output.js";
|
|
10
|
+
import { getPackageVersion } from "./cli-core/io.js";
|
|
11
11
|
function parseCsv(value) {
|
|
12
12
|
return value
|
|
13
13
|
.split(",")
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This relies on embed() being deterministic (Office pins mtime + level).
|
|
20
20
|
*/
|
|
21
|
-
import type { FormatHandler } from "../types";
|
|
21
|
+
import type { FormatHandler } from "../types.js";
|
|
22
22
|
export type CanonicalResult = {
|
|
23
23
|
ok: true;
|
|
24
24
|
original: Uint8Array;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This relies on embed() being deterministic (Office pins mtime + level).
|
|
20
20
|
*/
|
|
21
|
-
import { bufferEqual } from "./utils";
|
|
21
|
+
import { bufferEqual } from "./utils.js";
|
|
22
22
|
/**
|
|
23
23
|
* Embedded-envelope path. `raw` is what handler.extract(bytes) returned.
|
|
24
24
|
* On success `original` is the exact byte string the signatures cover.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* We embed signatures using an APPLICATION block (type = 2) with 4-byte
|
|
10
10
|
* application ID "MAJK" followed by the signature JSON payload.
|
|
11
11
|
*/
|
|
12
|
-
import { FormatHandler } from "../../types";
|
|
12
|
+
import { FormatHandler } from "../../types.js";
|
|
13
13
|
export declare class FlacHandler implements FormatHandler {
|
|
14
14
|
readonly name = "FLAC";
|
|
15
15
|
readonly supportedMimeTypes: readonly ["audio/flac", "audio/x-flac"];
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* We embed signatures using an APPLICATION block (type = 2) with 4-byte
|
|
10
10
|
* application ID "MAJK" followed by the signature JSON payload.
|
|
11
11
|
*/
|
|
12
|
-
import { concatBytes, textDecode, textEncode } from "../utils";
|
|
12
|
+
import { concatBytes, textDecode, textEncode } from "../utils.js";
|
|
13
13
|
const FLAC_MAGIC = textEncode("fLaC");
|
|
14
14
|
const APPLICATION_ID = textEncode("MAJK"); // 4-byte custom Application ID
|
|
15
15
|
var FlacBlockType;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { PdfHandler } from "./pdf";
|
|
2
|
-
export { PngHandler } from "./png";
|
|
3
|
-
export { JpegHandler } from "./jpeg";
|
|
4
|
-
export { WavHandler } from "./wav";
|
|
5
|
-
export { Mp3Handler } from "./mp3";
|
|
6
|
-
export { Mp4Handler } from "./mp4";
|
|
7
|
-
export { FlacHandler } from "./flac";
|
|
8
|
-
export { MkvHandler } from "./mkv";
|
|
9
|
-
export { OfficeHandler } from "./office";
|
|
10
|
-
export { TextHandler } from "./text";
|
|
11
|
-
export { MsixHandler } from "./msix";
|
|
1
|
+
export { PdfHandler } from "./pdf.js";
|
|
2
|
+
export { PngHandler } from "./png.js";
|
|
3
|
+
export { JpegHandler } from "./jpeg.js";
|
|
4
|
+
export { WavHandler } from "./wav.js";
|
|
5
|
+
export { Mp3Handler } from "./mp3.js";
|
|
6
|
+
export { Mp4Handler } from "./mp4.js";
|
|
7
|
+
export { FlacHandler } from "./flac.js";
|
|
8
|
+
export { MkvHandler } from "./mkv.js";
|
|
9
|
+
export { OfficeHandler } from "./office.js";
|
|
10
|
+
export { TextHandler } from "./text.js";
|
|
11
|
+
export { MsixHandler } from "./msix.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { PdfHandler } from "./pdf";
|
|
2
|
-
export { PngHandler } from "./png";
|
|
3
|
-
export { JpegHandler } from "./jpeg";
|
|
4
|
-
export { WavHandler } from "./wav";
|
|
5
|
-
export { Mp3Handler } from "./mp3";
|
|
6
|
-
export { Mp4Handler } from "./mp4";
|
|
7
|
-
export { FlacHandler } from "./flac";
|
|
8
|
-
export { MkvHandler } from "./mkv";
|
|
9
|
-
export { OfficeHandler } from "./office";
|
|
10
|
-
export { TextHandler } from "./text";
|
|
11
|
-
export { MsixHandler } from "./msix";
|
|
1
|
+
export { PdfHandler } from "./pdf.js";
|
|
2
|
+
export { PngHandler } from "./png.js";
|
|
3
|
+
export { JpegHandler } from "./jpeg.js";
|
|
4
|
+
export { WavHandler } from "./wav.js";
|
|
5
|
+
export { Mp3Handler } from "./mp3.js";
|
|
6
|
+
export { Mp4Handler } from "./mp4.js";
|
|
7
|
+
export { FlacHandler } from "./flac.js";
|
|
8
|
+
export { MkvHandler } from "./mkv.js";
|
|
9
|
+
export { OfficeHandler } from "./office.js";
|
|
10
|
+
export { TextHandler } from "./text.js";
|
|
11
|
+
export { MsixHandler } from "./msix.js";
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Falls back to Tier-2 trailer if segment injection fails.
|
|
12
12
|
*/
|
|
13
|
-
import { FormatHandler } from "../../types";
|
|
13
|
+
import { FormatHandler } from "../../types.js";
|
|
14
14
|
export declare class JpegHandler implements FormatHandler {
|
|
15
15
|
readonly name = "JPEG";
|
|
16
16
|
readonly supportedMimeTypes: readonly ["image/jpeg", "image/jpg"];
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Falls back to Tier-2 trailer if segment injection fails.
|
|
12
12
|
*/
|
|
13
|
-
import { concatBytes, textDecode, textEncode } from "../utils";
|
|
13
|
+
import { concatBytes, textDecode, textEncode } from "../utils.js";
|
|
14
14
|
const JPEG_SOI = new Uint8Array([0xff, 0xd8]);
|
|
15
15
|
const APP15_MARKER = new Uint8Array([0xff, 0xef]);
|
|
16
16
|
const MAJIK_IDENTIFIER = textEncode("MAJIK\0");
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* If you need native MKV Tags element embedding, this handler can be extended
|
|
12
12
|
* with a full EBML parser. For now, the Tier-2 trailer is the primary store.
|
|
13
13
|
*/
|
|
14
|
-
import { FormatHandler } from "../../types";
|
|
14
|
+
import { FormatHandler } from "../../types.js";
|
|
15
15
|
export declare class MkvHandler implements FormatHandler {
|
|
16
16
|
readonly name = "MKV/WebM";
|
|
17
17
|
readonly supportedMimeTypes: readonly ["video/x-matroska", "video/webm", "audio/webm", "audio/x-matroska"];
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* If you need native MKV Tags element embedding, this handler can be extended
|
|
12
12
|
* with a full EBML parser. For now, the Tier-2 trailer is the primary store.
|
|
13
13
|
*/
|
|
14
|
-
import { appendTrailer, extractTrailer } from "../utils";
|
|
14
|
+
import { appendTrailer, extractTrailer } from "../utils.js";
|
|
15
15
|
const EBML_MAGIC = new Uint8Array([0x1a, 0x45, 0xdf, 0xa3]);
|
|
16
16
|
export class MkvHandler {
|
|
17
17
|
name = "MKV/WebM";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* ID3v2 header:
|
|
14
14
|
* "ID3" [1B major_ver=3][1B revision=0][1B flags=0][4B syncsafe_size]
|
|
15
15
|
*/
|
|
16
|
-
import { FormatHandler } from "../../types";
|
|
16
|
+
import { FormatHandler } from "../../types.js";
|
|
17
17
|
export declare class Mp3Handler implements FormatHandler {
|
|
18
18
|
readonly name = "MP3";
|
|
19
19
|
readonly supportedMimeTypes: readonly ["audio/mpeg", "audio/mp3"];
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* ID3v2 header:
|
|
14
14
|
* "ID3" [1B major_ver=3][1B revision=0][1B flags=0][4B syncsafe_size]
|
|
15
15
|
*/
|
|
16
|
-
import { ID3_TXXX_DESCRIPTION } from "../constants";
|
|
17
|
-
import { concatBytes, textDecode, textEncode } from "../utils";
|
|
16
|
+
import { ID3_TXXX_DESCRIPTION } from "../constants.js";
|
|
17
|
+
import { concatBytes, textDecode, textEncode } from "../utils.js";
|
|
18
18
|
export class Mp3Handler {
|
|
19
19
|
name = "MP3";
|
|
20
20
|
supportedMimeTypes = ["audio/mpeg", "audio/mp3"];
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* If udta doesn't exist in moov, we create it.
|
|
15
15
|
* If moov doesn't exist (fragmented MP4), fall through to FallbackHandler.
|
|
16
16
|
*/
|
|
17
|
-
import { FormatHandler } from "../../types";
|
|
17
|
+
import { FormatHandler } from "../../types.js";
|
|
18
18
|
export declare class Mp4Handler implements FormatHandler {
|
|
19
19
|
readonly name = "MP4/MOV";
|
|
20
20
|
readonly supportedMimeTypes: readonly ["video/mp4", "video/quicktime", "audio/mp4", "audio/m4a", "video/x-m4v", "video/m4v"];
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
* If udta doesn't exist in moov, we create it.
|
|
15
15
|
* If moov doesn't exist (fragmented MP4), fall through to FallbackHandler.
|
|
16
16
|
*/
|
|
17
|
-
import { MP4_BOX_TYPE } from "../constants";
|
|
18
|
-
import { concatBytes, readUint32BE, textDecode, textEncode, writeUint32BE, } from "../utils";
|
|
19
|
-
const MAJK_TYPE = textEncode(MP4_BOX_TYPE); // "majk"
|
|
17
|
+
import { MP4_BOX_TYPE } from "../constants.js";
|
|
18
|
+
import { concatBytes, readUint32BE, textDecode, textEncode, writeUint32BE, } from "../utils.js";
|
|
20
19
|
export class Mp4Handler {
|
|
21
20
|
name = "MP4/MOV";
|
|
22
21
|
supportedMimeTypes = [
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* No canonical ZIP reconstruction is performed.
|
|
24
24
|
*/
|
|
25
|
-
import { FormatHandler } from "../../types";
|
|
25
|
+
import { FormatHandler } from "../../types.js";
|
|
26
26
|
export declare class MsixHandler implements FormatHandler {
|
|
27
27
|
readonly name = "MSIX / AppX";
|
|
28
28
|
readonly supportedMimeTypes: readonly string[];
|
|
@@ -24,11 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { unzipSync } from "fflate";
|
|
26
26
|
const MSIX_MIME_TYPES = ["application/msix", "application/appx"];
|
|
27
|
-
const
|
|
28
|
-
const MSIX_REQUIRED_ENTRIES = new Set([
|
|
29
|
-
"AppxManifest.xml",
|
|
30
|
-
"AppxBlockMap.xml",
|
|
31
|
-
]);
|
|
27
|
+
const MSIX_REQUIRED_ENTRIES = new Set(["AppxManifest.xml", "AppxBlockMap.xml"]);
|
|
32
28
|
export class MsixHandler {
|
|
33
29
|
name = "MSIX / AppX";
|
|
34
30
|
supportedMimeTypes = MSIX_MIME_TYPES;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Uses fflate for pure-JS ZIP manipulation (works in browser + Node).
|
|
14
14
|
*/
|
|
15
|
-
import { FormatHandler } from "../../types";
|
|
15
|
+
import { FormatHandler } from "../../types.js";
|
|
16
16
|
export declare const MAX_UNZIPPED_BYTES: number;
|
|
17
17
|
export declare class OfficeHandler implements FormatHandler {
|
|
18
18
|
readonly name = "Office (DOCX/XLSX/PPTX/ODF)";
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Uses fflate for pure-JS ZIP manipulation (works in browser + Node).
|
|
14
14
|
*/
|
|
15
15
|
import { unzipSync, zipSync, strToU8, strFromU8 } from "fflate";
|
|
16
|
-
import { OFFICE_ZIP_ENTRY } from "../constants";
|
|
17
|
-
import { toZippable } from "../utils";
|
|
16
|
+
import { OFFICE_ZIP_ENTRY } from "../constants.js";
|
|
17
|
+
import { toZippable } from "../utils.js";
|
|
18
18
|
const OFFICE_MIME_TYPES = [
|
|
19
19
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
20
20
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* incremental update placed after a "\n%%MajikSig%%\n" comment line was
|
|
13
13
|
* never hashed on the detached-verification path.
|
|
14
14
|
*/
|
|
15
|
-
import { FormatHandler } from "../../types";
|
|
15
|
+
import { FormatHandler } from "../../types.js";
|
|
16
16
|
export declare class PdfHandler implements FormatHandler {
|
|
17
17
|
readonly name = "PDF";
|
|
18
18
|
readonly supportedMimeTypes: readonly ["application/pdf"];
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* incremental update placed after a "\n%%MajikSig%%\n" comment line was
|
|
13
13
|
* never hashed on the detached-verification path.
|
|
14
14
|
*/
|
|
15
|
-
import { concatBytes, includesBytes, matchesAt } from "../utils";
|
|
15
|
+
import { concatBytes, includesBytes, matchesAt } from "../utils.js";
|
|
16
16
|
const PDF_MAGIC = [0x25, 0x50, 0x44, 0x46]; // %PDF
|
|
17
17
|
const MAGIC = new TextEncoder().encode("\n%%MajikSig%%\n");
|
|
18
18
|
const STRICT_UTF8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Chunk layout:
|
|
9
9
|
* [4B length][4B type "iTXt"][keyword\0][compression_flag][compression_method][lang\0][translated_keyword\0][text][4B CRC]
|
|
10
10
|
*/
|
|
11
|
-
import { FormatHandler } from "../../types";
|
|
11
|
+
import { FormatHandler } from "../../types.js";
|
|
12
12
|
export declare class PngHandler implements FormatHandler {
|
|
13
13
|
readonly name = "PNG";
|
|
14
14
|
readonly supportedMimeTypes: readonly ["image/png"];
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* Chunk layout:
|
|
9
9
|
* [4B length][4B type "iTXt"][keyword\0][compression_flag][compression_method][lang\0][translated_keyword\0][text][4B CRC]
|
|
10
10
|
*/
|
|
11
|
-
import { PNG_KEYWORD } from "../constants";
|
|
12
|
-
import { concatBytes, crc32, readUint32BE, textDecode, textEncode, writeUint32BE, } from "../utils";
|
|
11
|
+
import { PNG_KEYWORD } from "../constants.js";
|
|
12
|
+
import { concatBytes, crc32, readUint32BE, textDecode, textEncode, writeUint32BE, } from "../utils.js";
|
|
13
13
|
const PNG_SIGNATURE = new Uint8Array([
|
|
14
14
|
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
|
|
15
15
|
]);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* extract() and strip() share one parser (split()) so they cannot disagree.
|
|
22
22
|
*/
|
|
23
|
-
import { FormatHandler } from "../../types";
|
|
23
|
+
import { FormatHandler } from "../../types.js";
|
|
24
24
|
export declare class TextHandler implements FormatHandler {
|
|
25
25
|
readonly name = "Text/Markup/Source";
|
|
26
26
|
readonly supportedMimeTypes: readonly string[];
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*
|
|
21
21
|
* extract() and strip() share one parser (split()) so they cannot disagree.
|
|
22
22
|
*/
|
|
23
|
-
import { concatBytes, includesBytes, matchesAt, textDecode, textEncode, } from "../utils";
|
|
23
|
+
import { concatBytes, includesBytes, matchesAt, textDecode, textEncode, } from "../utils.js";
|
|
24
24
|
const BEGIN_MARKER = "<!-- MAJIK-SIGNATURE-BEGIN -->";
|
|
25
25
|
const END_MARKER = "<!-- MAJIK-SIGNATURE-END -->";
|
|
26
26
|
const BEGIN_BYTES = textEncode(BEGIN_MARKER);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* "LIST" [4B size] "INFO"
|
|
13
13
|
* "ISIG" [4B size] [signature JSON, null-padded to even length]
|
|
14
14
|
*/
|
|
15
|
-
import { FormatHandler } from "../../types";
|
|
15
|
+
import { FormatHandler } from "../../types.js";
|
|
16
16
|
export declare class WavHandler implements FormatHandler {
|
|
17
17
|
readonly name = "WAV";
|
|
18
18
|
readonly supportedMimeTypes: readonly ["audio/wav", "audio/wave", "audio/x-wav"];
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* "LIST" [4B size] "INFO"
|
|
13
13
|
* "ISIG" [4B size] [signature JSON, null-padded to even length]
|
|
14
14
|
*/
|
|
15
|
-
import { concatBytes, readUint32LE, textDecode, textEncode, writeUint32LE, } from "../utils";
|
|
15
|
+
import { concatBytes, readUint32LE, textDecode, textEncode, writeUint32LE, } from "../utils.js";
|
|
16
16
|
const RIFF_MAGIC = textEncode("RIFF");
|
|
17
17
|
const WAVE_MAGIC = textEncode("WAVE");
|
|
18
18
|
const LIST_TYPE = textEncode("LIST");
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
* The public `MajikSignature` class exposes the higher-level user-facing API.
|
|
36
36
|
*/
|
|
37
37
|
import type { ISODateString, MajikKey } from "@majikah/majik-key";
|
|
38
|
-
import type { BatchFileInput, BatchSignOptions, BatchSignResult, BatchVerifyInput, BatchVerifyOptions, BatchVerifySummary, EmbedOptions, EmbedResult, EnvelopeInfo, EnvelopeInput, ExpectedSigner, ExtractOptions, ExtractResult, FileChainVerification, FileLike, FileVerifyResult, MajikSignatureJSON, MajikSignerPublicKeys, MajikTimestamp, RevisionSetVerification, SealInfo, SealVerificationResult, SignatoriesFilter, SignatoriesResult, SignOptions, VerificationResult } from "../../core/types";
|
|
39
|
-
import { MajikSignatureEnvelope } from "../../core/envelope";
|
|
40
|
-
import { FormatHandlerRegistry } from "./registry";
|
|
41
|
-
import { MajikChainAnchor } from "../../anchor/types";
|
|
42
|
-
import { MajikSignatureMap } from "../mjksmap";
|
|
43
|
-
import { SignatureOrderResult, VerifySignatureOrderOptions } from "../order";
|
|
38
|
+
import type { BatchFileInput, BatchSignOptions, BatchSignResult, BatchVerifyInput, BatchVerifyOptions, BatchVerifySummary, EmbedOptions, EmbedResult, EnvelopeInfo, EnvelopeInput, ExpectedSigner, ExtractOptions, ExtractResult, FileChainVerification, FileLike, FileVerifyResult, MajikSignatureJSON, MajikSignerPublicKeys, MajikTimestamp, RevisionSetVerification, SealInfo, SealVerificationResult, SignatoriesFilter, SignatoriesResult, SignOptions, VerificationResult } from "../../core/types.js";
|
|
39
|
+
import { MajikSignatureEnvelope } from "../../core/envelope.js";
|
|
40
|
+
import { FormatHandlerRegistry } from "./registry.js";
|
|
41
|
+
import { MajikChainAnchor } from "../../anchor/types.js";
|
|
42
|
+
import { MajikSignatureMap } from "../mjksmap.js";
|
|
43
|
+
import { SignatureOrderResult, VerifySignatureOrderOptions } from "../order.js";
|
|
44
44
|
/**
|
|
45
45
|
* Minimal instance-level bridge between `MajikSignatureEmbed` and the concrete
|
|
46
46
|
* `MajikSignature` class.
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
* This module is primarily an implementation-level orchestration surface.
|
|
35
35
|
* The public `MajikSignature` class exposes the higher-level user-facing API.
|
|
36
36
|
*/
|
|
37
|
-
import { MajikSignatureEnvelope } from "../../core/envelope";
|
|
38
|
-
import { FormatHandlerRegistry } from "./registry";
|
|
39
|
-
import { bytesToBlob, detectMimeType, normalizeToBlob, normalizeToBytes, } from "./utils";
|
|
37
|
+
import { MajikSignatureEnvelope } from "../../core/envelope.js";
|
|
38
|
+
import { FormatHandlerRegistry } from "./registry.js";
|
|
39
|
+
import { bytesToBlob, detectMimeType, normalizeToBlob, normalizeToBytes, } from "./utils.js";
|
|
40
40
|
import { PdfHandler, PngHandler, FlacHandler, JpegHandler, MkvHandler, Mp3Handler, Mp4Handler, OfficeHandler, TextHandler, WavHandler, MsixHandler, } from "./handlers";
|
|
41
|
-
import { FallbackHandler } from "./fallback";
|
|
42
|
-
import { base64ToBytes, bytesToBase64, hashContent } from "../hash";
|
|
43
|
-
import { MajikSignatureError, MajikSignatureValidationError } from "../errors";
|
|
44
|
-
import { MajikSignatureMap } from "../mjksmap";
|
|
45
|
-
import { verifySignatureOrder, } from "../order";
|
|
46
|
-
import { assertCanonical, noSignatureReason, prepareDetachedBytes, } from "./canonical";
|
|
41
|
+
import { FallbackHandler } from "./fallback.js";
|
|
42
|
+
import { base64ToBytes, bytesToBase64, hashContent } from "../hash.js";
|
|
43
|
+
import { MajikSignatureError, MajikSignatureValidationError } from "../errors.js";
|
|
44
|
+
import { MajikSignatureMap } from "../mjksmap.js";
|
|
45
|
+
import { verifySignatureOrder, } from "../order.js";
|
|
46
|
+
import { assertCanonical, noSignatureReason, prepareDetachedBytes, } from "./canonical.js";
|
|
47
47
|
// ─── Registry ─────────────────────────────────────────────────────────────────
|
|
48
48
|
const DEFAULT_REGISTRY = new FormatHandlerRegistry()
|
|
49
49
|
.register(new PdfHandler())
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Handlers are tried in registration order; the first canHandle() match wins.
|
|
6
6
|
* FallbackHandler is always last.
|
|
7
7
|
*/
|
|
8
|
-
import { FormatHandler } from "../types";
|
|
8
|
+
import { FormatHandler } from "../types.js";
|
|
9
9
|
export declare class FormatHandlerRegistry {
|
|
10
10
|
private readonly _handlers;
|
|
11
11
|
private readonly _fallback;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Handlers are tried in registration order; the first canHandle() match wins.
|
|
6
6
|
* FallbackHandler is always last.
|
|
7
7
|
*/
|
|
8
|
-
import { FallbackHandler } from "./fallback";
|
|
8
|
+
import { FallbackHandler } from "./fallback.js";
|
|
9
9
|
export class FormatHandlerRegistry {
|
|
10
10
|
_handlers = [];
|
|
11
11
|
_fallback = new FallbackHandler();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* utils.ts — Byte manipulation, MIME sniffing, and encoding helpers
|
|
3
3
|
*/
|
|
4
|
-
import { FileLike } from "../types";
|
|
4
|
+
import { FileLike } from "../types.js";
|
|
5
5
|
/** Normalize any supported input into raw bytes, defensively copied. */
|
|
6
6
|
export declare function normalizeToBytes(input: FileLike): Promise<Uint8Array>;
|
|
7
7
|
export declare function normalizeToBlob(input: FileLike, mimeType?: string): Blob;
|
package/dist/core/embed/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* utils.ts — Byte manipulation, MIME sniffing, and encoding helpers
|
|
3
3
|
*/
|
|
4
|
-
import { MajikSignatureValidationError } from "../errors";
|
|
5
|
-
import { CANONICAL_MTIME, TRAILER_MAGIC, TRAILER_SUFFIX_LENGTH, } from "./constants";
|
|
4
|
+
import { MajikSignatureValidationError } from "../errors.js";
|
|
5
|
+
import { CANONICAL_MTIME, TRAILER_MAGIC, TRAILER_SUFFIX_LENGTH, } from "./constants.js";
|
|
6
6
|
/** Normalize any supported input into raw bytes, defensively copied. */
|
|
7
7
|
export async function normalizeToBytes(input) {
|
|
8
8
|
if (input instanceof Uint8Array)
|
package/dist/core/envelope.d.ts
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* counterpart — same relationship as MajikSignatureJSON / MajikSignature.
|
|
19
19
|
*/
|
|
20
20
|
import type { MajikKey } from "@majikah/majik-key";
|
|
21
|
-
import type { EnvelopeInfo, EnvelopeInput, ExpectedSigner, FileLike, FileVersion, MajikSignatureEnvelopeJSON, MajikSignatureJSON, SealInfo, SealVerificationResult, SignatoriesFilter, SignatoriesResult, SignatoryInfo } from "./types";
|
|
22
|
-
import type { MajikChainAnchor } from "../anchor/types";
|
|
21
|
+
import type { EnvelopeInfo, EnvelopeInput, ExpectedSigner, FileLike, FileVersion, MajikSignatureEnvelopeJSON, MajikSignatureJSON, SealInfo, SealVerificationResult, SignatoriesFilter, SignatoriesResult, SignatoryInfo } from "./types.js";
|
|
22
|
+
import type { MajikChainAnchor } from "../anchor/types.js";
|
|
23
23
|
/**
|
|
24
24
|
* Result of checking whether a key matches the envelope's signing allowlist.
|
|
25
25
|
*
|
package/dist/core/envelope.js
CHANGED
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { sha3_512 } from "@noble/hashes/sha3.js";
|
|
21
21
|
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
22
|
-
import { MAJIK_ENVELOPE_VERSION, MAJIK_SEAL_DOMAIN, MJKSIG_HEADER_LEN, MJKSIG_MAGIC, MJKSIG_MAGIC_LEN, MJKSIG_MEDIA_TYPE, MJKSIG_SUPPORTED_VERSIONS, MJKSIG_VERSION, } from "./constants";
|
|
23
|
-
import { MajikSignatureAllowlistError, MajikSignatureError, MajikSignatureKeyError, MajikSignatureSerializationError, MajikSignatureValidationError, } from "./errors";
|
|
24
|
-
import { hashContent, bytesToBase64 } from "./hash";
|
|
25
|
-
import { normalizeToBytes } from "./embed/utils";
|
|
22
|
+
import { MAJIK_ENVELOPE_VERSION, MAJIK_SEAL_DOMAIN, MJKSIG_HEADER_LEN, MJKSIG_MAGIC, MJKSIG_MAGIC_LEN, MJKSIG_MEDIA_TYPE, MJKSIG_SUPPORTED_VERSIONS, MJKSIG_VERSION, } from "./constants.js";
|
|
23
|
+
import { MajikSignatureAllowlistError, MajikSignatureError, MajikSignatureKeyError, MajikSignatureSerializationError, MajikSignatureValidationError, } from "./errors.js";
|
|
24
|
+
import { hashContent, bytesToBase64 } from "./hash.js";
|
|
25
|
+
import { normalizeToBytes } from "./embed/utils.js";
|
|
26
26
|
// ─── MajikSignatureEnvelope ────────────────────────────────────────────────────
|
|
27
27
|
/**
|
|
28
28
|
* Immutable, behavior-rich representation of a Majik Signature multi-signer
|
package/dist/core/mjksmap.d.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* batch are legitimate and must not collide. contentHash is retained
|
|
13
13
|
* per-entry as an integrity check and as a secondary lookup index.
|
|
14
14
|
*/
|
|
15
|
-
import { MajikSignatureEnvelope } from "./envelope";
|
|
16
|
-
import type { MjksMapEntry, MjksMapFindResult, MjksMapJSON, MjksMapResolveResult } from "./types";
|
|
15
|
+
import { MajikSignatureEnvelope } from "./envelope.js";
|
|
16
|
+
import type { MjksMapEntry, MjksMapFindResult, MjksMapJSON, MjksMapResolveResult } from "./types.js";
|
|
17
17
|
export declare class MajikSignatureMap {
|
|
18
18
|
#private;
|
|
19
19
|
private readonly _version;
|
package/dist/core/mjksmap.js
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* batch are legitimate and must not collide. contentHash is retained
|
|
13
13
|
* per-entry as an integrity check and as a secondary lookup index.
|
|
14
14
|
*/
|
|
15
|
-
import { MajikSignatureSerializationError, MajikSignatureValidationError, } from "./errors";
|
|
16
|
-
import { hashContent, bytesToBase64 } from "./hash";
|
|
17
|
-
import { MajikSignatureEnvelope } from "./envelope";
|
|
18
|
-
import { MJKSMAP_HEADER_LEN, MJKSMAP_MAGIC, MJKSMAP_MAGIC_LEN, MJKSMAP_MEDIA_TYPE, MJKSMAP_SUPPORTED_VERSIONS, MJKSMAP_VERSION, } from "./constants";
|
|
15
|
+
import { MajikSignatureSerializationError, MajikSignatureValidationError, } from "./errors.js";
|
|
16
|
+
import { hashContent, bytesToBase64 } from "./hash.js";
|
|
17
|
+
import { MajikSignatureEnvelope } from "./envelope.js";
|
|
18
|
+
import { MJKSMAP_HEADER_LEN, MJKSMAP_MAGIC, MJKSMAP_MAGIC_LEN, MJKSMAP_MEDIA_TYPE, MJKSMAP_SUPPORTED_VERSIONS, MJKSMAP_VERSION, } from "./constants.js";
|
|
19
19
|
// ─── Path normalization ────────────────────────────────────────────────────────
|
|
20
20
|
/**
|
|
21
21
|
* Normalize a path for use as a map key: forward slashes, no leading slash,
|
package/dist/core/order.d.ts
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* a caveat when order was decided using a self-reported clock.
|
|
18
18
|
*/
|
|
19
19
|
import type { MajikKey } from "@majikah/majik-key";
|
|
20
|
-
import type { MajikSignatureEnvelope } from "./envelope";
|
|
21
|
-
import type { ExpectedSigner, MajikSignatureJSON, MajikSignerPublicKeys, VerificationResult } from "./types";
|
|
20
|
+
import type { MajikSignatureEnvelope } from "./envelope.js";
|
|
21
|
+
import type { ExpectedSigner, MajikSignatureJSON, MajikSignerPublicKeys, VerificationResult } from "./types.js";
|
|
22
22
|
export type TimestampSource = "tsa" | "self-reported";
|
|
23
23
|
export interface SignerOrderStatus {
|
|
24
24
|
signerId: string;
|
package/dist/core/order.js
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* - Every result surfaces `usesUnattestedTimestamp` so callers can show
|
|
17
17
|
* a caveat when order was decided using a self-reported clock.
|
|
18
18
|
*/
|
|
19
|
-
import { MajikSignatureKeyError, MajikSignatureValidationError, } from "./errors";
|
|
20
|
-
import { base64ToBytes, bytesToBase64 } from "./hash";
|
|
19
|
+
import { MajikSignatureKeyError, MajikSignatureValidationError, } from "./errors.js";
|
|
20
|
+
import { base64ToBytes, bytesToBase64 } from "./hash.js";
|
|
21
21
|
// ─── Normalization ─────────────────────────────────────────────────────────
|
|
22
22
|
function isExpectedSignerShape(v) {
|
|
23
23
|
return typeof v.edPublicKey === "string";
|
package/dist/core/payload.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* attestations cannot be confused with ordinary content signatures.
|
|
21
21
|
*/
|
|
22
22
|
import { ISODateString, MajikKeyFingerprint } from "@majikah/majik-key";
|
|
23
|
-
import { MajikTSAPayload } from "./types";
|
|
23
|
+
import { MajikTSAPayload } from "./types.js";
|
|
24
24
|
/**
|
|
25
25
|
* Fields used to construct a canonical Majik Signature signing payload.
|
|
26
26
|
*
|
package/dist/core/payload.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* The TSA payload uses a separate domain (`MAJIK_TSA_DOMAIN`) so timestamp
|
|
20
20
|
* attestations cannot be confused with ordinary content signatures.
|
|
21
21
|
*/
|
|
22
|
-
import { MAJIK_SIGNATURE_DOMAIN, MAJIK_SIGNATURE_VERSION, MAJIK_TSA_DOMAIN, } from "./constants";
|
|
22
|
+
import { MAJIK_SIGNATURE_DOMAIN, MAJIK_SIGNATURE_VERSION, MAJIK_TSA_DOMAIN, } from "./constants.js";
|
|
23
23
|
/**
|
|
24
24
|
* Build the canonical byte payload signed by both Majik Signature algorithms.
|
|
25
25
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* The JSON object is sorted by key for determinism. The string is then
|
|
14
14
|
* UTF-8 encoded to produce the final bytes that are signed.
|
|
15
15
|
*/
|
|
16
|
-
import type { ImageSigningPayloadFields } from "./types";
|
|
16
|
+
import type { ImageSigningPayloadFields } from "./types.js";
|
|
17
17
|
/**
|
|
18
18
|
* Build the canonical byte payload that Ed25519 signs.
|
|
19
19
|
* Must be deterministic — same inputs always produce same bytes.
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
* At 0.5 bits/block at Q70: needs ~3600 blocks → ~480x480px minimum
|
|
58
58
|
* Our minimum is 640x640 → comfortable (480 bytes capacity, 113% headroom).
|
|
59
59
|
*/
|
|
60
|
-
import type { ImageSignatureStub } from "./types";
|
|
60
|
+
import type { ImageSignatureStub } from "./types.js";
|
|
61
61
|
declare const STUB_SIZE = 150;
|
|
62
62
|
/**
|
|
63
63
|
* Serialize an ImageSignatureStub to compact binary (150 bytes).
|
|
@@ -74,7 +74,7 @@ export interface MajikSignatureStaticAdapter {
|
|
|
74
74
|
reason?: string;
|
|
75
75
|
}>>;
|
|
76
76
|
}
|
|
77
|
-
import type { ImageSignatureStub, ImageSignOptions } from "./core/types";
|
|
77
|
+
import type { ImageSignatureStub, ImageSignOptions } from "./core/types.js";
|
|
78
78
|
export type VerificationLayer = "both" | "pixel-row" | "dct-only";
|
|
79
79
|
export interface ImageVerificationResult {
|
|
80
80
|
valid: boolean;
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
* 9. Encode output (PNG default)
|
|
36
36
|
*/
|
|
37
37
|
import * as ed25519 from "@stablelib/ed25519";
|
|
38
|
-
import { computePHash, pHashMatches, hammingDistance } from "./core/phash";
|
|
39
|
-
import { dctEmbed, dctExtract, dctCapacity } from "./core/dct-stego";
|
|
40
|
-
import { rsEncode, rsDecode, RS_TOTAL_BYTES } from "./core/reed-solomon";
|
|
41
|
-
import { serializeStub, deserializeStub } from "./core/stub";
|
|
42
|
-
import { buildImageSigningPayload } from "./core/payload";
|
|
43
|
-
import { pixelRowEmbed, pixelRowExtract, pixelRowStrip, } from "./core/pixel-row";
|
|
44
|
-
import { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils";
|
|
38
|
+
import { computePHash, pHashMatches, hammingDistance } from "./core/phash.js";
|
|
39
|
+
import { dctEmbed, dctExtract, dctCapacity } from "./core/dct-stego.js";
|
|
40
|
+
import { rsEncode, rsDecode, RS_TOTAL_BYTES } from "./core/reed-solomon.js";
|
|
41
|
+
import { serializeStub, deserializeStub } from "./core/stub.js";
|
|
42
|
+
import { buildImageSigningPayload } from "./core/payload.js";
|
|
43
|
+
import { pixelRowEmbed, pixelRowExtract, pixelRowStrip, } from "./core/pixel-row.js";
|
|
44
|
+
import { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils.js";
|
|
45
45
|
// ─── Errors ───────────────────────────────────────────────────────────────────
|
|
46
46
|
export class MajikImageSignatureError extends Error {
|
|
47
47
|
constructor(message, cause) {
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
* const { blob } = await MajikImageSignature.sign(imageBlob, key, MajikSignature);
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
export { MajikImageSignature, MajikImageSignatureError, MajikImageCapacityError, } from "./image-signature";
|
|
35
|
-
export type { ImageVerificationResult, VerificationLayer, } from "./image-signature";
|
|
36
|
-
export type { ImageSignatureStub, ImageSignOptions } from "./core/types";
|
|
37
|
-
export { computePHash, hammingDistance, pHashMatches } from "./core/phash";
|
|
38
|
-
export { dctEmbed, dctExtract, dctCapacity } from "./core/dct-stego";
|
|
39
|
-
export { rsEncode, rsDecode, RS_DATA_BYTES, RS_ECC_BYTES, RS_TOTAL_BYTES, } from "./core/reed-solomon";
|
|
40
|
-
export { serializeStub, deserializeStub, STUB_SIZE } from "./core/stub";
|
|
41
|
-
export { buildImageSigningPayload } from "./core/payload";
|
|
42
|
-
export { pixelRowEmbed, pixelRowExtract, pixelRowStrip, pixelRowHasSignature, } from "./core/pixel-row";
|
|
43
|
-
export { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils";
|
|
34
|
+
export { MajikImageSignature, MajikImageSignatureError, MajikImageCapacityError, } from "./image-signature.js";
|
|
35
|
+
export type { ImageVerificationResult, VerificationLayer, } from "./image-signature.js";
|
|
36
|
+
export type { ImageSignatureStub, ImageSignOptions } from "./core/types.js";
|
|
37
|
+
export { computePHash, hammingDistance, pHashMatches } from "./core/phash.js";
|
|
38
|
+
export { dctEmbed, dctExtract, dctCapacity } from "./core/dct-stego.js";
|
|
39
|
+
export { rsEncode, rsDecode, RS_DATA_BYTES, RS_ECC_BYTES, RS_TOTAL_BYTES, } from "./core/reed-solomon.js";
|
|
40
|
+
export { serializeStub, deserializeStub, STUB_SIZE } from "./core/stub.js";
|
|
41
|
+
export { buildImageSigningPayload } from "./core/payload.js";
|
|
42
|
+
export { pixelRowEmbed, pixelRowExtract, pixelRowStrip, pixelRowHasSignature, } from "./core/pixel-row.js";
|
|
43
|
+
export { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils.js";
|
package/dist/core/stamp/index.js
CHANGED
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
// ── Primary class ─────────────────────────────────────────────────────────────
|
|
35
|
-
export { MajikImageSignature, MajikImageSignatureError, MajikImageCapacityError, } from "./image-signature";
|
|
35
|
+
export { MajikImageSignature, MajikImageSignatureError, MajikImageCapacityError, } from "./image-signature.js";
|
|
36
36
|
// ── Advanced / testing primitives ─────────────────────────────────────────────
|
|
37
37
|
//
|
|
38
38
|
// These are intentionally not re-exported from the main majik-signature index.
|
|
39
39
|
// Import from '@majikah/majik-signature/stamp' if you need them directly.
|
|
40
|
-
export { computePHash, hammingDistance, pHashMatches } from "./core/phash";
|
|
41
|
-
export { dctEmbed, dctExtract, dctCapacity } from "./core/dct-stego";
|
|
42
|
-
export { rsEncode, rsDecode, RS_DATA_BYTES, RS_ECC_BYTES, RS_TOTAL_BYTES, } from "./core/reed-solomon";
|
|
43
|
-
export { serializeStub, deserializeStub, STUB_SIZE } from "./core/stub";
|
|
44
|
-
export { buildImageSigningPayload } from "./core/payload";
|
|
45
|
-
export { pixelRowEmbed, pixelRowExtract, pixelRowStrip, pixelRowHasSignature, } from "./core/pixel-row";
|
|
46
|
-
export { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils";
|
|
40
|
+
export { computePHash, hammingDistance, pHashMatches } from "./core/phash.js";
|
|
41
|
+
export { dctEmbed, dctExtract, dctCapacity } from "./core/dct-stego.js";
|
|
42
|
+
export { rsEncode, rsDecode, RS_DATA_BYTES, RS_ECC_BYTES, RS_TOTAL_BYTES, } from "./core/reed-solomon.js";
|
|
43
|
+
export { serializeStub, deserializeStub, STUB_SIZE } from "./core/stub.js";
|
|
44
|
+
export { buildImageSigningPayload } from "./core/payload.js";
|
|
45
|
+
export { pixelRowEmbed, pixelRowExtract, pixelRowStrip, pixelRowHasSignature, } from "./core/pixel-row.js";
|
|
46
|
+
export { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils.js";
|
package/dist/core/types.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* inspect the implementation when working with IntelliSense or generated docs.
|
|
8
8
|
*/
|
|
9
9
|
import type { ISODateString, MajikKeyFingerprint } from "@majikah/majik-key";
|
|
10
|
-
import type { MajikChainAnchor } from "../anchor/types";
|
|
11
|
-
import type { ContentType } from "./constants";
|
|
12
|
-
import type { MajikSignatureEnvelope } from "./envelope";
|
|
10
|
+
import type { MajikChainAnchor } from "../anchor/types.js";
|
|
11
|
+
import type { ContentType } from "./constants.js";
|
|
12
|
+
import type { MajikSignatureEnvelope } from "./envelope.js";
|
|
13
13
|
/** Standard content-type constants exposed by Majik Signature. */
|
|
14
14
|
export type { ContentType };
|
|
15
15
|
/**
|
package/dist/core/validator.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Input validation and assertion helpers for MajikSignature.
|
|
4
4
|
*/
|
|
5
5
|
import { ISODateString } from "@majikah/majik-key";
|
|
6
|
-
import type { ExpectedSigner, MajikSignatureJSON, MajikSignerPublicKeys, MajikTimestamp, MajikTSAPayload, MultiSigEnvelope } from "./types";
|
|
6
|
+
import type { ExpectedSigner, MajikSignatureJSON, MajikSignerPublicKeys, MajikTimestamp, MajikTSAPayload, MultiSigEnvelope } from "./types.js";
|
|
7
7
|
export declare class MajikSignatureValidator {
|
|
8
8
|
static assert(condition: unknown, message: string, field?: string): asserts condition;
|
|
9
9
|
static assertDefined<T>(value: T | undefined | null, field: string): asserts value is T;
|
package/dist/core/validator.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* validator.ts
|
|
3
3
|
* Input validation and assertion helpers for MajikSignature.
|
|
4
4
|
*/
|
|
5
|
-
import { MAJIK_SIGNATURE_VERSION, MAJIK_ENVELOPE_VERSION, MIN_ED_PUBLIC_KEY_B64_LEN, MIN_DSA_PUBLIC_KEY_B64_LEN, MIN_SIGNATURE_B64_LEN, CONTENT_HASH_B64_LEN, ALLOWLIST_HASH_B64_LEN, SEAL_HASH_HEX_LEN, } from "./constants";
|
|
6
|
-
import { MajikSignatureValidationError, MajikSignatureKeyError, } from "./errors";
|
|
5
|
+
import { MAJIK_SIGNATURE_VERSION, MAJIK_ENVELOPE_VERSION, MIN_ED_PUBLIC_KEY_B64_LEN, MIN_DSA_PUBLIC_KEY_B64_LEN, MIN_SIGNATURE_B64_LEN, CONTENT_HASH_B64_LEN, ALLOWLIST_HASH_B64_LEN, SEAL_HASH_HEX_LEN, } from "./constants.js";
|
|
6
|
+
import { MajikSignatureValidationError, MajikSignatureKeyError, } from "./errors.js";
|
|
7
7
|
export class MajikSignatureValidator {
|
|
8
8
|
// ── Assertions ──────────────────────────────────────────────────────────────
|
|
9
9
|
static assert(condition, message, field) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* index.ts
|
|
3
3
|
* Public API surface for majik-signature.
|
|
4
4
|
*/
|
|
5
|
-
export { MajikSignature } from "./majik-signature";
|
|
6
|
-
export type * from "./core/types";
|
|
7
|
-
export * from "./core/errors";
|
|
8
|
-
export * from "./core/constants";
|
|
5
|
+
export { MajikSignature } from "./majik-signature.js";
|
|
6
|
+
export type * from "./core/types.js";
|
|
7
|
+
export * from "./core/errors.js";
|
|
8
|
+
export * from "./core/constants.js";
|
|
9
9
|
export * from "./core/embed/handlers";
|
|
10
|
-
export * from "./core/embed/majik-embed";
|
|
11
|
-
export * from "./core/envelope";
|
|
12
|
-
export * from "./core/mjksmap";
|
|
13
|
-
export * from "./cli";
|
|
10
|
+
export * from "./core/embed/majik-embed.js";
|
|
11
|
+
export * from "./core/envelope.js";
|
|
12
|
+
export * from "./core/mjksmap.js";
|
|
13
|
+
export * from "./cli.js";
|
|
14
14
|
export * from "./cli-core";
|
|
15
|
-
export type * from "./anchor/types";
|
|
16
|
-
export { buildSigningPayload } from "./core/payload";
|
|
17
|
-
export { hashContent, bytesToBase64, base64ToBytes } from "./core/hash";
|
|
18
|
-
export { MajikSignatureValidator } from "./core/validator";
|
|
15
|
+
export type * from "./anchor/types.js";
|
|
16
|
+
export { buildSigningPayload } from "./core/payload.js";
|
|
17
|
+
export { hashContent, bytesToBase64, base64ToBytes } from "./core/hash.js";
|
|
18
|
+
export { MajikSignatureValidator } from "./core/validator.js";
|
package/dist/index.js
CHANGED
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
* Public API surface for majik-signature.
|
|
4
4
|
*/
|
|
5
5
|
// ── Main class ────────────────────────────────────────────────────────────────
|
|
6
|
-
export { MajikSignature } from "./majik-signature";
|
|
6
|
+
export { MajikSignature } from "./majik-signature.js";
|
|
7
7
|
// ── Errors ────────────────────────────────────────────────────────────────────
|
|
8
|
-
export * from "./core/errors";
|
|
8
|
+
export * from "./core/errors.js";
|
|
9
9
|
// ── Constants ─────────────────────────────────────────────────────────────────
|
|
10
|
-
export * from "./core/constants";
|
|
10
|
+
export * from "./core/constants.js";
|
|
11
11
|
export * from "./core/embed/handlers";
|
|
12
|
-
export * from "./core/embed/majik-embed";
|
|
13
|
-
export * from "./core/envelope";
|
|
14
|
-
export * from "./core/mjksmap";
|
|
15
|
-
export * from "./cli";
|
|
12
|
+
export * from "./core/embed/majik-embed.js";
|
|
13
|
+
export * from "./core/envelope.js";
|
|
14
|
+
export * from "./core/mjksmap.js";
|
|
15
|
+
export * from "./cli.js";
|
|
16
16
|
export * from "./cli-core";
|
|
17
17
|
// ── Low-level utilities (opt-in) ──────────────────────────────────────────────
|
|
18
18
|
// These are exported for consumers who want to build on top of the primitives
|
|
19
19
|
// without going through MajikSignature (e.g. streaming hash pipelines,
|
|
20
20
|
// custom envelope formats). Not needed for normal sign/verify usage.
|
|
21
|
-
export { buildSigningPayload } from "./core/payload";
|
|
22
|
-
export { hashContent, bytesToBase64, base64ToBytes } from "./core/hash";
|
|
23
|
-
export { MajikSignatureValidator } from "./core/validator";
|
|
21
|
+
export { buildSigningPayload } from "./core/payload.js";
|
|
22
|
+
export { hashContent, bytesToBase64, base64ToBytes } from "./core/hash.js";
|
|
23
|
+
export { MajikSignatureValidator } from "./core/validator.js";
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
import type { ISODateString, MajikKey, MajikKeyFingerprint } from "@majikah/majik-key";
|
|
7
|
-
import type { BatchFileInput, BatchSignOptions, BatchVerifyInput, BatchVerifyOptions, ED25519Signature, EnvelopeInfo, EnvelopeInput, ExpectedSigner, FileChainVerification, FileLike, FileVerifyResult, MajikSignatureCompactJSON, MajikSignatureEnvelopeJSON, MajikSignatureJSON, MajikSignerPublicKeys, MajikTimestamp, MajikTSARequest, MLDSA87Signature, RevisionCommitmentResult, RevisionSetVerification, SealInfo, SealVerificationResult, SignatoriesFilter, SignatoriesResult, SignatoryInfo, SignOptions, VerificationResult } from "./core/types";
|
|
8
|
-
import { MajikSignatureEmbed } from "./core/embed/majik-embed";
|
|
9
|
-
import type { ImageVerificationResult, ImageSignOptions, ImageSignatureStub } from "./core/stamp";
|
|
10
|
-
import { MajikChainAnchor, MajikChainAnchorMemo } from "./anchor/types";
|
|
11
|
-
import { MajikSignatureEnvelope } from "./core/envelope";
|
|
12
|
-
import { MajikSignatureMap } from "./core/mjksmap";
|
|
13
|
-
import { SignatureOrderResult } from "./core/order";
|
|
7
|
+
import type { BatchFileInput, BatchSignOptions, BatchVerifyInput, BatchVerifyOptions, ED25519Signature, EnvelopeInfo, EnvelopeInput, ExpectedSigner, FileChainVerification, FileLike, FileVerifyResult, MajikSignatureCompactJSON, MajikSignatureEnvelopeJSON, MajikSignatureJSON, MajikSignerPublicKeys, MajikTimestamp, MajikTSARequest, MLDSA87Signature, RevisionCommitmentResult, RevisionSetVerification, SealInfo, SealVerificationResult, SignatoriesFilter, SignatoriesResult, SignatoryInfo, SignOptions, VerificationResult } from "./core/types.js";
|
|
8
|
+
import { MajikSignatureEmbed } from "./core/embed/majik-embed.js";
|
|
9
|
+
import type { ImageVerificationResult, ImageSignOptions, ImageSignatureStub } from "./core/stamp/index.js";
|
|
10
|
+
import { MajikChainAnchor, MajikChainAnchorMemo } from "./anchor/types.js";
|
|
11
|
+
import { MajikSignatureEnvelope } from "./core/envelope.js";
|
|
12
|
+
import { MajikSignatureMap } from "./core/mjksmap.js";
|
|
13
|
+
import { SignatureOrderResult } from "./core/order.js";
|
|
14
14
|
/**
|
|
15
15
|
* Majik Signature
|
|
16
16
|
* ---
|
package/dist/majik-signature.js
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as ed25519 from "@stablelib/ed25519";
|
|
7
7
|
import { ml_dsa87 } from "@noble/post-quantum/ml-dsa.js";
|
|
8
|
-
import { MAJIK_NOTARY_MEMO_DOMAIN, MAJIK_SIGNATURE_VERSION, MAJIK_TIMESTAMP_VERSION, } from "./core/constants";
|
|
9
|
-
import { MajikSignatureError, MajikSignatureKeyError, MajikSignatureVerificationError, MajikSignatureSerializationError, } from "./core/errors";
|
|
10
|
-
import { MajikSignatureValidator } from "./core/validator";
|
|
11
|
-
import { buildSigningPayload, buildTSACanonicalBytes } from "./core/payload";
|
|
12
|
-
import { hashContent, bytesToBase64, base64ToBytes } from "./core/hash";
|
|
13
|
-
import { MajikSignatureEmbed } from "./core/embed/majik-embed";
|
|
8
|
+
import { MAJIK_NOTARY_MEMO_DOMAIN, MAJIK_SIGNATURE_VERSION, MAJIK_TIMESTAMP_VERSION, } from "./core/constants.js";
|
|
9
|
+
import { MajikSignatureError, MajikSignatureKeyError, MajikSignatureVerificationError, MajikSignatureSerializationError, } from "./core/errors.js";
|
|
10
|
+
import { MajikSignatureValidator } from "./core/validator.js";
|
|
11
|
+
import { buildSigningPayload, buildTSACanonicalBytes } from "./core/payload.js";
|
|
12
|
+
import { hashContent, bytesToBase64, base64ToBytes } from "./core/hash.js";
|
|
13
|
+
import { MajikSignatureEmbed } from "./core/embed/majik-embed.js";
|
|
14
14
|
// ── Stamp (image signing) imports ─────────────────────────────────────────────
|
|
15
|
-
import { MajikImageSignature } from "./core/stamp/image-signature";
|
|
16
|
-
import { normalizeExpectedOrder as normalizeExpectedOrderUtil, } from "./core/order";
|
|
15
|
+
import { MajikImageSignature } from "./core/stamp/image-signature.js";
|
|
16
|
+
import { normalizeExpectedOrder as normalizeExpectedOrderUtil, } from "./core/order.js";
|
|
17
17
|
const secureFill = Uint8Array.prototype.fill;
|
|
18
18
|
/**
|
|
19
19
|
* Majik Signature
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@majikah/majik-signature",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Majik Signature is a hybrid post-quantum content signing and verification library for the Majikah ecosystem. Built on top of Majik Key, it provides tamper-proof, forgery-resistant digital signatures for any content format — using a dual-algorithm architecture that combines classical Ed25519 with post-quantum ML-DSA-87 (FIPS-204).",
|
|
5
|
-
"version": "0.8.
|
|
5
|
+
"version": "0.8.2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|