Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/legal-mice-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@contentauth/c2pa-node": patch
---

Fix x86 mac release. Allow custom index.node
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ jobs:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- target: aarch64-apple-darwin
runner: macos-14
runner: macos-latest
- target: x86_64-apple-darwin
runner: macos-13
runner: macos-latest
- target: x86_64-pc-windows-msvc
runner: windows-latest

Expand Down
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Excluded so the Linux binary built during `ci:release` (on ubuntu-latest) doesn't
# ship to users on other platforms. postinstall downloads the correct binary instead.
dist/index.node
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,14 @@ const builder = Builder.new(urlSettings);
- `generate_c2pa_archive` - Whether to generate C2PA archive format

**Note:** Settings are passed as per-instance configuration. There are no global settings that affect all Readers and Builders.


### Build and use custom binary
**Build rust binary:**
```
npm run build:rust
```
**Use custom rust binary:**
```bash
export C2PA_LIBRARY_PATH=<path-to-binary-folder>/index.node
```
6 changes: 3 additions & 3 deletions js-src/Builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ describe("Builder", () => {
const manifest = reader!.json();

// Check that our specific JSON assertion doesn't have escaped characters
const activeManifest = manifest.manifests[manifest.active_manifest!];
const activeManifest = manifest.manifests![manifest.active_manifest!];
const fingerprintAssertionData = activeManifest?.assertions?.find(
(a: any) => a.label === "org.contentauth.fingerprint",
);
Expand Down Expand Up @@ -570,8 +570,8 @@ describe("Builder", () => {
customNumber: 42,
customBool: true,
customObject: {
nested: "value",
count: 123
nested: "value",
count: 123
},
customArray: ["item1", "item2", "item3"]
}
Expand Down
4 changes: 2 additions & 2 deletions js-src/Reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type {
} from "./types.d.ts";

export class Reader implements ReaderInterface {
constructor(private reader: NeonReaderHandle) {}
constructor(private reader: NeonReaderHandle) { }

json(): ManifestStore {
return JSON.parse(getNeonBinary().readerJson.call(this.reader));
Expand Down Expand Up @@ -75,7 +75,7 @@ export class Reader implements ReaderInterface {
return undefined;
}

return manifestStore.manifests[activeManifest];
return manifestStore.manifests?.[activeManifest];
}

getHandle(): NeonReaderHandle {
Expand Down
4 changes: 0 additions & 4 deletions js-src/Trustmark.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ describe("Trustmark", () => {
testImageWidth = imageInfo.width!;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
testImageHeight = imageInfo.height!;
});

beforeEach(async () => {
// Note: In a real test environment, you would need a valid model file
// For now, we'll mock the trustmark creation or handle the case where model doesn't exist
trustmark = await Trustmark.newTrustmark(trustmarkConfig);
});

Expand Down
3 changes: 2 additions & 1 deletion js-src/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ let neon: any = null;
// Get the binary module (loads synchronously on first access)
export function getNeonBinary() {
if (neon === null) {
neon = require("./index.node");
const C2PA_LIBRARY_PATH = process.env.C2PA_LIBRARY_PATH;
neon = require(C2PA_LIBRARY_PATH ?? "./index.node");
}
return neon;
}
Expand Down
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,29 @@
"author": "Colin Murphy <colmurph@adobe.com>",
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.29.6",
"@contentauth/c2pa-types": "^0.4.1",
"@eslint/js": "^9.33.0",
"@changesets/cli": "^2.31.0",
"@contentauth/c2pa-types": "^0.4.3",
"@eslint/js": "^9.39.4",
"@neon-rs/cli": "0.1.82",
"@types/cli-progress": "^3.11.6",
"@types/debug": "^4.1.12",
"@types/debug": "^4.1.13",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.14",
"@types/node": "^22.17.1",
"@types/node": "^22.19.17",
"@types/unzipper": "^0.10.11",
"@typescript-eslint/eslint-plugin": "^8.39.1",
"@typescript-eslint/parser": "^8.39.1",
"@typescript-eslint/eslint-plugin": "^8.59.1",
"@typescript-eslint/parser": "^8.59.1",
"@vitest/ui": "^3.2.4",
"cbor2": "^2.0.1",
"cbor2": "^2.3.0",
"cpy-cli": "^5.0.0",
"eslint": "^9.33.0",
"eslint": "^9.39.4",
"npm-run-all": "^4.1.5",
"rimraf": "^6.0.1",
"sharp": "^0.34.3",
"ts-jest": "^29.4.1",
"typedoc": "^0.28.10",
"typedoc-plugin-markdown": "^4.8.1",
"typescript": "^5.9.2",
"rimraf": "^6.1.3",
"sharp": "^0.34.5",
"ts-jest": "^29.4.9",
"typedoc": "^0.28.19",
"typedoc-plugin-markdown": "^4.11.0",
"typescript": "^5.9.3",
"vitest": "^3.2.4"
},
"keywords": [
Expand All @@ -78,15 +78,15 @@
},
"homepage": "https://github.com/contentauth/c2pa-node-v2#readme",
"dependencies": {
"cargo-cp-artifact": "^0.1.0",
"cli-progress": "^3.2.0",
"debug": "^4.4.1",
"fs-extra": "^11.3.1",
"mkdirp": "^3.0.0",
"cargo-cp-artifact": "^0.1.9",
"cli-progress": "^3.12.0",
"debug": "^4.4.3",
"fs-extra": "^11.3.4",
"mkdirp": "^3.0.1",
"node-fetch": "^3.3.2",
"pkg-dir": "^8.0.0",
"pretty-bytes": "^6.0.0",
"unzipper": "^0.10.0"
"pretty-bytes": "^6.1.1",
"unzipper": "^0.10.14"
},
"packageManager": "pnpm@10.14.0"
}
Loading
Loading