@digitalcredentials/ssi
Advanced tools
| /*! | ||
| * Authorization Capabilities (zCap) interfaces. | ||
| * @see https://w3c-ccg.github.io/zcap-spec/ | ||
| */ | ||
| /** | ||
| * A proof attached to a delegated zCap. | ||
| */ | ||
| export interface ICapabilityDelegationProof { | ||
| /** The cryptographic suite type (e.g. `'Ed25519Signature2020'`). */ | ||
| type: string; | ||
| /** ISO 8601 date-time the proof was created. */ | ||
| created: string; | ||
| /** Verification method URI used to sign. */ | ||
| verificationMethod: string; | ||
| /** Always `'capabilityDelegation'`. */ | ||
| proofPurpose: 'capabilityDelegation'; | ||
| /** | ||
| * Ordered capability chain (root → parent). All entries are string IDs | ||
| * except the last delegated zCap, which is embedded as an object. | ||
| */ | ||
| capabilityChain: Array<string | IDelegatedZcap>; | ||
| /** The encoded proof value. */ | ||
| proofValue: string; | ||
| } | ||
| /** | ||
| * A root authorization capability (zCap). Root zCaps are unsigned, have no | ||
| * `expires` field and no delegation proof. Their `id` follows the convention | ||
| * `urn:zcap:root:${encodeURIComponent(invocationTarget)}`. | ||
| */ | ||
| export interface IRootZcap { | ||
| /** The zCap JSON-LD context URL. */ | ||
| '@context': string; | ||
| /** Capability ID (`urn:zcap:root:<encodedTarget>`). */ | ||
| id: string; | ||
| /** The DID(s) authorized to invoke. */ | ||
| controller: string | string[]; | ||
| /** Resource URI this capability grants access to (absolute URI). */ | ||
| invocationTarget: string; | ||
| } | ||
| /** | ||
| * A delegated authorization capability (zCap). Delegated capabilities narrow | ||
| * a parent capability and must carry exactly one `capabilityDelegation` proof. | ||
| */ | ||
| export interface IDelegatedZcap { | ||
| /** JSON-LD context array; first entry MUST be the zCap context URL. */ | ||
| '@context': string[]; | ||
| /** Capability ID (absolute URI). */ | ||
| id: string; | ||
| /** Parent capability ID (absolute URI). */ | ||
| parentCapability: string; | ||
| /** The DID(s) authorized to invoke. */ | ||
| controller: string | string[]; | ||
| /** Resource URI this capability grants access to (absolute URI). */ | ||
| invocationTarget: string; | ||
| /** | ||
| * The action(s) the controller may perform; if absent, no actions are | ||
| * allowed (except for the root zCap). | ||
| */ | ||
| allowedAction?: string | string[]; | ||
| /** ISO 8601 date-time when this capability expires. */ | ||
| expires: string; | ||
| /** The capability delegation proof(s). */ | ||
| proof: ICapabilityDelegationProof | ICapabilityDelegationProof[]; | ||
| } | ||
| /** | ||
| * A zCap is either a root or a delegated authorization capability. | ||
| * | ||
| * Use this discriminated union when the call site knows it has a real, | ||
| * well-formed zCap and can narrow via `'parentCapability' in cap`. | ||
| */ | ||
| export type IZcap = IRootZcap | IDelegatedZcap; | ||
| /** | ||
| * A permissive zCap shape that conflates root and delegated kinds and admits | ||
| * arbitrary additional properties (e.g. the opaque object returned from | ||
| * `jsigs.sign()`). | ||
| * | ||
| * Prefer the strict `IZcap` union when possible. Use `IZcapLike` only when: | ||
| * - the call site receives a capability whose kind is not yet known and | ||
| * cannot reasonably discriminate, or | ||
| * - the call site needs to accept the open-ended shape produced by | ||
| * linked-data signature libraries that may attach extra properties. | ||
| */ | ||
| export interface IZcapLike { | ||
| '@context': string | string[]; | ||
| id: string; | ||
| invocationTarget: string; | ||
| controller?: string | string[]; | ||
| parentCapability?: string; | ||
| allowedAction?: string | string[]; | ||
| expires?: string; | ||
| proof?: ICapabilityDelegationProof | ICapabilityDelegationProof[]; | ||
| [key: string]: unknown; | ||
| } | ||
| //# sourceMappingURL=ZCap.d.ts.map |
| {"version":3,"file":"ZCap.d.ts","sourceRoot":"","sources":["../src/ZCap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAA;IACf,4CAA4C;IAC5C,kBAAkB,EAAE,MAAM,CAAA;IAC1B,uCAAuC;IACvC,YAAY,EAAE,sBAAsB,CAAA;IACpC;;;OAGG;IACH,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,C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EAAE,CAAA;IACjE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB"} |
| /*! | ||
| * Authorization Capabilities (zCap) interfaces. | ||
| * @see https://w3c-ccg.github.io/zcap-spec/ | ||
| */ | ||
| export {}; |
+1
-0
@@ -9,2 +9,3 @@ /*! | ||
| export * from './OBv3.js'; | ||
| export * from './ZCap.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"} |
+1
-0
@@ -9,1 +9,2 @@ /*! | ||
| export * from './OBv3.js'; | ||
| export * from './ZCap.js'; |
+5
-1
| { | ||
| "name": "@digitalcredentials/ssi", | ||
| "description": "Typescript types for the W3C Verifiable Credentials Data Model.", | ||
| "version": "5.4.2", | ||
| "version": "5.5.0", | ||
| "scripts": { | ||
@@ -38,2 +38,6 @@ "build": "npm run clear && tsc -d", | ||
| "default": "./dist/VCDM.js" | ||
| }, | ||
| "./zcap": { | ||
| "types": "./dist/ZCap.d.ts", | ||
| "default": "./dist/ZCap.js" | ||
| } | ||
@@ -40,0 +44,0 @@ }, |
+1
-0
@@ -98,2 +98,3 @@ # SSI Types and Data Model _(@digitalcredentials/ssi)_ | ||
| * ... others (see individual exports in `/src`) | ||
| * `IZcap` and related interfaces (`IRootZcap`, `IDelegatedZcap`, `IZcapLike`, and `ICapabilityDelegationProof`) | ||
@@ -100,0 +101,0 @@ ## Contribute |
33221
19.41%24
14.29%506
24.63%110
0.92%