Skip to content

Commit

Permalink
ACT grantee management (#37)
Browse files Browse the repository at this point in the history
* implement grantee management

* Add POST endpoint + fixes

* Save grantees as pubkey list and fix remove error; CHG: act-handler logger names

* Refactor: pass getter, putter to controller functions

* Refactor: error handling in dynamicaccess; Read cache header only for download handlers

* CHG: grantees ref is encrypted and added to history ref + tests

* Fix nil pointer dereference panic

* CHG: put actref in handlegrantees; Add: pin, tag,deferred headers

* CHG: pass loadsave to handlers; check if history address is nil

* FIX: re-init history so that it can be saved; only add publisher if histroy is zero

* make act timestamp optional

* fix revoke grantees

* Fix: Act timestamp header nil check; Uploadhandler UT

* Fix controller nil pointer deref

---------

Co-authored-by: Bálint Ujvári <[email protected]>
  • Loading branch information
Kexort and bosi95 authored May 13, 2024
1 parent e854db9 commit 85c041a
Show file tree
Hide file tree
Showing 20 changed files with 1,113 additions and 292 deletions.
4 changes: 2 additions & 2 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ type Service struct {
feedFactory feeds.Factory
signer crypto.Signer
post postage.Service
dac dynamicaccess.Service
dac dynamicaccess.Controller
postageContract postagecontract.Interface
probe *Probe
metricsRegistry *prometheus.Registry
Expand Down Expand Up @@ -253,7 +253,7 @@ type ExtraOptions struct {
Pss pss.Interface
FeedFactory feeds.Factory
Post postage.Service
Dac dynamicaccess.Service
Dac dynamicaccess.Controller
PostageContract postagecontract.Interface
Staking staking.Contract
Steward steward.Interface
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ type testServerOptions struct {
PostageContract postagecontract.Interface
StakingContract staking.Contract
Post postage.Service
Dac dynamicaccess.Service
Dac dynamicaccess.Controller
Steward steward.Interface
WsHeaders http.Header
Authenticator auth.Authenticator
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (s *Service) bytesUploadHandler(w http.ResponseWriter, r *http.Request) {

encryptedReference := reference
if headers.Act {
encryptedReference, err = s.actEncryptionHandler(r.Context(), logger, w, putter, reference, headers.HistoryAddress)
encryptedReference, err = s.actEncryptionHandler(r.Context(), w, putter, reference, headers.HistoryAddress)
if err != nil {
jsonhttp.InternalServerError(w, errActUpload)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/bzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (s *Service) fileUploadHandler(

encryptedReference := manifestReference
if act {
encryptedReference, err = s.actEncryptionHandler(r.Context(), logger, w, putter, manifestReference, historyAddress)
encryptedReference, err = s.actEncryptionHandler(r.Context(), w, putter, manifestReference, historyAddress)
if err != nil {
jsonhttp.InternalServerError(w, errActUpload)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (s *Service) chunkUploadHandler(w http.ResponseWriter, r *http.Request) {

encryptedReference := chunk.Address()
if headers.Act {
encryptedReference, err = s.actEncryptionHandler(r.Context(), logger, w, putter, chunk.Address(), headers.HistoryAddress)
encryptedReference, err = s.actEncryptionHandler(r.Context(), w, putter, chunk.Address(), headers.HistoryAddress)
if err != nil {
jsonhttp.InternalServerError(w, errActUpload)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/dirs.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (s *Service) dirUploadHandler(

encryptedReference := reference
if act {
encryptedReference, err = s.actEncryptionHandler(r.Context(), logger, w, putter, reference, historyAddress)
encryptedReference, err = s.actEncryptionHandler(r.Context(), w, putter, reference, historyAddress)
if err != nil {
jsonhttp.InternalServerError(w, errActUpload)
return
Expand Down
Loading

0 comments on commit 85c041a

Please sign in to comment.