@digitalbazaar/ezcap-express 6.0.0 → 6.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/lib/authorize.js +8 -0
- package/package.json +2 -2
- package/CHANGELOG.md +0 -230
package/lib/authorize.js
CHANGED
|
@@ -106,6 +106,14 @@ export function authorizeZcapInvocationAfterParse({
|
|
|
106
106
|
suite: await suiteFactory({req}),
|
|
107
107
|
headers,
|
|
108
108
|
expectedHost,
|
|
109
|
+
async beforeValidatePurpose({
|
|
110
|
+
purpose, proof, capability, capabilityAction
|
|
111
|
+
}) {
|
|
112
|
+
// provide access to invocation parameters
|
|
113
|
+
req.ezcap.invocationParameters = {
|
|
114
|
+
purpose, proof, capability, capabilityAction
|
|
115
|
+
};
|
|
116
|
+
},
|
|
109
117
|
documentLoader: helpers.createRootCapabilityLoader({
|
|
110
118
|
documentLoader, getRootController, req
|
|
111
119
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalbazaar/ezcap-express",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"main": "lib",
|
|
5
5
|
"module": "main.js",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@digitalbazaar/http-digest-header": "^1.0.1",
|
|
26
26
|
"@digitalbazaar/http-signature-header": "^4.0.1",
|
|
27
|
-
"@digitalbazaar/http-signature-zcap-verify": "^10.
|
|
27
|
+
"@digitalbazaar/http-signature-zcap-verify": "^10.2.0",
|
|
28
28
|
"@digitalbazaar/zcap": "^7.1.0",
|
|
29
29
|
"assert-plus": "^1.0.0",
|
|
30
30
|
"esm": "^3.2.25",
|
package/CHANGELOG.md
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
# @digitalbazaar/ezcap-express Changelog
|
|
2
|
-
|
|
3
|
-
## 6.0.0 - 2022-03-01
|
|
4
|
-
|
|
5
|
-
### Changed
|
|
6
|
-
- **BREAKING**: Better future proof conventional zcap API endpoints by
|
|
7
|
-
prefixing `/revocations` route with `/zcaps`.
|
|
8
|
-
|
|
9
|
-
## 5.1.0 - 2022-01-14
|
|
10
|
-
|
|
11
|
-
### Added
|
|
12
|
-
- Use zcap@7.1 and http-signature-zcap-verify@10.1 to include
|
|
13
|
-
`dereferencedChain` in verification results and `req.zcap`.
|
|
14
|
-
|
|
15
|
-
## 5.0.1 - 2022-01-11
|
|
16
|
-
|
|
17
|
-
### Changed
|
|
18
|
-
- Update dependencies.
|
|
19
|
-
|
|
20
|
-
## 5.0.0 - 2022-01-11
|
|
21
|
-
|
|
22
|
-
### Added
|
|
23
|
-
- Add optional parameters `maxChainLength`, `maxDelegationTtl`, and
|
|
24
|
-
`maxTimestampDelta` to allow for more fine grained control. These parameters
|
|
25
|
-
all have defaults in `@digitalbazaar/zcap` that could previously not be set
|
|
26
|
-
to other values at this layer.
|
|
27
|
-
- **BREAKING**: Add required `getVerifier` async function parameter. The
|
|
28
|
-
function will be passed `{keyId, documentLoader}` to verify an HTTP signature
|
|
29
|
-
and must return `{verifier, verificationMethod}`. The `verifier` object must
|
|
30
|
-
have a `verify` function that takes `{data, signature}` and returns a
|
|
31
|
-
boolean indicating whether the `Uint8Array` `signature` is verified
|
|
32
|
-
against the `Uint8Array` `data` -- or throws an error if there is a reason
|
|
33
|
-
the cryptographic signature verification check cannot be run.
|
|
34
|
-
- Include `capabilityChain` in `req.zcapRevocation` when using revocation
|
|
35
|
-
middleware. This property includes the entire dereferenced chain.
|
|
36
|
-
|
|
37
|
-
### Changed
|
|
38
|
-
- **BREAKING**: Replace broken-out expected value parameters (e.g.,
|
|
39
|
-
`expectedHost`, `expectedTarget`), including duplicative / optional
|
|
40
|
-
parameters (e.g., `expectedAction`, `getExpectedAction`) with a single
|
|
41
|
-
async function `getExpectedValues({req})` that returns all required (and any
|
|
42
|
-
optional) expected values. This removes some optionality and simplifies
|
|
43
|
-
function signatures -- also allowing callers to decide how they want
|
|
44
|
-
to provide this information (e.g., by calling individual functions from
|
|
45
|
-
within `getExpectedValues` or whatever else).
|
|
46
|
-
- **BREAKING**: The `authorizeZcapRevocation` middleware may now only be used
|
|
47
|
-
on routes ending in `/revocations/:revocationId`. The API params have also
|
|
48
|
-
changed as the only expected value that is needed from the user is
|
|
49
|
-
`expectedHost`. The rest of the expected values are hard coded according to
|
|
50
|
-
a conventional pattern for supporting revocation of any zcaps delegated from
|
|
51
|
-
a root capability for a service object. The service object's root capability
|
|
52
|
-
MUST have an invocation target that matches the service object's URL (aka its
|
|
53
|
-
"ID", `<serviceObjectId>`). So for the absolute URL:
|
|
54
|
-
|
|
55
|
-
`<serviceObjectId>/revocations/:revocationId`
|
|
56
|
-
|
|
57
|
-
A zcap can only be revoked using the middleware if its chain has a root
|
|
58
|
-
zcap with an invocation target that is prefixed with `<serviceObjectId>`.
|
|
59
|
-
The middleware will use the `expectedHost` value to construct the absolute
|
|
60
|
-
URL.
|
|
61
|
-
- **BREAKING**: Require `suiteFactory` parameter, no default cryptosuites are
|
|
62
|
-
included with this package to ensure it is decoupled from particular
|
|
63
|
-
cryptosuites.
|
|
64
|
-
|
|
65
|
-
### Fixed
|
|
66
|
-
- **BREAKING**: HTTP status error codes have been fixed so that client errors
|
|
67
|
-
will result in 4xx status codes instead of 5xx status codes.
|
|
68
|
-
|
|
69
|
-
### Remove
|
|
70
|
-
- **BREAKING**: Remove `getExpectedRootCapabilityId` as there have been no
|
|
71
|
-
use cases that have needed it.
|
|
72
|
-
- **BREAKING**: Remove deprecated `suite` param, use `suiteFactory` instead.
|
|
73
|
-
|
|
74
|
-
## 4.5.0 - 2021-12-17
|
|
75
|
-
|
|
76
|
-
### Fixed
|
|
77
|
-
- Add `_createGetRevocationRootController` wrapper around
|
|
78
|
-
`_getRevocationRootController` and pass `getRootController` to it.
|
|
79
|
-
|
|
80
|
-
### Added
|
|
81
|
-
- Add tests for `authorizeZcapRevocation`.
|
|
82
|
-
|
|
83
|
-
## 4.4.0 - 2021-12-15
|
|
84
|
-
|
|
85
|
-
### Added
|
|
86
|
-
- Add additional tests.
|
|
87
|
-
|
|
88
|
-
## 4.3.1 - 2021-12-13
|
|
89
|
-
|
|
90
|
-
### Fixed
|
|
91
|
-
- Fix `expectedAction` to be `write` for `DELETE` method.
|
|
92
|
-
- Throw error when no `expectedAction` is given for a given HTTP method and
|
|
93
|
-
provide defaults for all common HTTP methods.
|
|
94
|
-
|
|
95
|
-
## 4.3.0 - 2021-12-10
|
|
96
|
-
|
|
97
|
-
### Added
|
|
98
|
-
- Allow any controller in a delegated zcap's chain to revoke it. This authority
|
|
99
|
-
is inherent in delegation and is now reflected in code. This feature gives
|
|
100
|
-
delegators more fine-grained control to revoke zcaps that they did not
|
|
101
|
-
delegate directly but one of their delegates did, allowing them to stop
|
|
102
|
-
specific zcap usage without having to revoke more of the chain. It also
|
|
103
|
-
gives zcap controllers the ability to revoke their own zcaps (if desired)
|
|
104
|
-
and adds a sanity check to prevent the revocation of root zcaps that use
|
|
105
|
-
the `urn:zcap:root:` ID scheme.
|
|
106
|
-
|
|
107
|
-
## 4.2.0 - 2021-08-26
|
|
108
|
-
|
|
109
|
-
### Added
|
|
110
|
-
- Add `suiteFactory` parameter to middleware creation functions. A
|
|
111
|
-
`suiteFactory` function should be passed and return the supported LD proof
|
|
112
|
-
suite (or an array of supported LD proof suites) that is supported for
|
|
113
|
-
authorizing zcap invocations and verifying capability chains.
|
|
114
|
-
- Add `authorizeZcapRevocation` middleware that can be attached to root
|
|
115
|
-
container/object endpoints to enable revocation of zcaps that have been
|
|
116
|
-
delegated to use them. This version assumes that the revocations endpoint
|
|
117
|
-
will follow this RESTful format: `<rootObjectUrl>/revocations/<zcapId>`
|
|
118
|
-
and that the body will be JSON and include a `capability` member with
|
|
119
|
-
the zcap to revoke. Future versions may allow for greater flexibility.
|
|
120
|
-
|
|
121
|
-
### Changed
|
|
122
|
-
- Deprecate passing a `suite` to any middleware creation functions. Instead,
|
|
123
|
-
`suiteFactory` should be passed. The next major version will remove `suite`.
|
|
124
|
-
This approach allows this library to remove npm dependencies that provide
|
|
125
|
-
cryptographic suites preventing this library from being affected when those
|
|
126
|
-
dependencies need to change.
|
|
127
|
-
|
|
128
|
-
## 4.1.1 - 2021-07-21
|
|
129
|
-
|
|
130
|
-
### Changed
|
|
131
|
-
- Updated dependencies.
|
|
132
|
-
|
|
133
|
-
## 4.1.0 - 2021-07-11
|
|
134
|
-
|
|
135
|
-
### Changed
|
|
136
|
-
- Updated http-signature-zcap-verify to 8.1.x to bring in optimizations
|
|
137
|
-
for controllers that use DID Documents.
|
|
138
|
-
|
|
139
|
-
## 4.0.1 - 2021-07-10
|
|
140
|
-
|
|
141
|
-
### Fixed
|
|
142
|
-
- Fix http-signature-zcap-verify dependency to use 8.x to function
|
|
143
|
-
properly with updated ed25519 libs.
|
|
144
|
-
|
|
145
|
-
## 4.0.0 - 2021-07-10
|
|
146
|
-
|
|
147
|
-
### Changed
|
|
148
|
-
- **BREAKING**: Updated to use `@digitalbazaar/ed25519-signature-2020` 3.x
|
|
149
|
-
and related libraries. These changes include breaking fixes to key
|
|
150
|
-
formats.
|
|
151
|
-
|
|
152
|
-
## 3.4.2 - 2021-07-10
|
|
153
|
-
|
|
154
|
-
### Fixed
|
|
155
|
-
- Fix bug with erroneously detecting request bodies. Some body
|
|
156
|
-
parsing middleware for express/connect (e.g., the main body-parser
|
|
157
|
-
npm package) will set a request body to an empty object even when
|
|
158
|
-
no body is present. This previously caused an error to be thrown
|
|
159
|
-
because no body digest header was present. The code has been updated
|
|
160
|
-
to check for http body headers per the spec now (instead of trusting
|
|
161
|
-
the `req.body` value) and it will set the `req.body` value to
|
|
162
|
-
`undefined` if it is not present.
|
|
163
|
-
|
|
164
|
-
## 3.4.1 - 2021-07-10
|
|
165
|
-
|
|
166
|
-
### Fixed
|
|
167
|
-
- Fix error handling bugs. Http signature errors thrown by the
|
|
168
|
-
middleware created via `authorizeZcapInvocation` will now be
|
|
169
|
-
properly passed to the `onError` handler.
|
|
170
|
-
|
|
171
|
-
## 3.4.0 - 2021-06-28
|
|
172
|
-
|
|
173
|
-
### Added
|
|
174
|
-
- Add missing `allowTargetAttenuation` option that defaults to `true`
|
|
175
|
-
to support RESTful-based attenuated delegation as the documentation
|
|
176
|
-
describes.
|
|
177
|
-
|
|
178
|
-
## 3.3.0 - 2021-05-19
|
|
179
|
-
|
|
180
|
-
### Added
|
|
181
|
-
- Verify HTTP "digest" header when a "content-type" header or body is present.
|
|
182
|
-
|
|
183
|
-
## 3.2.0 - 2021-05-13
|
|
184
|
-
|
|
185
|
-
### Added
|
|
186
|
-
- Add ability to specify an `inspectCapabilityChain` hook.
|
|
187
|
-
|
|
188
|
-
## 3.1.0 - 2021-05-11
|
|
189
|
-
|
|
190
|
-
### Added
|
|
191
|
-
- Add optional `getExpectedAction({req})` hook to provide expected action
|
|
192
|
-
based on, e.g., request body vs. HTTP method.
|
|
193
|
-
|
|
194
|
-
## 3.0.1 - 2021-04-06
|
|
195
|
-
|
|
196
|
-
### Fixed
|
|
197
|
-
- **BREAKING**: Change the default signature suite in `authorizeZcapInvocation`
|
|
198
|
-
to `Ed25519Signature2020` (was `Ed25519Signature2018` before). This change
|
|
199
|
-
should have been included in the 3.0 release.
|
|
200
|
-
|
|
201
|
-
### Changed
|
|
202
|
-
- Remove `jsonld-signatures` dependency.
|
|
203
|
-
|
|
204
|
-
## 3.0.0 - 2021-04-01
|
|
205
|
-
|
|
206
|
-
### Changed
|
|
207
|
-
- **BREAKING**: Use `http-signature-zcap-verify@5` which only supports
|
|
208
|
-
`Ed25519Signature2020` proofs.
|
|
209
|
-
|
|
210
|
-
## 2.0.0 - 2021-03-29
|
|
211
|
-
|
|
212
|
-
### Added
|
|
213
|
-
- Add optional `onError` handler for customizable error handling.
|
|
214
|
-
|
|
215
|
-
### Changed
|
|
216
|
-
- **BREAKING**: Replace `expectedTarget` parameter with `getExpectedTarget`.
|
|
217
|
-
`getExpectedTarget` is an async function used to return the expected
|
|
218
|
-
target(s) for the invoked capability.
|
|
219
|
-
- **BREAKING**: Remove the `logger` parameter. Errors may now be logged by the
|
|
220
|
-
`onError` handler.
|
|
221
|
-
|
|
222
|
-
## 1.0.1 - 2021-03-02
|
|
223
|
-
|
|
224
|
-
### Fixed
|
|
225
|
-
- Use `http-signature-zcap-verify@4`.
|
|
226
|
-
|
|
227
|
-
## 1.0.0 - 2021-03-02
|
|
228
|
-
|
|
229
|
-
### Added
|
|
230
|
-
- Initial commit, see individual commits for history.
|