@digitalbazaar/ezcap-express 4.4.0 → 4.5.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/CHANGELOG.md +9 -0
- package/lib/revoke.js +34 -34
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @digitalbazaar/ezcap-express Changelog
|
|
2
2
|
|
|
3
|
+
## 4.5.0 - 2021-12-17
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Add `_createGetRevocationRootController` wrapper around
|
|
7
|
+
`_getRevocationRootController` and pass `getRootController` to it.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Add tests for `authorizeZcapRevocation`.
|
|
11
|
+
|
|
3
12
|
## 4.4.0 - 2021-12-15
|
|
4
13
|
|
|
5
14
|
### Added
|
package/lib/revoke.js
CHANGED
|
@@ -53,7 +53,9 @@ export function authorizeZcapRevocation({
|
|
|
53
53
|
onError
|
|
54
54
|
}),
|
|
55
55
|
authorizeZcapInvocationAfterParse({
|
|
56
|
-
documentLoader,
|
|
56
|
+
documentLoader,
|
|
57
|
+
getRootController: _createGetRevocationRootController(
|
|
58
|
+
{getRootController}),
|
|
57
59
|
suiteFactory, allowTargetAttenuation, inspectCapabilityChain, onError
|
|
58
60
|
})
|
|
59
61
|
];
|
|
@@ -131,41 +133,39 @@ async function _verifyDelegation({
|
|
|
131
133
|
return results;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
revocationsSubPath = '/revocations/'
|
|
136
|
+
function _createGetRevocationRootController({
|
|
137
|
+
getRootController, revocationsSubPath = '/revocations/'
|
|
137
138
|
}) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
controller value for the target.
|
|
147
|
-
|
|
148
|
-
This approach allows any party that has delegated a zcap or received one
|
|
149
|
-
to be able to send it for revocation. Subsequent code (in the revocation
|
|
150
|
-
route handler) will confirm that the delegation is proper and the zcap from
|
|
151
|
-
which it was delegated has not itself been revoked.
|
|
152
|
-
|
|
153
|
-
To be clear, if the delegation chain is:
|
|
154
|
-
|
|
155
|
-
root -> A -> B
|
|
156
|
-
|
|
157
|
-
Any zcap controller in the chain of B may invoke a root zcap with a
|
|
158
|
-
`target` of `<baseUrl>/revocations/<ID of B>` (and an ID of
|
|
159
|
-
`urn:zcap:root:encodeURIComponent(<baseUrl>/revocations/<ID of B>)`). This
|
|
160
|
-
means that `root`, `A`, or `B` may revoke `B`.
|
|
161
|
-
|
|
162
|
-
As long no other zcap in the chain of `B` (e.g., `A`) has already been
|
|
163
|
-
revoked, then `B` will be revoked and stored as a revocation until `B`
|
|
164
|
-
expires. */
|
|
139
|
+
return async function _getRevocationRootController({
|
|
140
|
+
req, rootCapabilityId, rootInvocationTarget
|
|
141
|
+
}) {
|
|
142
|
+
// if `revocations` is not in the root invocation target, then defer to
|
|
143
|
+
// `getRootController` to try and provide the root controller
|
|
144
|
+
if(!rootInvocationTarget.includes(revocationsSubPath)) {
|
|
145
|
+
return getRootController({req, rootCapabilityId, rootInvocationTarget});
|
|
146
|
+
}
|
|
165
147
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
148
|
+
/* Note: If the invocation target is a zcap-specific revocation endpoint,
|
|
149
|
+
we use all zcap controllers from the submitted zcap's chain as the root
|
|
150
|
+
controller value for the target.
|
|
151
|
+
This approach allows any party that has delegated a zcap or received one
|
|
152
|
+
to be able to send it for revocation. Subsequent code (in the revocation
|
|
153
|
+
route handler) will confirm that the delegation is proper and the zcap
|
|
154
|
+
from which it was delegated has not itself been revoked.
|
|
155
|
+
To be clear, if the delegation chain is:
|
|
156
|
+
root -> A -> B
|
|
157
|
+
Any zcap controller in the chain of B may invoke a root zcap with a
|
|
158
|
+
`target` of `<baseUrl>/revocations/<ID of B>` (and an ID of
|
|
159
|
+
`urn:zcap:root:encodeURIComponent(<baseUrl>/revocations/<ID of B>)`). This
|
|
160
|
+
means that `root`, `A`, or `B` may revoke `B`.
|
|
161
|
+
As long no other zcap in the chain of `B` (e.g., `A`) has already been
|
|
162
|
+
revoked, then `B` will be revoked and stored as a revocation until `B`
|
|
163
|
+
expires. */
|
|
164
|
+
|
|
165
|
+
// use all `chainControllers`
|
|
166
|
+
// presumes `verifyCapabilityDelegation` middleware already called
|
|
167
|
+
return req.zcapRevocation.chainControllers;
|
|
168
|
+
};
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function _captureChainControllers({inspectCapabilityChain, chainControllers}) {
|