@majikah/majik-signature 0.0.7 → 0.0.8

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.
@@ -45,13 +45,3 @@ export declare function padToMinimum(img: ImagePixels): ImagePixels;
45
45
  * Check if the runtime environment is a browser with Canvas API.
46
46
  */
47
47
  export declare function hasBrowserCanvas(): boolean;
48
- /**
49
- * Node.js version of decodeImage using sharp.
50
- * Only available if 'sharp' is installed.
51
- */
52
- export declare function decodeImageNode(buffer: Buffer | Uint8Array): Promise<ImagePixels>;
53
- /**
54
- * Node.js version of encodeImage using sharp.
55
- * Only available if 'sharp' is installed.
56
- */
57
- export declare function encodeImageNode(pixels: Uint8ClampedArray, width: number, height: number, options?: ImageEncodeOptions): Promise<Buffer>;
@@ -9,7 +9,6 @@
9
9
  * Minimum image dimensions we enforce: 600×600 px.
10
10
  * Smaller images are padded with white before embedding.
11
11
  */
12
- import sharp from "sharp";
13
12
  export const MIN_DIMENSION = 600;
14
13
  // ─── Browser implementation ───────────────────────────────────────────────────
15
14
  /**
@@ -105,45 +104,3 @@ export function hasBrowserCanvas() {
105
104
  return (typeof createImageBitmap !== "undefined" &&
106
105
  typeof OffscreenCanvas !== "undefined");
107
106
  }
108
- // ─── Node.js stubs ────────────────────────────────────────────────────────────
109
- //
110
- // These throw helpful errors if called in a Node.js environment without the
111
- // optional `sharp` dependency. Install sharp for Node.js support:
112
- // npm install sharp
113
- //
114
- // Or use the canvas package:
115
- // npm install canvas
116
- /**
117
- * Node.js version of decodeImage using sharp.
118
- * Only available if 'sharp' is installed.
119
- */
120
- export async function decodeImageNode(buffer) {
121
- const img = sharp(buffer);
122
- const { width, height } = await img.metadata();
123
- if (!width || !height)
124
- throw new Error("Could not read image dimensions");
125
- const rawBuffer = await img.ensureAlpha().raw().toBuffer();
126
- return {
127
- pixels: new Uint8ClampedArray(rawBuffer.buffer),
128
- width,
129
- height,
130
- };
131
- }
132
- /**
133
- * Node.js version of encodeImage using sharp.
134
- * Only available if 'sharp' is installed.
135
- */
136
- export async function encodeImageNode(pixels, width, height, options = {}) {
137
- const mimeType = options.mimeType ?? "image/png";
138
- const quality = Math.round((options.quality ?? 0.92) * 100);
139
- const img = sharp(Buffer.from(pixels.buffer), {
140
- raw: { width, height, channels: 4 },
141
- });
142
- if (mimeType === "image/png")
143
- return img.png().toBuffer();
144
- if (mimeType === "image/jpeg")
145
- return img.jpeg({ quality }).toBuffer();
146
- if (mimeType === "image/webp")
147
- return img.webp({ quality }).toBuffer();
148
- throw new Error(`Unsupported mimeType: ${mimeType}`);
149
- }
@@ -40,4 +40,4 @@ export { rsEncode, rsDecode, RS_DATA_BYTES, RS_ECC_BYTES, RS_TOTAL_BYTES, } from
40
40
  export { serializeStub, deserializeStub, STUB_SIZE } from "./core/stub";
41
41
  export { buildImageSigningPayload } from "./core/payload";
42
42
  export { pixelRowEmbed, pixelRowExtract, pixelRowStrip, pixelRowHasSignature, } from "./core/pixel-row";
43
- export { decodeImage, encodeImage, decodeImageNode, encodeImageNode, padToMinimum, MIN_DIMENSION, } from "./core/image-utils";
43
+ export { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils";
@@ -43,4 +43,4 @@ export { rsEncode, rsDecode, RS_DATA_BYTES, RS_ECC_BYTES, RS_TOTAL_BYTES, } from
43
43
  export { serializeStub, deserializeStub, STUB_SIZE } from "./core/stub";
44
44
  export { buildImageSigningPayload } from "./core/payload";
45
45
  export { pixelRowEmbed, pixelRowExtract, pixelRowStrip, pixelRowHasSignature, } from "./core/pixel-row";
46
- export { decodeImage, encodeImage, decodeImageNode, encodeImageNode, padToMinimum, MIN_DIMENSION, } from "./core/image-utils";
46
+ export { decodeImage, encodeImage, padToMinimum, MIN_DIMENSION, } from "./core/image-utils";
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.0.7",
5
+ "version": "0.0.8",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",
@@ -53,8 +53,7 @@
53
53
  "@stablelib/ed25519": "^2.0.2",
54
54
  "@stablelib/sha256": "^2.0.1",
55
55
  "fflate": "^0.8.2",
56
- "pdf-lib": "^1.17.1",
57
- "sharp": "^0.34.5"
56
+ "pdf-lib": "^1.17.1"
58
57
  },
59
58
  "devDependencies": {
60
59
  "@types/node": "^25.5.0"