Closed LiranCohen closed 3 months ago
Latest commit: 2b0eda3d0d3dc0d8efc6353548da16793e3888e2
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Attention: Patch coverage is 99.76134%
with 3 lines
in your changes missing coverage. Please review.
Project coverage is 93.29%. Comparing base (
e93f109
) to head (2b0eda3
).
TBDocs Report
✅ No errors or warnings
packages/api/src/index.ts
packages/crypto/src/index.ts
packages/crypto-aws-kms/src/index.ts
packages/dids/src/index.ts
packages/credentials/src/index.ts
TBDocs Report Updated at 2024-08-12T20:26:41Z 20f317d
This refactors a lot of what's in https://github.com/TBD54566975/web5-js/pull/824 with regards to creating/fetching grants.
Satisfies: https://github.com/TBD54566975/web5-js/issues/827
PermissionsApi
Introduces a
PermissionsApi
interface and anAgentPermissionsApi
concrete implementation.The interface implements the following methods
fetchGrants
,fetchRequests
,isGrantRevoked
,createGrant
,createRequest
,createRevocation
as convenience methods for dealing with the built-in permission protocol records.The
AgentPermissionsApi
implements an additional static methodmatchGrantFromArray
which was moved from aPermissionsUtil
class, which is used to find the appropriate grant to use when authoring a message.dwn.connected
A Private API usedin a connected state to find and cache the correct grants to use for the request.
dwn.permissions
A Permissions API which implements
request
,grant
,queryRequests
, andqueryGrants
that a user can utilizeThe
Web5
permissions api introduces 3 helper classes to represent permissions:PermissionRequest
Class to represent a permission request record. It implements convenience methods similar to the
Record
class where you canstore()
,import()
orsend()
the underlying request record. Additionally agrant()
method will create aPermissionGrant
object.PermissionGrant
Class to represent a grant record. It implements convenience methods similar to the
Record
class where you canstore()
,import()
orsend()
the underlying grant record. Additionally arevoke()
method will create aGrantRevocation
object, andisRevoked()
will check if the underlying grant has been revoked.GrantRevocation
Class to represent a permission grant revocation record. It implements convenience methods similar to the
Record
class where you canstore()
orsend()
the underlying revocation record.