Documentation
¶
Overview ¶
Package swarm_act provides an integration of Swarm's Access Control Trie (ACT) for user-based access control. It enables initializing access control with a user's key and allows adding or revoking grantees at the user level.
Index ¶
- type ACT
- func (a *ACT) CreateGrantee(ctx context.Context, historyAddress swarm.Address, list []*ecdsa.PublicKey) (*api.GranteesPostResponse, error)
- func (a *ACT) GetGrantees(ctx context.Context, granteesAddress swarm.Address) ([]*ecdsa.PublicKey, error)
- func (a *ACT) HandleDownload(ctx context.Context, reference, historyAddress swarm.Address, ...) (swarm.Address, error)
- func (a *ACT) HandleUpload(ctx context.Context, reference, historyAddress swarm.Address) (*api.GranteesPostResponse, error)
- func (a *ACT) RevokeGrant(ctx context.Context, granteesAddress, historyAddress swarm.Address, ...) (*api.GranteesPostResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACT ¶
type ACT struct {
// contains filtered or unexported fields
}
ACT represents the Access Control Trie integration for user-based access control. It encapsulates the access control controller, the user's public key, and the PutGetter client.
func New ¶
func New(bee blockstore.Client, key *ecdsa.PrivateKey, stamp string) *ACT
New initializes a new ACT instance with the given user's private key, Bee client, and postage stamp ID.
func (*ACT) CreateGrantee ¶
func (a *ACT) CreateGrantee(ctx context.Context, historyAddress swarm.Address, list []*ecdsa.PublicKey) (*api.GranteesPostResponse, error)
CreateGrantee adds new grantees to the access control list. It creates a new encrypted grantee list and updates the history reference.
func (*ACT) GetGrantees ¶
func (a *ACT) GetGrantees(ctx context.Context, granteesAddress swarm.Address) ([]*ecdsa.PublicKey, error)
GetGrantees retrieves the list of current grantees from the access control list.
func (*ACT) HandleDownload ¶
func (a *ACT) HandleDownload(ctx context.Context, reference, historyAddress swarm.Address, publisher *ecdsa.PublicKey, ts int64) (swarm.Address, error)
HandleDownload processes the download operation with access control. It checks the user's permissions and returns the address of the data if access is granted.
func (*ACT) HandleUpload ¶
func (a *ACT) HandleUpload(ctx context.Context, reference, historyAddress swarm.Address) (*api.GranteesPostResponse, error)
HandleUpload processes the upload operation with access control. It updates the references to the data and history feed.