@midnight-ntwrk/credential-model 0.1.0-rc2 → 0.2.0-rc1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this package are documented in this file.
4
4
 
5
+ ## 0.2.0 - 2026-09-18
6
+
7
+ - Accept untyped credential-family input through an assertion boundary and
8
+ report field-specific `CredentialModelError` failures.
9
+ - Enforce SemVer 2.0 syntax for family and schema versions, including strict
10
+ prerelease and build identifiers.
11
+ - Preserve literal inference for source-authored definitions and expand the
12
+ descriptor validation matrix.
13
+ - BREAKING: reduce the public API to generic credential-family, schema, and
14
+ claim metadata with its validation helper.
15
+ - Add optional human-readable names and descriptions to family and schema
16
+ descriptors.
17
+ - Remove capability and proof-artifact descriptors, package-composition
18
+ manifests, codec ports, and their validators.
19
+ - Remove semantic profile, deployment assembly, provider catalog, runtime family
20
+ discovery, and aggregate business-decision APIs. Applications and credential
21
+ family repositories own those concerns outside this core package.
22
+ - Remove error codes used only by the retired high-level resolvers.
23
+
5
24
  ## 0.1.0-rc1 - 2026-07-26
6
25
 
7
26
  - Add protocol-neutral credential-family definitions.
package/README.md CHANGED
@@ -4,18 +4,9 @@
4
4
  > Package class: `dist`
5
5
  > Release stage: `supported`
6
6
 
7
- Protocol-neutral TypeScript contracts for defining a credential family without
8
- depending on Compact, a ledger, a wallet, a transport, or generated family
9
- types.
10
-
11
- The package provides:
12
-
13
- - schema and claim descriptors;
14
- - holder-binding, status, proof, and presentation capability descriptors;
15
- - credential and presentation codec ports;
16
- - proof-artifact requirements;
17
- - bounded package composition manifests;
18
- - validation helpers and family-neutral errors.
7
+ Protocol-neutral TypeScript metadata for describing and validating a credential
8
+ family and its claim schema. The package does not describe runtime composition,
9
+ deployment, proof artifacts, or encoding.
19
10
 
20
11
  ## Install
21
12
 
@@ -26,41 +17,32 @@ pnpm add @midnight-ntwrk/credential-model@rc
26
17
  The first public release line is pre-1.0. Pin an exact version when a
27
18
  credential-family repository requires reproducible builds.
28
19
 
29
- ## Define a family
20
+ ## Public API
30
21
 
31
- ```ts
32
- import {
33
- defineCredentialFamily,
34
- type CredentialCodec,
35
- type PresentationCodec,
36
- } from "@midnight-ntwrk/credential-model";
22
+ The package exports:
37
23
 
38
- interface EmployeeCredential {
39
- employeeId: string;
40
- }
24
+ - credential-family, schema, and claim descriptors;
25
+ - `defineCredentialFamily(...)`;
26
+ - `assertCredentialFamilyDefinition(value: unknown)`, which narrows valid input
27
+ to `CredentialFamilyDefinition`;
28
+ - `CredentialModelError` and the bounded validation error-code union.
41
29
 
42
- interface EmployeePresentation {
43
- employeeId: string;
44
- }
30
+ It has zero runtime dependencies.
45
31
 
46
- const credentialCodec: CredentialCodec<EmployeeCredential, string> = {
47
- mediaType: "application/json",
48
- encode: JSON.stringify,
49
- decode: (value) => JSON.parse(value) as EmployeeCredential,
50
- };
32
+ ## Define a family
51
33
 
52
- const presentationCodec: PresentationCodec<EmployeePresentation, string> = {
53
- mediaType: "application/json",
54
- encode: JSON.stringify,
55
- decode: (value) => JSON.parse(value) as EmployeePresentation,
56
- };
34
+ ```ts
35
+ import { defineCredentialFamily } from "@midnight-ntwrk/credential-model";
57
36
 
58
37
  export const employeeFamily = defineCredentialFamily({
59
38
  id: "example.employee",
60
39
  version: "0.1.0",
40
+ name: "Employee credential",
41
+ description: "Identifies an employee within an organization.",
61
42
  schema: {
62
43
  id: "urn:example:employee",
63
44
  version: "1.0.0",
45
+ name: "Employee credential schema",
64
46
  credentialTypes: ["VerifiableCredential", "EmployeeCredential"],
65
47
  claims: [
66
48
  {
@@ -71,27 +53,43 @@ export const employeeFamily = defineCredentialFamily({
71
53
  },
72
54
  ],
73
55
  },
74
- capabilities: [],
75
- artifacts: [],
76
- composition: {
77
- formatVersion: 1,
78
- packages: [],
79
- },
80
- credentialCodec,
81
- presentationCodec,
82
56
  });
83
57
  ```
84
58
 
85
- `defineCredentialFamily` validates descriptor identifiers, semantic versions,
86
- claim paths, unique IDs, package requirements, and codec functions. Codecs are
87
- responsible for validating their encoded data when decoding.
59
+ `defineCredentialFamily(...)` validates descriptor identifiers, semantic
60
+ versions, optional display metadata, credential types, claim paths, disclosure
61
+ modes, required flags, and unique claim IDs. Versions follow SemVer 2.0 syntax.
62
+ The helper preserves the inferred type of source-authored definitions.
63
+
64
+ Use the assertion function for JSON, configuration, or other untyped input:
65
+
66
+ ```ts
67
+ import {
68
+ assertCredentialFamilyDefinition,
69
+ type CredentialFamilyDefinition,
70
+ } from "@midnight-ntwrk/credential-model";
71
+
72
+ export const parseFamily = (value: unknown): CredentialFamilyDefinition => {
73
+ assertCredentialFamilyDefinition(value);
74
+ return value;
75
+ };
76
+ ```
77
+
78
+ Invalid input throws `CredentialModelError` with a stable error code and field
79
+ path. Validation is structural; applications remain responsible for policy and
80
+ business constraints beyond the generic descriptor model.
88
81
 
89
82
  ## Boundaries
90
83
 
91
- This package has zero runtime dependencies. It does not define proof
92
- execution, status storage, DID resolution, exchange protocols, sessions,
93
- display rendering, or deployment behavior. Those capabilities belong in
94
- separate packages that depend on this model.
84
+ This package does not define codecs, credential or presentation payloads,
85
+ capabilities, proof artifacts, package composition, providers, deployments,
86
+ proof execution, status storage, DID resolution, exchange protocols, sessions,
87
+ display rendering, or business decisions. Credential-family repositories and
88
+ applications own those concerns.
89
+
90
+ Removed runtime and composition APIs have no compatibility shim. Consumers
91
+ should keep concrete configuration and behavior in their owning repository and
92
+ use this package only for generic family and claim-schema metadata.
95
93
 
96
94
  ## Compatibility and support
97
95
 
@@ -101,8 +99,8 @@ separate packages that depend on this model.
101
99
  releases remain backward compatible within their minor line.
102
100
  - Release candidates are supported only until a newer release candidate or
103
101
  stable version in the same minor line is published.
104
- - Deprecations, migrations, and known limitations are recorded in this
105
- changelog and README before a replacement release is promoted.
102
+ - Deprecations, migrations, and known limitations are recorded in this README
103
+ and [`CHANGELOG.md`](./CHANGELOG.md).
106
104
 
107
105
  Technical ownership belongs to `@midnightntwrk/ex-identus`. Release operations
108
106
  belong to `@midnightntwrk/mn-sre`. Security reports follow the repository
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type CredentialModelErrorCode = "INVALID_IDENTIFIER" | "INVALID_VERSION" | "INVALID_DESCRIPTOR" | "DUPLICATE_ID" | "INVALID_PACKAGE_REQUIREMENT" | "INVALID_CODEC";
1
+ export type CredentialModelErrorCode = "INVALID_IDENTIFIER" | "INVALID_VERSION" | "INVALID_DESCRIPTOR" | "DUPLICATE_ID";
2
2
  export declare class CredentialModelError extends Error {
3
3
  readonly code: CredentialModelErrorCode;
4
4
  readonly path: string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAChC,oBAAoB,GACpB,iBAAiB,GACjB,oBAAoB,GACpB,cAAc,GACd,6BAA6B,GAC7B,eAAe,CAAC;AAEpB,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAGpB,IAAI,EAAE,wBAAwB,EAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM;CAOlB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAChC,oBAAoB,GACpB,iBAAiB,GACjB,oBAAoB,GACpB,cAAc,CAAC;AAEnB,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAGpB,IAAI,EAAE,wBAAwB,EAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM;CAOlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAA2B;IAC/B,IAAI,CAAS;IAEtB,YACE,IAA8B,EAC9B,IAAY,EACZ,OAAe;QAEf,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAA2B;IAC/B,IAAI,CAAS;IAEtB,YACE,IAA8B,EAC9B,IAAY,EACZ,OAAe;QAEf,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { CredentialModelError, type CredentialModelErrorCode, } from "./errors.js";
2
- export type { ClaimDisclosure, CredentialCapabilityDescriptor, CredentialCapabilityKind, CredentialClaimDescriptor, CredentialCodec, CredentialCompositionManifest, CredentialFamilyDefinition, CredentialPackageRequirement, CredentialSchemaDescriptor, PresentationCodec, ProofArtifactRequirement, } from "./types.js";
3
- export { assertCredentialCompositionManifest, assertCredentialFamilyDefinition, defineCredentialFamily, } from "./validation.js";
2
+ export type { ClaimDisclosure, CredentialClaimDescriptor, CredentialFamilyDefinition, CredentialSchemaDescriptor, } from "./types.js";
3
+ export { assertCredentialFamilyDefinition, defineCredentialFamily, } from "./validation.js";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,eAAe,EACf,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,EACf,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mCAAmC,EACnC,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { CredentialModelError, } from "./errors.js";
2
- export { assertCredentialCompositionManifest, assertCredentialFamilyDefinition, defineCredentialFamily, } from "./validation.js";
2
+ export { assertCredentialFamilyDefinition, defineCredentialFamily, } from "./validation.js";
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,aAAa,CAAC;AAcrB,OAAO,EACL,mCAAmC,EACnC,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,aAAa,CAAC;AAOrB,OAAO,EACL,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export type ClaimDisclosure = "public" | "selective" | "committed" | "predicate-only";
2
- export type CredentialCapabilityKind = "holder-binding" | "status" | "proof" | "presentation";
3
2
  export interface CredentialClaimDescriptor {
4
3
  readonly id: string;
5
4
  readonly path: readonly [string, ...string[]];
@@ -10,48 +9,16 @@ export interface CredentialClaimDescriptor {
10
9
  export interface CredentialSchemaDescriptor {
11
10
  readonly id: string;
12
11
  readonly version: string;
12
+ readonly name?: string;
13
+ readonly description?: string;
13
14
  readonly credentialTypes: readonly [string, ...string[]];
14
15
  readonly claims: readonly CredentialClaimDescriptor[];
15
16
  }
16
- export interface CredentialCapabilityDescriptor {
17
- readonly id: string;
18
- readonly kind: CredentialCapabilityKind;
19
- readonly version?: string;
20
- readonly required: boolean;
21
- }
22
- export interface ProofArtifactRequirement {
23
- readonly id: string;
24
- readonly mediaType: string;
25
- readonly purpose: "prover" | "verifier" | "circuit" | "metadata";
26
- readonly optional?: boolean;
27
- }
28
- export interface CredentialPackageRequirement {
29
- readonly name: string;
30
- readonly version: string;
31
- readonly exports?: readonly string[];
32
- }
33
- export interface CredentialCompositionManifest {
34
- readonly formatVersion: 1;
35
- readonly packages: readonly CredentialPackageRequirement[];
36
- }
37
- export interface CredentialCodec<TCredential, TEncoded = unknown> {
38
- readonly mediaType: string;
39
- encode(credential: TCredential): TEncoded;
40
- decode(encoded: TEncoded): TCredential;
41
- }
42
- export interface PresentationCodec<TPresentation, TEncoded = unknown> {
43
- readonly mediaType: string;
44
- encode(presentation: TPresentation): TEncoded;
45
- decode(encoded: TEncoded): TPresentation;
46
- }
47
- export interface CredentialFamilyDefinition<TCredential, TPresentation, TEncodedCredential = unknown, TEncodedPresentation = unknown> {
17
+ export interface CredentialFamilyDefinition {
48
18
  readonly id: string;
49
19
  readonly version: string;
20
+ readonly name?: string;
21
+ readonly description?: string;
50
22
  readonly schema: CredentialSchemaDescriptor;
51
- readonly capabilities: readonly CredentialCapabilityDescriptor[];
52
- readonly artifacts: readonly ProofArtifactRequirement[];
53
- readonly composition: CredentialCompositionManifest;
54
- readonly credentialCodec: CredentialCodec<TCredential, TEncodedCredential>;
55
- readonly presentationCodec: PresentationCodec<TPresentation, TEncodedPresentation>;
56
23
  }
57
24
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,WAAW,GACX,WAAW,GACX,gBAAgB,CAAC;AAErB,MAAM,MAAM,wBAAwB,GAChC,gBAAgB,GAChB,QAAQ,GACR,OAAO,GACP,cAAc,CAAC;AAEnB,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,MAAM,EAAE,SAAS,yBAAyB,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAA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,yBAAyB,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;CAC7C"}
@@ -1,5 +1,4 @@
1
- import type { CredentialCompositionManifest, CredentialFamilyDefinition } from "./types.js";
2
- export declare const assertCredentialCompositionManifest: (manifest: CredentialCompositionManifest) => void;
3
- export declare const assertCredentialFamilyDefinition: <TCredential, TPresentation, TEncodedCredential, TEncodedPresentation>(definition: CredentialFamilyDefinition<TCredential, TPresentation, TEncodedCredential, TEncodedPresentation>) => void;
4
- export declare const defineCredentialFamily: <TCredential, TPresentation, TEncodedCredential = unknown, TEncodedPresentation = unknown>(definition: CredentialFamilyDefinition<TCredential, TPresentation, TEncodedCredential, TEncodedPresentation>) => CredentialFamilyDefinition<TCredential, TPresentation, TEncodedCredential, TEncodedPresentation>;
1
+ import type { CredentialFamilyDefinition } from "./types.js";
2
+ export declare function assertCredentialFamilyDefinition(definition: unknown): asserts definition is CredentialFamilyDefinition;
3
+ export declare const defineCredentialFamily: <const Definition extends CredentialFamilyDefinition>(definition: Definition) => Definition;
5
4
  //# sourceMappingURL=validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,6BAA6B,EAC7B,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAyEpB,eAAO,MAAM,mCAAmC,GAC9C,UAAU,6BAA6B,KACtC,IA+EF,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAC3C,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EAEpB,YAAY,0BAA0B,CACpC,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CACrB,KACA,IAkJF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,WAAW,EACX,aAAa,EACb,kBAAkB,GAAG,OAAO,EAC5B,oBAAoB,GAAG,OAAO,EAE9B,YAAY,0BAA0B,CACpC,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CACrB,KACA,0BAA0B,CAC3B,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,oBAAoB,CAIrB,CAAC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AA4E7D,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,OAAO,GAClB,OAAO,CAAC,UAAU,IAAI,0BAA0B,CA2ElD;AAED,eAAO,MAAM,sBAAsB,GACjC,KAAK,CAAC,UAAU,SAAS,0BAA0B,EAEnD,YAAY,UAAU,KACrB,UAGF,CAAC"}
@@ -1,168 +1,86 @@
1
1
  import { CredentialModelError } from "./errors.js";
2
- const semanticVersionPattern = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u;
3
- const packageVersionPattern = /^(?:[~^]|>=|<=|>|<)?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?$/u;
4
- const packageNamePattern = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u;
2
+ const numericIdentifier = String.raw `(?:0|[1-9]\d*)`;
3
+ const nonNumericIdentifier = String.raw `(?:\d*[A-Za-z-][0-9A-Za-z-]*)`;
4
+ const prereleaseIdentifier = `(?:${numericIdentifier}|${nonNumericIdentifier})`;
5
+ const semanticVersionPattern = new RegExp(`^${numericIdentifier}[.]${numericIdentifier}[.]${numericIdentifier}` +
6
+ `(?:-${prereleaseIdentifier}(?:[.]${prereleaseIdentifier})*)?` +
7
+ `(?:[+][0-9A-Za-z-]+(?:[.][0-9A-Za-z-]+)*)?$`, "u");
5
8
  const claimDisclosures = new Set([
6
9
  "public",
7
10
  "selective",
8
11
  "committed",
9
12
  "predicate-only",
10
13
  ]);
11
- const capabilityKinds = new Set([
12
- "holder-binding",
13
- "status",
14
- "proof",
15
- "presentation",
16
- ]);
17
- const artifactPurposes = new Set([
18
- "prover",
19
- "verifier",
20
- "circuit",
21
- "metadata",
22
- ]);
23
- const assertIdentifier = (value, path) => {
14
+ function assertRecord(value, path, message = "must be an object") {
15
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
16
+ throw new CredentialModelError("INVALID_DESCRIPTOR", path, message);
17
+ }
18
+ }
19
+ function assertIdentifier(value, path) {
24
20
  if (typeof value !== "string" || value.trim() !== value || value.length === 0) {
25
21
  throw new CredentialModelError("INVALID_IDENTIFIER", path, "must be a non-empty trimmed string");
26
22
  }
27
- };
28
- const assertVersion = (value, path) => {
29
- if (typeof value !== "string" || !semanticVersionPattern.test(value)) {
23
+ }
24
+ function assertVersion(value, path) {
25
+ if (typeof value !== "string" ||
26
+ value.trim() !== value ||
27
+ !semanticVersionPattern.test(value)) {
30
28
  throw new CredentialModelError("INVALID_VERSION", path, "must be a semantic version");
31
29
  }
32
- };
33
- const assertUniqueIds = (values, path) => {
34
- const ids = new Set();
35
- for (const [index, value] of values.entries()) {
36
- if (typeof value !== "object" || value === null) {
37
- throw new CredentialModelError("INVALID_DESCRIPTOR", `${path}[${index}]`, "must be an object");
38
- }
39
- const identified = value;
40
- assertIdentifier(identified.id, `${path}[${index}].id`);
41
- if (ids.has(identified.id)) {
42
- throw new CredentialModelError("DUPLICATE_ID", `${path}[${index}].id`, `duplicates '${identified.id}'`);
43
- }
44
- ids.add(identified.id);
45
- }
46
- };
47
- export const assertCredentialCompositionManifest = (manifest) => {
48
- if (typeof manifest !== "object" ||
49
- manifest === null ||
50
- manifest.formatVersion !== 1 ||
51
- !Array.isArray(manifest.packages)) {
52
- throw new CredentialModelError("INVALID_DESCRIPTOR", "composition", "must use formatVersion 1 and declare a packages array");
53
- }
54
- const packageNames = new Set();
55
- for (const [index, requirement] of manifest.packages.entries()) {
56
- const requirementPath = `composition.packages[${index}]`;
57
- if (typeof requirement !== "object" || requirement === null) {
58
- throw new CredentialModelError("INVALID_PACKAGE_REQUIREMENT", requirementPath, "must be an object");
59
- }
60
- if (typeof requirement.name !== "string" ||
61
- !packageNamePattern.test(requirement.name)) {
62
- throw new CredentialModelError("INVALID_PACKAGE_REQUIREMENT", `${requirementPath}.name`, "must be a valid npm package name");
63
- }
64
- if (/^(?:file|link|workspace|git|https?):/u.test(requirement.version) ||
65
- !packageVersionPattern.test(requirement.version)) {
66
- throw new CredentialModelError("INVALID_PACKAGE_REQUIREMENT", `${requirementPath}.version`, "must be a registry-resolvable exact or bounded semantic version");
67
- }
68
- if (packageNames.has(requirement.name)) {
69
- throw new CredentialModelError("DUPLICATE_ID", `${requirementPath}.name`, `duplicates '${requirement.name}'`);
70
- }
71
- packageNames.add(requirement.name);
72
- if (requirement.exports !== undefined &&
73
- !Array.isArray(requirement.exports)) {
74
- throw new CredentialModelError("INVALID_PACKAGE_REQUIREMENT", `${requirementPath}.exports`, "must be an array of explicit package export paths");
75
- }
76
- for (const [exportIndex, exportPath] of (requirement.exports ?? []).entries()) {
77
- assertIdentifier(exportPath, `${requirementPath}.exports[${exportIndex}]`);
78
- if (exportPath !== "." && !exportPath.startsWith("./")) {
79
- throw new CredentialModelError("INVALID_PACKAGE_REQUIREMENT", `${requirementPath}.exports[${exportIndex}]`, "must be '.' or an explicit package subpath starting with './'");
80
- }
81
- }
82
- }
83
- };
84
- export const assertCredentialFamilyDefinition = (definition) => {
85
- if (typeof definition !== "object" ||
86
- definition === null ||
87
- typeof definition.schema !== "object" ||
88
- definition.schema === null) {
89
- throw new CredentialModelError("INVALID_DESCRIPTOR", "definition", "must declare a credential schema");
30
+ }
31
+ function assertOptionalText(value, path) {
32
+ if (value !== undefined &&
33
+ (typeof value !== "string" || value.trim() !== value || value.length === 0)) {
34
+ throw new CredentialModelError("INVALID_DESCRIPTOR", path, "must be a non-empty trimmed string when present");
90
35
  }
36
+ }
37
+ export function assertCredentialFamilyDefinition(definition) {
38
+ assertRecord(definition, "definition");
91
39
  assertIdentifier(definition.id, "id");
92
40
  assertVersion(definition.version, "version");
93
- assertIdentifier(definition.schema.id, "schema.id");
94
- assertVersion(definition.schema.version, "schema.version");
95
- if (!Array.isArray(definition.schema.credentialTypes) ||
96
- definition.schema.credentialTypes.length === 0) {
41
+ assertOptionalText(definition.name, "name");
42
+ assertOptionalText(definition.description, "description");
43
+ assertRecord(definition.schema, "schema", "must declare a credential schema");
44
+ const schema = definition.schema;
45
+ assertIdentifier(schema.id, "schema.id");
46
+ assertVersion(schema.version, "schema.version");
47
+ assertOptionalText(schema.name, "schema.name");
48
+ assertOptionalText(schema.description, "schema.description");
49
+ if (!Array.isArray(schema.credentialTypes) || schema.credentialTypes.length === 0) {
97
50
  throw new CredentialModelError("INVALID_DESCRIPTOR", "schema.credentialTypes", "must contain at least one credential type");
98
51
  }
99
- for (const [index, credentialType] of definition.schema.credentialTypes.entries()) {
52
+ for (const [index, credentialType] of schema.credentialTypes.entries()) {
100
53
  assertIdentifier(credentialType, `schema.credentialTypes[${index}]`);
101
54
  }
102
- if (!Array.isArray(definition.schema.claims)) {
55
+ if (!Array.isArray(schema.claims)) {
103
56
  throw new CredentialModelError("INVALID_DESCRIPTOR", "schema.claims", "must be an array");
104
57
  }
105
- assertUniqueIds(definition.schema.claims, "schema.claims");
106
- for (const [index, claim] of definition.schema.claims.entries()) {
58
+ const claimIds = new Set();
59
+ for (const [index, claim] of schema.claims.entries()) {
60
+ const claimPath = `schema.claims[${index}]`;
61
+ assertRecord(claim, claimPath);
62
+ assertIdentifier(claim.id, `${claimPath}.id`);
63
+ if (claimIds.has(claim.id)) {
64
+ throw new CredentialModelError("DUPLICATE_ID", `${claimPath}.id`, `duplicates '${claim.id}'`);
65
+ }
66
+ claimIds.add(claim.id);
107
67
  if (!claimDisclosures.has(claim.disclosure)) {
108
- throw new CredentialModelError("INVALID_DESCRIPTOR", `schema.claims[${index}].disclosure`, "must be public, selective, committed, or predicate-only");
68
+ throw new CredentialModelError("INVALID_DESCRIPTOR", `${claimPath}.disclosure`, "must be public, selective, committed, or predicate-only");
109
69
  }
110
70
  if (typeof claim.required !== "boolean") {
111
- throw new CredentialModelError("INVALID_DESCRIPTOR", `schema.claims[${index}].required`, "must be a boolean");
71
+ throw new CredentialModelError("INVALID_DESCRIPTOR", `${claimPath}.required`, "must be a boolean");
112
72
  }
113
73
  if (claim.valueType !== undefined) {
114
- assertIdentifier(claim.valueType, `schema.claims[${index}].valueType`);
74
+ assertIdentifier(claim.valueType, `${claimPath}.valueType`);
115
75
  }
116
76
  if (!Array.isArray(claim.path) || claim.path.length === 0) {
117
- throw new CredentialModelError("INVALID_DESCRIPTOR", `schema.claims[${index}].path`, "must contain at least one path segment");
77
+ throw new CredentialModelError("INVALID_DESCRIPTOR", `${claimPath}.path`, "must contain at least one path segment");
118
78
  }
119
79
  for (const [pathIndex, segment] of claim.path.entries()) {
120
- assertIdentifier(segment, `schema.claims[${index}].path[${pathIndex}]`);
121
- }
122
- }
123
- if (!Array.isArray(definition.capabilities) ||
124
- !Array.isArray(definition.artifacts)) {
125
- throw new CredentialModelError("INVALID_DESCRIPTOR", "definition", "capabilities and artifacts must be arrays");
126
- }
127
- assertUniqueIds(definition.capabilities, "capabilities");
128
- assertUniqueIds(definition.artifacts, "artifacts");
129
- for (const [index, capability] of definition.capabilities.entries()) {
130
- if (!capabilityKinds.has(capability.kind)) {
131
- throw new CredentialModelError("INVALID_DESCRIPTOR", `capabilities[${index}].kind`, "must be holder-binding, status, proof, or presentation");
132
- }
133
- if (typeof capability.required !== "boolean") {
134
- throw new CredentialModelError("INVALID_DESCRIPTOR", `capabilities[${index}].required`, "must be a boolean");
135
- }
136
- if (capability.version !== undefined) {
137
- assertVersion(capability.version, `capabilities[${index}].version`);
138
- }
139
- }
140
- for (const [index, artifact] of definition.artifacts.entries()) {
141
- assertIdentifier(artifact.mediaType, `artifacts[${index}].mediaType`);
142
- if (!artifactPurposes.has(artifact.purpose)) {
143
- throw new CredentialModelError("INVALID_DESCRIPTOR", `artifacts[${index}].purpose`, "must be prover, verifier, circuit, or metadata");
144
- }
145
- if (artifact.optional !== undefined &&
146
- typeof artifact.optional !== "boolean") {
147
- throw new CredentialModelError("INVALID_DESCRIPTOR", `artifacts[${index}].optional`, "must be a boolean when present");
80
+ assertIdentifier(segment, `${claimPath}.path[${pathIndex}]`);
148
81
  }
149
82
  }
150
- assertCredentialCompositionManifest(definition.composition);
151
- for (const [name, codec] of [
152
- ["credentialCodec", definition.credentialCodec],
153
- ["presentationCodec", definition.presentationCodec],
154
- ]) {
155
- if (typeof codec !== "object" ||
156
- codec === null ||
157
- typeof codec.mediaType !== "string" ||
158
- codec.mediaType.trim() !== codec.mediaType ||
159
- codec.mediaType.length === 0 ||
160
- typeof codec.encode !== "function" ||
161
- typeof codec.decode !== "function") {
162
- throw new CredentialModelError("INVALID_CODEC", name, "must declare a media type and encode/decode functions");
163
- }
164
- }
165
- };
83
+ }
166
84
  export const defineCredentialFamily = (definition) => {
167
85
  assertCredentialFamilyDefinition(definition);
168
86
  return definition;
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMnD,MAAM,sBAAsB,GAC1B,4FAA4F,CAAC;AAC/F,MAAM,qBAAqB,GACzB,0FAA0F,CAAC;AAC7F,MAAM,kBAAkB,GACtB,qDAAqD,CAAC;AACxD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,QAAQ;IACR,WAAW;IACX,WAAW;IACX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WAAW,EACvB,mBAAmB,CACpB,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAClC,gBAAgB,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,SAAS,YAAY,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1D,MAAM,IAAI,oBAAoB,CAC5B,oBAAoB,EACpB,GAAG,SAAS,OAAO,EACnB,wCAAwC,CACzC,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACxD,gBAAgB,CAAC,OAAO,EAAE,GAAG,SAAS,SAAS,SAAS,GAAG,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAGpC,UAAsB,EACV,EAAE;IACd,gCAAgC,CAAC,UAAU,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midnight-ntwrk/credential-model",
3
- "version": "0.1.0-rc2",
3
+ "version": "0.2.0-rc1",
4
4
  "description": "Protocol-neutral credential-family contracts for Midnight verifiable credentials",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "engines": {
27
27
  "node": ">=24",
28
- "pnpm": ">=10"
28
+ "pnpm": ">=10.34.5"
29
29
  },
30
30
  "main": "dist/index.js",
31
31
  "module": "dist/index.js",
@@ -43,19 +43,12 @@
43
43
  "CHANGELOG.md",
44
44
  "package.json"
45
45
  ],
46
- "midnight": {
47
- "maturity": "core",
48
- "packageClass": "dist",
49
- "releaseStage": "supported"
50
- },
51
46
  "scripts": {
52
47
  "build": "rm -rf dist .cache && tsc -b tsconfig.build.json --force",
53
- "test": "vitest run --config vitest.config.ts",
54
- "test:ci": "vitest run --config vitest.config.ts",
48
+ "test": "vitest run",
55
49
  "typecheck": "tsc -p tsconfig.json --noEmit",
56
50
  "lint": "eslint \"src/**/*.ts\"",
57
51
  "lint:fix": "eslint \"src/**/*.ts\" --fix",
58
- "clean": "rm -rf dist coverage .cache *.tsbuildinfo",
59
- "all": "pnpm run lint && pnpm run typecheck && pnpm run build && pnpm run test:ci"
52
+ "clean": "rm -rf dist coverage .cache .turbo *.tsbuildinfo"
60
53
  }
61
54
  }