@majikah/majik-signature 0.8.1 → 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/dist/cli-core/operations.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
|
@@ -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) {
|
|
@@ -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",
|