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
7 changes: 7 additions & 0 deletions .changeset/tame-otters-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@contentauth/c2pa-node': patch
'@contentauth/c2pa-web': patch
'@contentauth/c2pa-utilities': minor
---

Consolidate the `SigningAlg` type into `@contentauth/c2pa-utilities` (derived from `@contentauth/c2pa-types`'s schema-generated type). Re-use `ManifestAssertionKind` from `@contentauth/c2pa-types` instead of a duplicate hand-written copy. Fix `c2pa-node`'s `package.json` to list `@contentauth/c2pa-types` as a `dependency` rather than a `devDependency`, matching `c2pa-web`.
28 changes: 9 additions & 19 deletions packages/c2pa-node/js-src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,18 @@ import type {
C2paReason,
Ingredient,
Manifest,
ManifestAssertionKind,
ManifestStore,
} from "@contentauth/c2pa-types";
import type { SigningAlg } from "@contentauth/c2pa-utilities";

export type { Action, C2paReason, Ingredient } from "@contentauth/c2pa-types";

/**
* Describes the digital signature algorithms allowed by the C2PA spec
*
* Per <https://c2pa.org/specifications/specifications/1.0/specs/C2PA_Specification.html#_digital_signatures>:
*
* > All digital signatures that are stored in a C2PA Manifest shall > be generated using one of the digital signature algorithms and > key types listed as described in this section
*/
export type SigningAlg =
| "es256"
| "es384"
| "es512"
| "ps256"
| "ps384"
| "ps512"
| "ed25519";
export type {
Action,
C2paReason,
Ingredient,
ManifestAssertionKind,
} from "@contentauth/c2pa-types";
export type { SigningAlg } from "@contentauth/c2pa-utilities";

export type ClaimVersion = 1 | 2;

Expand All @@ -64,8 +56,6 @@ export type TrustmarkVariant =
// Quality Trustmark model
| "Q";

export type ManifestAssertionKind = "Cbor" | "Json" | "Binary" | "Uri";

/**
* A buffer for the source asset
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/c2pa-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.31.0",
"@contentauth/c2pa-types": "workspace:*",
"@eslint/js": "^9.39.4",
"@neon-rs/cli": "0.1.82",
"@types/cli-progress": "^3.11.6",
Expand Down Expand Up @@ -75,6 +74,7 @@
},
"homepage": "https://github.com/contentauth/c2pa-js/tree/main/packages/c2pa-node#readme",
"dependencies": {
"@contentauth/c2pa-types": "workspace:*",
"@contentauth/c2pa-utilities": "workspace:*",
"cargo-cp-artifact": "^0.1.9",
"cli-progress": "^3.12.0",
Expand Down
1 change: 1 addition & 0 deletions packages/c2pa-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
}
},
"dependencies": {
"@contentauth/c2pa-types": "workspace:*",
"ts-deepmerge": "^8.0.0"
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions packages/c2pa-utilities/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
export * from './settings.js';
export * from './fetchWithRetry.js';
export * from './caseConversion.js';
export * from './signingAlg.js';
export * from './assetSize.js';
21 changes: 21 additions & 0 deletions packages/c2pa-utilities/src/signingAlg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2026 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it.
*/

import type { SigningAlg as SchemaSigningAlg } from '@contentauth/c2pa-types';

/**
* The digital signature algorithms allowed by the C2PA spec, as accepted/produced by the core
* native library at the signer construction boundary.
*
* The native library deserializes and displays this value as lowercase here, which is distinct from the
* PascalCase casing it serializes into manifests (see `SigningAlg` from `@contentauth/c2pa-types`,
* used for `SignatureInfo.alg` when reading manifests). This is therefore derived from that schema
* type rather than being identical to it.
*/
export type SigningAlg = Lowercase<SchemaSigningAlg>;
3 changes: 3 additions & 0 deletions packages/c2pa-utilities/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"files": [],
"include": [],
"references": [
{
"path": "../c2pa-types"
},
{
"path": "./tsconfig.lib.json"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/c2pa-utilities/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"lib": ["ES2023", "DOM"]
},
"include": ["src/**/*.ts"],
"references": [
{
"path": "../c2pa-types"
}
],
"exclude": [
"vitest.config.ts",
"vitest.config.mts",
Expand Down
11 changes: 3 additions & 8 deletions packages/c2pa-web/src/lib/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@
* it.
*/

export type SigningAlg =
| 'es256'
| 'es384'
| 'es512'
| 'ps256'
| 'ps384'
| 'ps512'
| 'ed25519';
import type { SigningAlg } from '@contentauth/c2pa-utilities';

export type { SigningAlg };

export interface Signer {
sign: (
Expand Down
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading