- Update dependencies:
@digitalbazaar/zcap@9
jsonld-signatures@11
@digitalbazaar/http-signature-zcap-verify@11.1
.
- BREAKING: Convert to module (ESM).
- BREAKING: Require Node.js >=14.
- BREAKING: Dependencies require Web Crypto API. Node.js 14 users need to install an appropriate polyfill.
- Update dependencies.
- Lint module.
- If a capability is being revoked, it is exposed via
req.ezcap.capabilityToRevoke
to enable applications to implement smart cache logic, inline with using theinvocationParameters
value for the same purpose.
- Provide access to
invocationParameters
onreq.ezcap
. These parameters include the invoked capability, capability action, proof purpose, and proof meta data. This information is set onreq.ezcap
just prior to validating the proof purpose so it should not be considered trusted until after the zcap invocation has been authorized. It can be useful, however, in helping create more resilient systems that use caches, e.g., if the root controller for the target object has been cached and could have changed, then the invocation parameters could potentially be used to help can application determine whether it should check for a more fresh root controller ingetRootController
.
- BREAKING: Better future proof conventional zcap API endpoints by
prefixing
/revocations
route with/zcaps
.
- Use zcap@7.1 and http-signature-zcap-verify@10.1 to include
dereferencedChain
in verification results andreq.zcap
.
- Update dependencies.
- Add optional parameters
maxChainLength
,maxDelegationTtl
, andmaxTimestampDelta
to allow for more fine grained control. These parameters all have defaults in@digitalbazaar/zcap
that could previously not be set to other values at this layer. - BREAKING: Add required
getVerifier
async function parameter. The function will be passed{keyId, documentLoader}
to verify an HTTP signature and must return{verifier, verificationMethod}
. Theverifier
object must have averify
function that takes{data, signature}
and returns a boolean indicating whether theUint8Array
signature
is verified against theUint8Array
data
-- or throws an error if there is a reason the cryptographic signature verification check cannot be run. - Include
capabilityChain
inreq.zcapRevocation
when using revocation middleware. This property includes the entire dereferenced chain.
-
BREAKING: Replace broken-out expected value parameters (e.g.,
expectedHost
,expectedTarget
), including duplicative / optional parameters (e.g.,expectedAction
,getExpectedAction
) with a single async functiongetExpectedValues({req})
that returns all required (and any optional) expected values. This removes some optionality and simplifies function signatures -- also allowing callers to decide how they want to provide this information (e.g., by calling individual functions from withingetExpectedValues
or whatever else). -
BREAKING: The
authorizeZcapRevocation
middleware may now only be used on routes ending in/revocations/:revocationId
. The API params have also changed as the only expected value that is needed from the user isexpectedHost
. The rest of the expected values are hard coded according to a conventional pattern for supporting revocation of any zcaps delegated from a root capability for a service object. The service object's root capability MUST have an invocation target that matches the service object's URL (aka its "ID",<serviceObjectId>
). So for the absolute URL:<serviceObjectId>/revocations/:revocationId
A zcap can only be revoked using the middleware if its chain has a root zcap with an invocation target that is prefixed with
<serviceObjectId>
. The middleware will use theexpectedHost
value to construct the absolute URL. -
BREAKING: Require
suiteFactory
parameter, no default cryptosuites are included with this package to ensure it is decoupled from particular cryptosuites.
- BREAKING: HTTP status error codes have been fixed so that client errors will result in 4xx status codes instead of 5xx status codes.
- BREAKING: Remove
getExpectedRootCapabilityId
as there have been no use cases that have needed it. - BREAKING: Remove deprecated
suite
param, usesuiteFactory
instead.
- Add
_createGetRevocationRootController
wrapper around_getRevocationRootController
and passgetRootController
to it.
- Add tests for
authorizeZcapRevocation
.
- Add additional tests.
- Fix
expectedAction
to bewrite
forDELETE
method. - Throw error when no
expectedAction
is given for a given HTTP method and provide defaults for all common HTTP methods.
- Allow any controller in a delegated zcap's chain to revoke it. This authority
is inherent in delegation and is now reflected in code. This feature gives
delegators more fine-grained control to revoke zcaps that they did not
delegate directly but one of their delegates did, allowing them to stop
specific zcap usage without having to revoke more of the chain. It also
gives zcap controllers the ability to revoke their own zcaps (if desired)
and adds a sanity check to prevent the revocation of root zcaps that use
the
urn:zcap:root:
ID scheme.
- Add
suiteFactory
parameter to middleware creation functions. AsuiteFactory
function should be passed and return the supported LD proof suite (or an array of supported LD proof suites) that is supported for authorizing zcap invocations and verifying capability chains. - Add
authorizeZcapRevocation
middleware that can be attached to root container/object endpoints to enable revocation of zcaps that have been delegated to use them. This version assumes that the revocations endpoint will follow this RESTful format:<rootObjectUrl>/revocations/<zcapId>
and that the body will be JSON and include acapability
member with the zcap to revoke. Future versions may allow for greater flexibility.
- Deprecate passing a
suite
to any middleware creation functions. Instead,suiteFactory
should be passed. The next major version will removesuite
. This approach allows this library to remove npm dependencies that provide cryptographic suites preventing this library from being affected when those dependencies need to change.
- Updated dependencies.
- Updated http-signature-zcap-verify to 8.1.x to bring in optimizations for controllers that use DID Documents.
- Fix http-signature-zcap-verify dependency to use 8.x to function properly with updated ed25519 libs.
- BREAKING: Updated to use
@digitalbazaar/ed25519-signature-2020
3.x and related libraries. These changes include breaking fixes to key formats.
- Fix bug with erroneously detecting request bodies. Some body
parsing middleware for express/connect (e.g., the main body-parser
npm package) will set a request body to an empty object even when
no body is present. This previously caused an error to be thrown
because no body digest header was present. The code has been updated
to check for http body headers per the spec now (instead of trusting
the
req.body
value) and it will set thereq.body
value toundefined
if it is not present.
- Fix error handling bugs. Http signature errors thrown by the
middleware created via
authorizeZcapInvocation
will now be properly passed to theonError
handler.
- Add missing
allowTargetAttenuation
option that defaults totrue
to support RESTful-based attenuated delegation as the documentation describes.
- Verify HTTP "digest" header when a "content-type" header or body is present.
- Add ability to specify an
inspectCapabilityChain
hook.
- Add optional
getExpectedAction({req})
hook to provide expected action based on, e.g., request body vs. HTTP method.
- BREAKING: Change the default signature suite in
authorizeZcapInvocation
toEd25519Signature2020
(wasEd25519Signature2018
before). This change should have been included in the 3.0 release.
- Remove
jsonld-signatures
dependency.
- BREAKING: Use
http-signature-zcap-verify@5
which only supportsEd25519Signature2020
proofs.
- Add optional
onError
handler for customizable error handling.
- BREAKING: Replace
expectedTarget
parameter withgetExpectedTarget
.getExpectedTarget
is an async function used to return the expected target(s) for the invoked capability. - BREAKING: Remove the
logger
parameter. Errors may now be logged by theonError
handler.
- Use
http-signature-zcap-verify@4
.
- Initial commit, see individual commits for history.