@interop/zcap 9.0.3 → 10.1.0
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/README.md +1 -1
- package/lib/CapabilityDelegation.js +5 -5
- package/lib/CapabilityInvocation.js +2 -2
- package/lib/index.js +1 -6
- package/lib/utils.js +22 -23
- package/package.json +4 -2
- package/types/lib/CapabilityDelegation.d.ts +13 -13
- package/types/lib/CapabilityDelegation.d.ts.map +1 -1
- package/types/lib/CapabilityInvocation.d.ts +5 -5
- package/types/lib/CapabilityInvocation.d.ts.map +1 -1
- package/types/lib/CapabilityProofPurpose.d.ts +1 -1
- package/types/lib/index.d.ts +0 -8
- package/types/lib/index.d.ts.map +1 -1
- package/types/lib/utils.d.ts +46 -50
- package/types/lib/utils.d.ts.map +1 -1
- package/lib/zcap-types.d.ts +0 -72
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# zcap _(@interop/zcap)_
|
|
2
2
|
|
|
3
|
-
[](https://github.com/interop-alliance/zcap/actions?query=workflow%3ACI)
|
|
4
4
|
[](https://npm.im/@interop/zcap)
|
|
5
5
|
|
|
6
6
|
> JavaScript reference implementation for
|
|
@@ -6,14 +6,14 @@ import {CapabilityProofPurpose} from './CapabilityProofPurpose.js';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {import('./utils.js').InspectCapabilityChain} InspectCapabilityChain
|
|
9
|
-
* @typedef {import('./utils.js').
|
|
10
|
-
* @typedef {import('./utils.js').
|
|
9
|
+
* @typedef {import('./utils.js').IZcap} IZcap
|
|
10
|
+
* @typedef {import('./utils.js').IDelegatedZcap} IDelegatedZcap
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
export class CapabilityDelegation extends CapabilityProofPurpose {
|
|
14
14
|
/**
|
|
15
15
|
* @param {object} options - The options.
|
|
16
|
-
* @param {string|
|
|
16
|
+
* @param {string|IZcap} [options.parentCapability] - An alternative to
|
|
17
17
|
* passing `capabilityChain` when creating a proof; passing
|
|
18
18
|
* `parentCapability` will enable the capability chain to be auto-computed.
|
|
19
19
|
* Pass a root zcap ID string, or a full root or delegated zcap object.
|
|
@@ -43,8 +43,8 @@ export class CapabilityDelegation extends CapabilityProofPurpose {
|
|
|
43
43
|
* @param {object|object[]} [options.suite] - The jsonld-signature suite(s) to
|
|
44
44
|
* use to verify the capability chain. Required only in verify-proof mode;
|
|
45
45
|
* unused (and omitted) when creating a delegation proof.
|
|
46
|
-
* @param {
|
|
47
|
-
* @param {Array<string|
|
|
46
|
+
* @param {IZcap} [options._verifiedParentCapability] - Private.
|
|
47
|
+
* @param {Array<string|IDelegatedZcap>} [options._capabilityChain] - Private.
|
|
48
48
|
* @param {boolean} [options._skipLocalValidationForTesting] - Private.
|
|
49
49
|
*/
|
|
50
50
|
constructor({
|
|
@@ -7,13 +7,13 @@ import {CapabilityProofPurpose} from './CapabilityProofPurpose.js';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {import('./utils.js').InspectCapabilityChain} InspectCapabilityChain
|
|
10
|
-
* @typedef {import('./utils.js').
|
|
10
|
+
* @typedef {import('./utils.js').IDelegatedZcap} IDelegatedZcap
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
export class CapabilityInvocation extends CapabilityProofPurpose {
|
|
14
14
|
/**
|
|
15
15
|
* @param {object} options - The options.
|
|
16
|
-
* @param {string|
|
|
16
|
+
* @param {string|IDelegatedZcap} [options.capability] - The capability to
|
|
17
17
|
* add/reference in a created proof. A root zcap MUST be passed as its ID
|
|
18
18
|
* string; a delegated zcap must be passed as the full object.
|
|
19
19
|
* @param {string} [options.capabilityAction] - The capability action that is
|
package/lib/index.js
CHANGED
|
@@ -11,10 +11,6 @@ import * as constants from './constants.js';
|
|
|
11
11
|
export {constants};
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @typedef {import('./utils.js').RootZcap} RootZcap
|
|
15
|
-
* @typedef {import('./utils.js').DelegatedZcap} DelegatedZcap
|
|
16
|
-
* @typedef {import('./utils.js').Zcap} Zcap
|
|
17
|
-
* @typedef {import('./utils.js').CapabilityDelegationProof} CapabilityDelegationProof
|
|
18
14
|
* @typedef {import('./utils.js').InspectCapabilityChain} InspectCapabilityChain
|
|
19
15
|
* @typedef {import('./utils.js').InspectResult} InspectResult
|
|
20
16
|
* @typedef {import('./utils.js').CapabilityChainDetails} CapabilityChainDetails
|
|
@@ -56,5 +52,4 @@ export function extendDocumentLoader(documentLoader) {
|
|
|
56
52
|
*
|
|
57
53
|
* @type {Function}
|
|
58
54
|
*/
|
|
59
|
-
export const documentLoader = extendDocumentLoader(
|
|
60
|
-
jsigs.strictDocumentLoader);
|
|
55
|
+
export const documentLoader = extendDocumentLoader(jsigs.strictDocumentLoader);
|
package/lib/utils.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* @param {string|string[]} options.controller - The root controller.
|
|
14
14
|
* @param {string} options.invocationTarget - The root invocation target.
|
|
15
15
|
*
|
|
16
|
-
* @returns {
|
|
16
|
+
* @returns {IRootZcap} The root capability.
|
|
17
17
|
*/
|
|
18
18
|
export function createRootCapability({controller, invocationTarget}) {
|
|
19
19
|
return {
|
|
@@ -28,7 +28,7 @@ export function createRootCapability({controller, invocationTarget}) {
|
|
|
28
28
|
* Retrieves the controller(s) from a capability.
|
|
29
29
|
*
|
|
30
30
|
* @param {object} options - The options.
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
32
32
|
*
|
|
33
33
|
* @returns {string[]} The controller(s) for the capability.
|
|
34
34
|
*/
|
|
@@ -45,7 +45,7 @@ export function getControllers({capability}) {
|
|
|
45
45
|
* controlled by a controller) of the given capability.
|
|
46
46
|
*
|
|
47
47
|
* @param {object} options - The options.
|
|
48
|
-
* @param {
|
|
48
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
49
49
|
* @param {object} options.verificationMethod - The verification method to
|
|
50
50
|
* check.
|
|
51
51
|
*
|
|
@@ -61,7 +61,7 @@ export function isController({capability, verificationMethod}) {
|
|
|
61
61
|
* Retrieves the allowed actions from a capability.
|
|
62
62
|
*
|
|
63
63
|
* @param {object} options - The options.
|
|
64
|
-
* @param {
|
|
64
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
65
65
|
*
|
|
66
66
|
* @returns {string[]} Allowed actions.
|
|
67
67
|
*/
|
|
@@ -80,7 +80,7 @@ export function getAllowedActions({capability}) {
|
|
|
80
80
|
* Retrieves the target from a capability.
|
|
81
81
|
*
|
|
82
82
|
* @param {object} options - The options.
|
|
83
|
-
* @param {
|
|
83
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
84
84
|
*
|
|
85
85
|
* @returns {string} - Capability target.
|
|
86
86
|
*/
|
|
@@ -95,9 +95,9 @@ export function getTarget({capability}) {
|
|
|
95
95
|
* delegation proofs will cause this function to return an empty array.
|
|
96
96
|
*
|
|
97
97
|
* @param {object} options - The options.
|
|
98
|
-
* @param {
|
|
98
|
+
* @param {IZcap} options.capability - The authorization capability.
|
|
99
99
|
*
|
|
100
|
-
* @returns {
|
|
100
|
+
* @returns {ICapabilityDelegationProof[]} Any `capabilityDelegation` proof
|
|
101
101
|
* objects attached to the given capability.
|
|
102
102
|
*/
|
|
103
103
|
export function getDelegationProofs({capability}) {
|
|
@@ -117,9 +117,9 @@ export function getDelegationProofs({capability}) {
|
|
|
117
117
|
* Gets the `capabilityChain` associated with the given capability.
|
|
118
118
|
*
|
|
119
119
|
* @param {object} options - The options.
|
|
120
|
-
* @param {
|
|
120
|
+
* @param {IZcap} options.capability - The authorization capability.
|
|
121
121
|
*
|
|
122
|
-
* @returns {Array<string|
|
|
122
|
+
* @returns {Array<string|IDelegatedZcap>} The capability chain entries
|
|
123
123
|
* (root to parent), as stored in the delegation proof.
|
|
124
124
|
*/
|
|
125
125
|
export function getCapabilityChain({capability}) {
|
|
@@ -204,12 +204,12 @@ export function isValidTarget({
|
|
|
204
204
|
* given `parentCapability`.
|
|
205
205
|
*
|
|
206
206
|
* @param {object} options - The options.
|
|
207
|
-
* @param {string|
|
|
207
|
+
* @param {string|IZcap} options.parentCapability - The parent capability from
|
|
208
208
|
* which to compute the capability chain (a root zcap ID string, or a full
|
|
209
209
|
* root or delegated zcap object).
|
|
210
210
|
* @param {boolean} options._skipLocalValidationForTesting - Private.
|
|
211
211
|
*
|
|
212
|
-
* @returns {Array<string|
|
|
212
|
+
* @returns {Array<string|IDelegatedZcap>} The computed capability chain to be
|
|
213
213
|
* included in a capability delegation proof.
|
|
214
214
|
*/
|
|
215
215
|
export function computeCapabilityChain({
|
|
@@ -309,7 +309,7 @@ export function computeCapabilityChain({
|
|
|
309
309
|
* work with both root zcap `a` and `b`).
|
|
310
310
|
*
|
|
311
311
|
* @param {object} options - The options.
|
|
312
|
-
* @param {string|
|
|
312
|
+
* @param {string|IDelegatedZcap} options.capability - The authorization
|
|
313
313
|
* capability to dereference the chain for. Pass a string (the root zcap ID)
|
|
314
314
|
* to dereference a root zcap directly, or a delegated zcap object.
|
|
315
315
|
* @param {Function} options.getRootCapability - A function for dereferencing
|
|
@@ -318,7 +318,7 @@ export function computeCapabilityChain({
|
|
|
318
318
|
* @param {number} [options.maxChainLength=10] - The maximum length of the
|
|
319
319
|
* capability delegation chain (this is inclusive of `capability` itself).
|
|
320
320
|
*
|
|
321
|
-
* @returns {Promise<{dereferencedChain:
|
|
321
|
+
* @returns {Promise<{dereferencedChain: IZcap[]}>} Resolves to an object
|
|
322
322
|
* containing the full dereferenced chain ordered root to tail.
|
|
323
323
|
*/
|
|
324
324
|
export async function dereferenceCapabilityChain({
|
|
@@ -592,16 +592,15 @@ export function compareTime({t1, t2, maxClockSkew}) {
|
|
|
592
592
|
}
|
|
593
593
|
|
|
594
594
|
/**
|
|
595
|
-
* The zcap object shapes (`
|
|
596
|
-
* `
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
*
|
|
600
|
-
*
|
|
601
|
-
* @typedef {import('
|
|
602
|
-
* @typedef {import('
|
|
603
|
-
* @typedef {import('
|
|
604
|
-
* @typedef {import('./zcap-types.js').Zcap} Zcap
|
|
595
|
+
* The zcap object shapes (`IRootZcap`, `IDelegatedZcap`,
|
|
596
|
+
* `ICapabilityDelegationProof`, `IZcap`) live in
|
|
597
|
+
* `@interop/data-integrity-core/zcap` (the canonical home) and are re-imported
|
|
598
|
+
* here as typedefs for JSDoc use.
|
|
599
|
+
*
|
|
600
|
+
* @typedef {import('@interop/data-integrity-core/zcap').IRootZcap} IRootZcap
|
|
601
|
+
* @typedef {import('@interop/data-integrity-core/zcap').ICapabilityDelegationProof} ICapabilityDelegationProof
|
|
602
|
+
* @typedef {import('@interop/data-integrity-core/zcap').IDelegatedZcap} IDelegatedZcap
|
|
603
|
+
* @typedef {import('@interop/data-integrity-core/zcap').IZcap} IZcap
|
|
605
604
|
*/
|
|
606
605
|
|
|
607
606
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/zcap",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Authorization Capabilities reference implementation.",
|
|
5
5
|
"homepage": "https://github.com/interop-alliance/zcap",
|
|
6
6
|
"author": {
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@digitalbazaar/zcap-context": "^2.0.1",
|
|
35
|
-
"@interop/
|
|
35
|
+
"@interop/data-integrity-core": "^6.1.0",
|
|
36
|
+
"@interop/jsonld-signatures": "^11.6.2"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@digitalbazaar/ed25519-signature-2020": "^5.4.0",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"engines": {
|
|
65
66
|
"node": ">=18"
|
|
66
67
|
},
|
|
68
|
+
"packageManager": "pnpm@11.3.0",
|
|
67
69
|
"keywords": [
|
|
68
70
|
"Authorization Capability",
|
|
69
71
|
"Authorization Capabilities",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('./utils.js').InspectCapabilityChain} InspectCapabilityChain
|
|
3
|
-
* @typedef {import('./utils.js').
|
|
4
|
-
* @typedef {import('./utils.js').
|
|
3
|
+
* @typedef {import('./utils.js').IZcap} IZcap
|
|
4
|
+
* @typedef {import('./utils.js').IDelegatedZcap} IDelegatedZcap
|
|
5
5
|
*/
|
|
6
6
|
export class CapabilityDelegation extends CapabilityProofPurpose {
|
|
7
7
|
/**
|
|
8
8
|
* @param {object} options - The options.
|
|
9
|
-
* @param {string|
|
|
9
|
+
* @param {string|IZcap} [options.parentCapability] - An alternative to
|
|
10
10
|
* passing `capabilityChain` when creating a proof; passing
|
|
11
11
|
* `parentCapability` will enable the capability chain to be auto-computed.
|
|
12
12
|
* Pass a root zcap ID string, or a full root or delegated zcap object.
|
|
@@ -36,12 +36,12 @@ export class CapabilityDelegation extends CapabilityProofPurpose {
|
|
|
36
36
|
* @param {object|object[]} [options.suite] - The jsonld-signature suite(s) to
|
|
37
37
|
* use to verify the capability chain. Required only in verify-proof mode;
|
|
38
38
|
* unused (and omitted) when creating a delegation proof.
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {Array<string|
|
|
39
|
+
* @param {IZcap} [options._verifiedParentCapability] - Private.
|
|
40
|
+
* @param {Array<string|IDelegatedZcap>} [options._capabilityChain] - Private.
|
|
41
41
|
* @param {boolean} [options._skipLocalValidationForTesting] - Private.
|
|
42
42
|
*/
|
|
43
43
|
constructor({ parentCapability, allowTargetAttenuation, controller, date, expectedRootCapability, inspectCapabilityChain, maxChainLength, maxClockSkew, maxDelegationTtl, suite, _verifiedParentCapability, _capabilityChain, _skipLocalValidationForTesting }?: {
|
|
44
|
-
parentCapability?: string |
|
|
44
|
+
parentCapability?: string | IZcap;
|
|
45
45
|
allowTargetAttenuation?: boolean;
|
|
46
46
|
date?: string | Date | number;
|
|
47
47
|
expectedRootCapability?: string | string[];
|
|
@@ -51,14 +51,14 @@ export class CapabilityDelegation extends CapabilityProofPurpose {
|
|
|
51
51
|
maxClockSkew?: number;
|
|
52
52
|
maxDelegationTtl?: number;
|
|
53
53
|
suite?: object | object[];
|
|
54
|
-
_verifiedParentCapability?:
|
|
55
|
-
_capabilityChain?: Array<string |
|
|
54
|
+
_verifiedParentCapability?: IZcap;
|
|
55
|
+
_capabilityChain?: Array<string | IDelegatedZcap>;
|
|
56
56
|
_skipLocalValidationForTesting?: boolean;
|
|
57
57
|
});
|
|
58
|
-
parentCapability: string | import("
|
|
59
|
-
_capabilityChain: (string | import("
|
|
58
|
+
parentCapability: string | import("@interop/data-integrity-core/zcap").IZcap;
|
|
59
|
+
_capabilityChain: (string | import("@interop/data-integrity-core/zcap").IDelegatedZcap)[];
|
|
60
60
|
_skipLocalValidationForTesting: boolean;
|
|
61
|
-
_verifiedParentCapability: import("
|
|
61
|
+
_verifiedParentCapability: import("@interop/data-integrity-core/zcap").IZcap;
|
|
62
62
|
update(proof: any, { document }: {
|
|
63
63
|
document: any;
|
|
64
64
|
}): Promise<any>;
|
|
@@ -95,7 +95,7 @@ export class CapabilityDelegation extends CapabilityProofPurpose {
|
|
|
95
95
|
}): Promise<import("@interop/jsonld-signatures").ProofValidateResult>;
|
|
96
96
|
}
|
|
97
97
|
export type InspectCapabilityChain = import("./utils.js").InspectCapabilityChain;
|
|
98
|
-
export type
|
|
99
|
-
export type
|
|
98
|
+
export type IZcap = import("./utils.js").IZcap;
|
|
99
|
+
export type IDelegatedZcap = import("./utils.js").IDelegatedZcap;
|
|
100
100
|
import { CapabilityProofPurpose } from './CapabilityProofPurpose.js';
|
|
101
101
|
//# sourceMappingURL=CapabilityDelegation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CapabilityDelegation.d.ts","sourceRoot":"","sources":["../../lib/CapabilityDelegation.js"],"names":[],"mappings":"AAMA;;;;GAIG;AAEH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,iQAlCG;
|
|
1
|
+
{"version":3,"file":"CapabilityDelegation.d.ts","sourceRoot":"","sources":["../../lib/CapabilityDelegation.js"],"names":[],"mappings":"AAMA;;;;GAIG;AAEH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,iQAlCG;QAA+B,gBAAgB,GAAvC,MAAM,GAAC,KAAK;QAIM,sBAAsB,GAAxC,OAAO;QAGsB,IAAI,GAAjC,MAAM,GAAC,IAAI,GAAC,MAAM;QAIQ,sBAAsB,GAAhD,MAAM,GAAC,MAAM,EAAE;QAGE,UAAU,GAA3B,MAAM;QAE2B,sBAAsB,GAAvD,sBAAsB;QAGL,cAAc,GAA/B,MAAM;QAEW,YAAY,GAA7B,MAAM;QAGW,gBAAgB,GAAjC,MAAM;QAGoB,KAAK,GAA/B,MAAM,GAAC,MAAM,EAAE;QAGC,yBAAyB,GAAzC,KAAK;QACkC,gBAAgB,GAAvD,KAAK,CAAC,MAAM,GAAC,cAAc,CAAC;QACV,8BAA8B,GAAhD,OAAO;KACjB,EA0EA;IAbG,6EAAwC;IAKtC,0FAAwC;IAGxC,wCAAoE;IAGtE,6EAA0D;IAI9D;;qBAiFC;IAED;;;yBAUC;IAED,6DAEC;IAED;;;;;MAIC;IAED;;;;OAOC;IAED;;;;;0EAsBC;IAED;;;0EAgBC;IAED;;;;0EA8BC;CACF;qCAhTY,OAAO,YAAY,EAAE,sBAAsB;oBAC3C,OAAO,YAAY,EAAE,KAAK;6BAC1B,OAAO,YAAY,EAAE,cAAc;uCALX,6BAA6B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('./utils.js').InspectCapabilityChain} InspectCapabilityChain
|
|
3
|
-
* @typedef {import('./utils.js').
|
|
3
|
+
* @typedef {import('./utils.js').IDelegatedZcap} IDelegatedZcap
|
|
4
4
|
*/
|
|
5
5
|
export class CapabilityInvocation extends CapabilityProofPurpose {
|
|
6
6
|
/**
|
|
7
7
|
* @param {object} options - The options.
|
|
8
|
-
* @param {string|
|
|
8
|
+
* @param {string|IDelegatedZcap} [options.capability] - The capability to
|
|
9
9
|
* add/reference in a created proof. A root zcap MUST be passed as its ID
|
|
10
10
|
* string; a delegated zcap must be passed as the full object.
|
|
11
11
|
* @param {string} [options.capabilityAction] - The capability action that is
|
|
@@ -49,7 +49,7 @@ export class CapabilityInvocation extends CapabilityProofPurpose {
|
|
|
49
49
|
* unused (and omitted) when creating an invocation proof.
|
|
50
50
|
*/
|
|
51
51
|
constructor({ capability, capabilityAction, invocationTarget, allowTargetAttenuation, controller, date, expectedAction, expectedRootCapability, expectedTarget, inspectCapabilityChain, maxChainLength, maxClockSkew, maxDelegationTtl, maxTimestampDelta, suite }?: {
|
|
52
|
-
capability?: string |
|
|
52
|
+
capability?: string | IDelegatedZcap;
|
|
53
53
|
capabilityAction?: string;
|
|
54
54
|
invocationTarget?: string;
|
|
55
55
|
allowTargetAttenuation?: boolean;
|
|
@@ -65,7 +65,7 @@ export class CapabilityInvocation extends CapabilityProofPurpose {
|
|
|
65
65
|
maxTimestampDelta?: number;
|
|
66
66
|
suite?: object | object[];
|
|
67
67
|
});
|
|
68
|
-
capability: string | import("
|
|
68
|
+
capability: string | import("@interop/data-integrity-core/zcap").IDelegatedZcap;
|
|
69
69
|
capabilityAction: string;
|
|
70
70
|
invocationTarget: string;
|
|
71
71
|
expectedTarget: string | string[];
|
|
@@ -94,7 +94,7 @@ export class CapabilityInvocation extends CapabilityProofPurpose {
|
|
|
94
94
|
}): Promise<import("@interop/jsonld-signatures").ProofValidateResult>;
|
|
95
95
|
}
|
|
96
96
|
export type InspectCapabilityChain = import("./utils.js").InspectCapabilityChain;
|
|
97
|
-
export type
|
|
97
|
+
export type IDelegatedZcap = import("./utils.js").IDelegatedZcap;
|
|
98
98
|
import { CapabilityProofPurpose } from './CapabilityProofPurpose.js';
|
|
99
99
|
import { CapabilityDelegation } from './CapabilityDelegation.js';
|
|
100
100
|
//# sourceMappingURL=CapabilityInvocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CapabilityInvocation.d.ts","sourceRoot":"","sources":["../../lib/CapabilityInvocation.js"],"names":[],"mappings":"AAOA;;;GAGG;AAEH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,qQA3CG;
|
|
1
|
+
{"version":3,"file":"CapabilityInvocation.d.ts","sourceRoot":"","sources":["../../lib/CapabilityInvocation.js"],"names":[],"mappings":"AAOA;;;GAGG;AAEH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,qQA3CG;QAAwC,UAAU,GAA1C,MAAM,GAAC,cAAc;QAGJ,gBAAgB,GAAjC,MAAM;QAEW,gBAAgB,GAAjC,MAAM;QAGY,sBAAsB,GAAxC,OAAO;QAGU,UAAU,GAA3B,MAAM;QAEuB,IAAI,GAAjC,MAAM,GAAC,IAAI,GAAC,MAAM;QAID,cAAc,GAA/B,MAAM;QAEoB,sBAAsB,GAAhD,MAAM,GAAC,MAAM,EAAE;QAGW,cAAc,GAAxC,MAAM,GAAC,MAAM,EAAE;QAEkB,sBAAsB,GAAvD,sBAAsB;QAGL,cAAc,GAA/B,MAAM;QAEW,YAAY,GAA7B,MAAM;QAIW,gBAAgB,GAAjC,MAAM;QAGW,iBAAiB,GAAlC,MAAM;QAGoB,KAAK,GAA/B,MAAM,GAAC,MAAM,EAAE;KAGzB,EA8FA;IAxBG,gFAA4B;IAC5B,yBAAwC;IACxC,yBAAwC;IAmBxC,kCAAoC;IACpC,uBAAoC;IAIxC,iCAOC;IAED;;;yBA2BC;IAED,6DAEC;IAED;;;;MAEC;IAED;;;;;OA4FC;IAED;;;;0EAgDC;CACF;qCA9UY,OAAO,YAAY,EAAE,sBAAsB;6BAC3C,OAAO,YAAY,EAAE,cAAc;uCAJX,6BAA6B;qCAD/B,2BAA2B"}
|
|
@@ -78,7 +78,7 @@ export class CapabilityProofPurpose extends jsigs.ControllerProofPurpose {
|
|
|
78
78
|
documentLoader: any;
|
|
79
79
|
proof: any;
|
|
80
80
|
}): Promise<{
|
|
81
|
-
dereferencedChain: import("
|
|
81
|
+
dereferencedChain: import("@interop/data-integrity-core/zcap").IZcap[];
|
|
82
82
|
}>;
|
|
83
83
|
_getCapabilityDelegationClass(): void;
|
|
84
84
|
_getTailCapability(): Promise<void>;
|
package/types/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import('./utils.js').RootZcap} RootZcap
|
|
3
|
-
* @typedef {import('./utils.js').DelegatedZcap} DelegatedZcap
|
|
4
|
-
* @typedef {import('./utils.js').Zcap} Zcap
|
|
5
|
-
* @typedef {import('./utils.js').CapabilityDelegationProof} CapabilityDelegationProof
|
|
6
2
|
* @typedef {import('./utils.js').InspectCapabilityChain} InspectCapabilityChain
|
|
7
3
|
* @typedef {import('./utils.js').InspectResult} InspectResult
|
|
8
4
|
* @typedef {import('./utils.js').CapabilityChainDetails} CapabilityChainDetails
|
|
@@ -35,10 +31,6 @@ export { constants };
|
|
|
35
31
|
* @type {Function}
|
|
36
32
|
*/
|
|
37
33
|
export const documentLoader: Function;
|
|
38
|
-
export type RootZcap = import("./utils.js").RootZcap;
|
|
39
|
-
export type DelegatedZcap = import("./utils.js").DelegatedZcap;
|
|
40
|
-
export type Zcap = import("./utils.js").Zcap;
|
|
41
|
-
export type CapabilityDelegationProof = import("./utils.js").CapabilityDelegationProof;
|
|
42
34
|
export type InspectCapabilityChain = import("./utils.js").InspectCapabilityChain;
|
|
43
35
|
export type InspectResult = import("./utils.js").InspectResult;
|
|
44
36
|
export type CapabilityChainDetails = import("./utils.js").CapabilityChainDetails;
|
package/types/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":"AAYA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;;;;;;;GASG;AACH,yEAYC;;;;;AAED;;;;;;;GAOG;AACH,sCAA+E;qCAzClE,OAAO,YAAY,EAAE,sBAAsB;4BAC3C,OAAO,YAAY,EAAE,aAAa;qCAClC,OAAO,YAAY,EAAE,sBAAsB;6BAC3C,OAAO,YAAY,EAAE,cAAc;2BACnC,OAAO,YAAY,EAAE,YAAY;gCACjC,OAAO,YAAY,EAAE,iBAAiB;uCACtC,OAAO,YAAY,EAAE,wBAAwB;2BAV/B,gBAAgB"}
|
package/types/lib/utils.d.ts
CHANGED
|
@@ -6,59 +6,59 @@
|
|
|
6
6
|
* @param {string|string[]} options.controller - The root controller.
|
|
7
7
|
* @param {string} options.invocationTarget - The root invocation target.
|
|
8
8
|
*
|
|
9
|
-
* @returns {
|
|
9
|
+
* @returns {IRootZcap} The root capability.
|
|
10
10
|
*/
|
|
11
11
|
export function createRootCapability({ controller, invocationTarget }: {
|
|
12
12
|
controller: string | string[];
|
|
13
13
|
invocationTarget: string;
|
|
14
|
-
}):
|
|
14
|
+
}): IRootZcap;
|
|
15
15
|
/**
|
|
16
16
|
* Retrieves the controller(s) from a capability.
|
|
17
17
|
*
|
|
18
18
|
* @param {object} options - The options.
|
|
19
|
-
* @param {
|
|
19
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
20
20
|
*
|
|
21
21
|
* @returns {string[]} The controller(s) for the capability.
|
|
22
22
|
*/
|
|
23
23
|
export function getControllers({ capability }: {
|
|
24
|
-
capability:
|
|
24
|
+
capability: IZcap;
|
|
25
25
|
}): string[];
|
|
26
26
|
/**
|
|
27
27
|
* Returns true if the given verification method is a controller (or is
|
|
28
28
|
* controlled by a controller) of the given capability.
|
|
29
29
|
*
|
|
30
30
|
* @param {object} options - The options.
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
32
32
|
* @param {object} options.verificationMethod - The verification method to
|
|
33
33
|
* check.
|
|
34
34
|
*
|
|
35
35
|
* @returns {boolean} `true` if the controller matches, `false` if not.
|
|
36
36
|
*/
|
|
37
37
|
export function isController({ capability, verificationMethod }: {
|
|
38
|
-
capability:
|
|
38
|
+
capability: IZcap;
|
|
39
39
|
verificationMethod: object;
|
|
40
40
|
}): boolean;
|
|
41
41
|
/**
|
|
42
42
|
* Retrieves the allowed actions from a capability.
|
|
43
43
|
*
|
|
44
44
|
* @param {object} options - The options.
|
|
45
|
-
* @param {
|
|
45
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
46
46
|
*
|
|
47
47
|
* @returns {string[]} Allowed actions.
|
|
48
48
|
*/
|
|
49
49
|
export function getAllowedActions({ capability }: {
|
|
50
|
-
capability:
|
|
50
|
+
capability: IZcap;
|
|
51
51
|
}): string[];
|
|
52
52
|
/**
|
|
53
53
|
* Retrieves the target from a capability.
|
|
54
54
|
*
|
|
55
55
|
* @param {object} options - The options.
|
|
56
|
-
* @param {
|
|
56
|
+
* @param {IZcap} options.capability - The authorization capability (zcap).
|
|
57
57
|
*
|
|
58
58
|
* @returns {string} - Capability target.
|
|
59
59
|
*/
|
|
60
60
|
export function getTarget({ capability }: {
|
|
61
|
-
capability:
|
|
61
|
+
capability: IZcap;
|
|
62
62
|
}): string;
|
|
63
63
|
/**
|
|
64
64
|
* Retrieves the delegation proof(s) for a capability that is associated with
|
|
@@ -66,26 +66,26 @@ export function getTarget({ capability }: {
|
|
|
66
66
|
* delegation proofs will cause this function to return an empty array.
|
|
67
67
|
*
|
|
68
68
|
* @param {object} options - The options.
|
|
69
|
-
* @param {
|
|
69
|
+
* @param {IZcap} options.capability - The authorization capability.
|
|
70
70
|
*
|
|
71
|
-
* @returns {
|
|
71
|
+
* @returns {ICapabilityDelegationProof[]} Any `capabilityDelegation` proof
|
|
72
72
|
* objects attached to the given capability.
|
|
73
73
|
*/
|
|
74
74
|
export function getDelegationProofs({ capability }: {
|
|
75
|
-
capability:
|
|
76
|
-
}):
|
|
75
|
+
capability: IZcap;
|
|
76
|
+
}): ICapabilityDelegationProof[];
|
|
77
77
|
/**
|
|
78
78
|
* Gets the `capabilityChain` associated with the given capability.
|
|
79
79
|
*
|
|
80
80
|
* @param {object} options - The options.
|
|
81
|
-
* @param {
|
|
81
|
+
* @param {IZcap} options.capability - The authorization capability.
|
|
82
82
|
*
|
|
83
|
-
* @returns {Array<string|
|
|
83
|
+
* @returns {Array<string|IDelegatedZcap>} The capability chain entries
|
|
84
84
|
* (root to parent), as stored in the delegation proof.
|
|
85
85
|
*/
|
|
86
86
|
export function getCapabilityChain({ capability }: {
|
|
87
|
-
capability:
|
|
88
|
-
}): Array<string |
|
|
87
|
+
capability: IZcap;
|
|
88
|
+
}): Array<string | IDelegatedZcap>;
|
|
89
89
|
/**
|
|
90
90
|
* Determines if the given `invocationTarget` is valid given a
|
|
91
91
|
* `baseInvocationTarget`.
|
|
@@ -116,18 +116,18 @@ export function isValidTarget({ invocationTarget, baseInvocationTarget, allowTar
|
|
|
116
116
|
* given `parentCapability`.
|
|
117
117
|
*
|
|
118
118
|
* @param {object} options - The options.
|
|
119
|
-
* @param {string|
|
|
119
|
+
* @param {string|IZcap} options.parentCapability - The parent capability from
|
|
120
120
|
* which to compute the capability chain (a root zcap ID string, or a full
|
|
121
121
|
* root or delegated zcap object).
|
|
122
122
|
* @param {boolean} options._skipLocalValidationForTesting - Private.
|
|
123
123
|
*
|
|
124
|
-
* @returns {Array<string|
|
|
124
|
+
* @returns {Array<string|IDelegatedZcap>} The computed capability chain to be
|
|
125
125
|
* included in a capability delegation proof.
|
|
126
126
|
*/
|
|
127
127
|
export function computeCapabilityChain({ parentCapability, _skipLocalValidationForTesting }: {
|
|
128
|
-
parentCapability: string |
|
|
128
|
+
parentCapability: string | IZcap;
|
|
129
129
|
_skipLocalValidationForTesting: boolean;
|
|
130
|
-
}): Array<string |
|
|
130
|
+
}): Array<string | IDelegatedZcap>;
|
|
131
131
|
/**
|
|
132
132
|
* Dereferences the capability chain associated with the given capability,
|
|
133
133
|
* ensuring it passes a number of validation checks.
|
|
@@ -152,7 +152,7 @@ export function computeCapabilityChain({ parentCapability, _skipLocalValidationF
|
|
|
152
152
|
* work with both root zcap `a` and `b`).
|
|
153
153
|
*
|
|
154
154
|
* @param {object} options - The options.
|
|
155
|
-
* @param {string|
|
|
155
|
+
* @param {string|IDelegatedZcap} options.capability - The authorization
|
|
156
156
|
* capability to dereference the chain for. Pass a string (the root zcap ID)
|
|
157
157
|
* to dereference a root zcap directly, or a delegated zcap object.
|
|
158
158
|
* @param {Function} options.getRootCapability - A function for dereferencing
|
|
@@ -161,15 +161,15 @@ export function computeCapabilityChain({ parentCapability, _skipLocalValidationF
|
|
|
161
161
|
* @param {number} [options.maxChainLength=10] - The maximum length of the
|
|
162
162
|
* capability delegation chain (this is inclusive of `capability` itself).
|
|
163
163
|
*
|
|
164
|
-
* @returns {Promise<{dereferencedChain:
|
|
164
|
+
* @returns {Promise<{dereferencedChain: IZcap[]}>} Resolves to an object
|
|
165
165
|
* containing the full dereferenced chain ordered root to tail.
|
|
166
166
|
*/
|
|
167
167
|
export function dereferenceCapabilityChain({ capability, getRootCapability, maxChainLength }: {
|
|
168
|
-
capability: string |
|
|
168
|
+
capability: string | IDelegatedZcap;
|
|
169
169
|
getRootCapability: Function;
|
|
170
170
|
maxChainLength?: number;
|
|
171
171
|
}): Promise<{
|
|
172
|
-
dereferencedChain:
|
|
172
|
+
dereferencedChain: IZcap[];
|
|
173
173
|
}>;
|
|
174
174
|
export function checkProofContext({ proof }: {
|
|
175
175
|
proof: any;
|
|
@@ -188,37 +188,33 @@ export function compareTime({ t1, t2, maxClockSkew }: {
|
|
|
188
188
|
maxClockSkew: any;
|
|
189
189
|
}): 0 | 1 | -1;
|
|
190
190
|
/**
|
|
191
|
-
* The zcap object shapes (`
|
|
192
|
-
* `
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
* leading `@` becomes an empty-string key). See `./zcap-types.d.ts`.
|
|
191
|
+
* The zcap object shapes (`IRootZcap`, `IDelegatedZcap`,
|
|
192
|
+
* `ICapabilityDelegationProof`, `IZcap`) live in
|
|
193
|
+
* `@interop/data-integrity-core/zcap` (the canonical home) and are re-imported
|
|
194
|
+
* here as typedefs for JSDoc use.
|
|
196
195
|
*/
|
|
197
|
-
export type
|
|
196
|
+
export type IRootZcap = import("@interop/data-integrity-core/zcap").IRootZcap;
|
|
198
197
|
/**
|
|
199
|
-
* The zcap object shapes (`
|
|
200
|
-
* `
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* leading `@` becomes an empty-string key). See `./zcap-types.d.ts`.
|
|
198
|
+
* The zcap object shapes (`IRootZcap`, `IDelegatedZcap`,
|
|
199
|
+
* `ICapabilityDelegationProof`, `IZcap`) live in
|
|
200
|
+
* `@interop/data-integrity-core/zcap` (the canonical home) and are re-imported
|
|
201
|
+
* here as typedefs for JSDoc use.
|
|
204
202
|
*/
|
|
205
|
-
export type
|
|
203
|
+
export type ICapabilityDelegationProof = import("@interop/data-integrity-core/zcap").ICapabilityDelegationProof;
|
|
206
204
|
/**
|
|
207
|
-
* The zcap object shapes (`
|
|
208
|
-
* `
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* leading `@` becomes an empty-string key). See `./zcap-types.d.ts`.
|
|
205
|
+
* The zcap object shapes (`IRootZcap`, `IDelegatedZcap`,
|
|
206
|
+
* `ICapabilityDelegationProof`, `IZcap`) live in
|
|
207
|
+
* `@interop/data-integrity-core/zcap` (the canonical home) and are re-imported
|
|
208
|
+
* here as typedefs for JSDoc use.
|
|
212
209
|
*/
|
|
213
|
-
export type
|
|
210
|
+
export type IDelegatedZcap = import("@interop/data-integrity-core/zcap").IDelegatedZcap;
|
|
214
211
|
/**
|
|
215
|
-
* The zcap object shapes (`
|
|
216
|
-
* `
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* leading `@` becomes an empty-string key). See `./zcap-types.d.ts`.
|
|
212
|
+
* The zcap object shapes (`IRootZcap`, `IDelegatedZcap`,
|
|
213
|
+
* `ICapabilityDelegationProof`, `IZcap`) live in
|
|
214
|
+
* `@interop/data-integrity-core/zcap` (the canonical home) and are re-imported
|
|
215
|
+
* here as typedefs for JSDoc use.
|
|
220
216
|
*/
|
|
221
|
-
export type
|
|
217
|
+
export type IZcap = import("@interop/data-integrity-core/zcap").IZcap;
|
|
222
218
|
/**
|
|
223
219
|
* An inspection function result.
|
|
224
220
|
*/
|
package/types/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,uEALG;IAAiC,UAAU,EAAnC,MAAM,GAAC,MAAM,EAAE;IACC,gBAAgB,EAAhC,MAAM;CAEd,GAAU,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.js"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,uEALG;IAAiC,UAAU,EAAnC,MAAM,GAAC,MAAM,EAAE;IACC,gBAAgB,EAAhC,MAAM;CAEd,GAAU,SAAS,CASrB;AAED;;;;;;;GAOG;AACH,+CAJG;IAAuB,UAAU,EAAzB,KAAK;CAEb,GAAU,MAAM,EAAE,CAQpB;AAED;;;;;;;;;;GAUG;AACH,iEANG;IAAuB,UAAU,EAAzB,KAAK;IACW,kBAAkB,EAAlC,MAAM;CAGd,GAAU,OAAO,CAMnB;AAED;;;;;;;GAOG;AACH,kDAJG;IAAuB,UAAU,EAAzB,KAAK;CAEb,GAAU,MAAM,EAAE,CAWpB;AAED;;;;;;;GAOG;AACH,0CAJG;IAAuB,UAAU,EAAzB,KAAK;CAEb,GAAU,MAAM,CAKlB;AAED;;;;;;;;;;GAUG;AACH,oDALG;IAAuB,UAAU,EAAzB,KAAK;CAEb,GAAU,0BAA0B,EAAE,CAcxC;AAED;;;;;;;;GAQG;AACH,mDALG;IAAuB,UAAU,EAAzB,KAAK;CAEb,GAAU,KAAK,CAAC,MAAM,GAAC,cAAc,CAAC,CAwBxC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kGAPG;IAAwB,gBAAgB,EAAhC,MAAM;IACU,oBAAoB,EAApC,MAAM;IACW,sBAAsB,EAAvC,OAAO;CAGf,GAAU,OAAO,CAkCnB;AAED;;;;;;;;;;;;GAYG;AACH,6FARG;IAA8B,gBAAgB,EAAtC,MAAM,GAAC,KAAK;IAGK,8BAA8B,EAA/C,OAAO;CAEf,GAAU,KAAK,CAAC,MAAM,GAAC,cAAc,CAAC,CA0ExC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,8FAZG;IAAuC,UAAU,EAAzC,MAAM,GAAC,cAAc;IAGH,iBAAiB;IAGlB,cAAc,GAA/B,MAAM;CAGd,GAAU,OAAO,CAAC;IAAC,iBAAiB,EAAE,KAAK,EAAE,CAAA;CAAC,CAAC,CAkKjD;AAED;;SAQC;AAED;;;YAiBC;AAED;;;SAqEC;AAED;;;;eAOC;;;;;;;wBAQY,OAAO,mCAAmC,EAAE,SAAS;;;;;;;yCACrD,OAAO,mCAAmC,EAAE,0BAA0B;;;;;;;6BACtE,OAAO,mCAAmC,EAAE,cAAc;;;;;;;oBAC1D,OAAO,mCAAmC,EAAE,KAAK;;;;;;;;YAOhD,OAAO;;;;YACP,KAAK;;;;;;;;;;;;;;;QAiBL,MAAM;;;;gBACN,MAAM;;;;;;qBAKN,UAAU,EAAE;;;;;;;yBACZ,cAAc,EAAE;;;;;;;;;;kBAUhB,YAAY;;;;;;;;;;cAQZ,OAAO;;;;;aAEP,iBAAiB,EAAE;;;;;;;;;;wBAQnB,wBAAwB;;;;;;;;;;eAQxB,MAAM"}
|
package/lib/zcap-types.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2018-2026 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Hand-authored object shapes for zcaps. These live in a `.d.ts` (rather than
|
|
6
|
-
// as JSDoc `@typedef`s in `utils.js`) because TypeScript's JSDoc parser cannot
|
|
7
|
-
// express a property named `@context` -- the leading `@` is mangled to an
|
|
8
|
-
// empty-string key (`""`). `utils.js` re-exports these via `@typedef
|
|
9
|
-
// {import('./zcap-types.js').X} X` so the public type names are unchanged.
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A root authorization capability (zcap). Root zcaps are unsigned, have no
|
|
13
|
-
* `expires` field and no delegation proof.
|
|
14
|
-
*/
|
|
15
|
-
export interface RootZcap {
|
|
16
|
-
/** The zcap JSON-LD context URL. */
|
|
17
|
-
'@context': string;
|
|
18
|
-
/** Capability ID (`urn:zcap:root:<encodedTarget>`). */
|
|
19
|
-
id: string;
|
|
20
|
-
/** The DID(s) authorized to invoke. */
|
|
21
|
-
controller: string | string[];
|
|
22
|
-
/** Resource URI this capability grants access to (absolute URI). */
|
|
23
|
-
invocationTarget: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** A proof attached to a delegated capability. */
|
|
27
|
-
export interface CapabilityDelegationProof {
|
|
28
|
-
/** The cryptographic suite type (e.g. `'Ed25519Signature2020'`). */
|
|
29
|
-
type: string;
|
|
30
|
-
/** ISO 8601 date-time the proof was created. */
|
|
31
|
-
created: string;
|
|
32
|
-
/** Verification method URI used to sign. */
|
|
33
|
-
verificationMethod: string;
|
|
34
|
-
/** Always `'capabilityDelegation'`. */
|
|
35
|
-
proofPurpose: 'capabilityDelegation';
|
|
36
|
-
/**
|
|
37
|
-
* Ordered capability chain (root > parent). All entries are string IDs
|
|
38
|
-
* except the last delegated zcap, which is embedded as an object.
|
|
39
|
-
*/
|
|
40
|
-
capabilityChain: (string | DelegatedZcap)[];
|
|
41
|
-
/** The encoded proof value. */
|
|
42
|
-
proofValue: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* A delegated authorization capability (zcap). Delegated capabilities narrow
|
|
47
|
-
* a parent capability and must carry exactly one `capabilityDelegation` proof.
|
|
48
|
-
*/
|
|
49
|
-
export interface DelegatedZcap {
|
|
50
|
-
/** JSON-LD context array; first entry MUST be the zcap context URL. */
|
|
51
|
-
'@context': string[];
|
|
52
|
-
/** Capability ID (absolute URI). */
|
|
53
|
-
id: string;
|
|
54
|
-
/** Parent capability ID (absolute URI). */
|
|
55
|
-
parentCapability: string;
|
|
56
|
-
/** The DID(s) authorized to invoke. */
|
|
57
|
-
controller: string | string[];
|
|
58
|
-
/** Resource URI this capability grants access to (absolute URI). */
|
|
59
|
-
invocationTarget: string;
|
|
60
|
-
/**
|
|
61
|
-
* The action(s) the controller may perform; if absent, no actions are
|
|
62
|
-
* allowed (except for the root zcap).
|
|
63
|
-
*/
|
|
64
|
-
allowedAction?: string | string[];
|
|
65
|
-
/** ISO 8601 date-time when this capability expires. */
|
|
66
|
-
expires: string;
|
|
67
|
-
/** The capability delegation proof(s). */
|
|
68
|
-
proof: CapabilityDelegationProof | CapabilityDelegationProof[];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** A zcap is either a root or a delegated capability. */
|
|
72
|
-
export type Zcap = RootZcap | DelegatedZcap;
|