@contentauth/c2pa-node 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ © Copyright 2025 Adobe. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -800,6 +800,6 @@ describe("Builder", () => {
800
800
  const activeManifest = reader2.getActive();
801
801
  expect(activeManifest?.ingredients).toBeDefined();
802
802
  expect(activeManifest?.ingredients?.length).toBe(1);
803
- });
803
+ }, 30000);
804
804
  });
805
805
  });
@@ -48,7 +48,7 @@ describe("Trustmark", () => {
48
48
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
49
49
  testImageHeight = imageInfo.height;
50
50
  trustmark = await Trustmark.newTrustmark(trustmarkConfig);
51
- });
51
+ }, 30000);
52
52
  describe("newTrustmark", () => {
53
53
  it("should create a new trustmark instance with valid config", async () => {
54
54
  // This test will be skipped if the model file doesn't exist
@@ -73,7 +73,7 @@ describe("Trustmark", () => {
73
73
  expect(encodedImage.length).toBeGreaterThan(0);
74
74
  // The encoded image should be different from the original
75
75
  expect(encodedImage).not.toEqual(testImage);
76
- });
76
+ }, 30000);
77
77
  it("should encode a watermark into an image with custom watermark", async () => {
78
78
  const strength = 0.95;
79
79
  const customWatermark = "0101000011001";
@@ -81,15 +81,15 @@ describe("Trustmark", () => {
81
81
  expect(encodedImage).toBeDefined();
82
82
  expect(Buffer.isBuffer(encodedImage)).toBe(true);
83
83
  expect(encodedImage.length).toBeGreaterThan(0);
84
- });
84
+ }, 30000);
85
85
  it("should throw error with invalid strength values", async () => {
86
86
  await expect(trustmark.encode(testImage, -0.1)).rejects.toThrow("Watermark configuration error: strength must be between 0.0 and 1.0");
87
87
  await expect(trustmark.encode(testImage, 1.1)).rejects.toThrow("Watermark configuration error: strength must be between 0.0 and 1.0");
88
- });
88
+ }, 30000);
89
89
  it("should throw error with empty image buffer", async () => {
90
90
  const emptyBuffer = Buffer.alloc(0);
91
91
  await expect(trustmark.encode(emptyBuffer, 0.5)).rejects.toThrow("The image format could not be determined");
92
- });
92
+ }, 30000);
93
93
  });
94
94
  describe("decode", () => {
95
95
  it("should decode a watermark from an encoded image", async () => {
@@ -106,7 +106,7 @@ describe("Trustmark", () => {
106
106
  expect(decodedWatermark.length).toBeGreaterThan(0);
107
107
  // The decoded watermark should match the original
108
108
  expect(decodedWatermark.startsWith(customWatermark)).toBeTruthy();
109
- });
109
+ }, 30000);
110
110
  it("should decode watermark from image with generated watermark", async () => {
111
111
  const strength = 0.75;
112
112
  // Encode with default watermark
@@ -118,14 +118,14 @@ describe("Trustmark", () => {
118
118
  expect(decodedWatermark).toBeDefined();
119
119
  expect(typeof decodedWatermark).toBe("string");
120
120
  expect(decodedWatermark.length).toBeGreaterThan(0);
121
- });
121
+ }, 30000);
122
122
  it("should throw error decoding from original image (no watermark)", async () => {
123
123
  // Try to decode from an image that hasn't been watermarked
124
124
  await expect(trustmark.decode(testImage)).rejects.toThrow("watermark is corrupt or missing");
125
- });
125
+ }, 30000);
126
126
  it("should throw error with empty image buffer", async () => {
127
127
  const emptyBuffer = Buffer.alloc(0);
128
128
  await expect(trustmark.decode(emptyBuffer)).rejects.toThrow("The image format could not be determined");
129
- });
129
+ }, 30000);
130
130
  });
131
131
  });
package/dist/index.node CHANGED
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/contentauth/c2pa-js.git",
6
6
  "directory": "packages/c2pa-node"
7
7
  },
8
- "version": "0.6.0",
8
+ "version": "0.6.1",
9
9
  "description": "Node.js bindings for C2PA",
10
10
  "main": "dist/index.js",
11
11
  "type": "module",
@@ -20,30 +20,10 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "scripts": {
24
- "build": "run-s build:rust build:ts",
25
- "build:debug": "run-s build:rust-debug build:ts",
26
- "build:rust": "pnpm run build:rust-debug --release",
27
- "build:rust-debug": "cargo build --message-format=json-render-diagnostics > cargo.log",
28
- "build:ts": "tsc -b && cpy index.node dist && cpy index.node js-src && cpy --flat js-src/types.d.ts dist/types",
29
- "ci": "run-s build:rust-debug build:ts test",
30
- "clean": "rimraf dist target",
31
- "cross": "pnpm run cross-build --release",
32
- "cross-build": "cross build --message-format=json-render-diagnostics > cross.log",
33
- "debug": "pnpm run cargo-build --",
34
- "lint": "cargo clippy && pnpm eslint",
35
- "postbuild:rust-debug": "neon dist < cargo.log",
36
- "postcross-build": "neon dist -m /target < cross.log",
37
- "postinstall": "node scripts/postinstall.cjs",
38
- "test": "pnpm build:debug && vitest run --config ./vitest.config.ts",
39
- "test:watch": "pnpm build:debug && vitest --config ./vitest.config.ts",
40
- "test:ui": "pnpm build:debug && vitest --ui --config ./vitest.config.ts"
41
- },
42
23
  "author": "Colin Murphy <colmurph@adobe.com>, Austin Le <ale@adobe.com>",
43
24
  "license": "MIT",
44
25
  "devDependencies": {
45
26
  "@changesets/cli": "^2.31.0",
46
- "@contentauth/c2pa-types": "workspace:*",
47
27
  "@eslint/js": "^9.39.4",
48
28
  "@neon-rs/cli": "0.1.82",
49
29
  "@types/cli-progress": "^3.11.6",
@@ -65,7 +45,8 @@
65
45
  "typedoc": "^0.28.19",
66
46
  "typedoc-plugin-markdown": "^4.11.0",
67
47
  "typescript": "^5.9.3",
68
- "vitest": "^3.2.4"
48
+ "vitest": "^3.2.4",
49
+ "@contentauth/c2pa-types": "0.7.1"
69
50
  },
70
51
  "keywords": [
71
52
  "c2pa"
@@ -85,10 +66,28 @@
85
66
  "pretty-bytes": "^6.1.1",
86
67
  "unzipper": "^0.10.14"
87
68
  },
88
- "packageManager": "pnpm@10.15.0",
89
69
  "nx": {
90
70
  "tags": [
91
71
  "lib"
92
72
  ]
73
+ },
74
+ "scripts": {
75
+ "build": "run-s build:rust build:ts",
76
+ "build:debug": "run-s build:rust-debug build:ts",
77
+ "build:rust": "pnpm run build:rust-debug --release",
78
+ "build:rust-debug": "cargo build --message-format=json-render-diagnostics > cargo.log",
79
+ "build:ts": "tsc -b && cpy index.node dist && cpy index.node js-src && cpy --flat js-src/types.d.ts dist/types",
80
+ "ci": "run-s build:rust-debug build:ts test",
81
+ "clean": "rimraf dist target",
82
+ "cross": "pnpm run cross-build --release",
83
+ "cross-build": "cross build --message-format=json-render-diagnostics > cross.log",
84
+ "debug": "pnpm run cargo-build --",
85
+ "lint": "cargo clippy && pnpm eslint",
86
+ "postbuild:rust-debug": "neon dist < cargo.log",
87
+ "postcross-build": "neon dist -m /target < cross.log",
88
+ "postinstall": "node scripts/postinstall.cjs",
89
+ "test": "pnpm build:debug && vitest run --config ./vitest.config.ts",
90
+ "test:watch": "pnpm build:debug && vitest --config ./vitest.config.ts",
91
+ "test:ui": "pnpm build:debug && vitest --ui --config ./vitest.config.ts"
93
92
  }
94
- }
93
+ }