Commit a677c822 authored by Sietse Ringers's avatar Sietse Ringers

refactor: remove revocation update POSTing

parent 520e5ba1
......@@ -17,7 +17,6 @@ import (
"github.com/alexandrevicenzi/go-sse"
"github.com/go-errors/errors"
"github.com/jasonlvhit/gocron"
"github.com/privacybydesign/gabi/revocation"
"github.com/privacybydesign/irmago"
"github.com/privacybydesign/irmago/server"
"github.com/sirupsen/logrus"
......@@ -461,18 +460,6 @@ func (s *Server) handleRevocationMessage(
return server.BinaryResponse(updates[*counter], rerr, headers)
}
}
if noun == "update" && method == http.MethodPost {
if len(args) != 1 {
return server.BinaryResponse(nil, server.RemoteError(server.ErrorInvalidRequest, "POST update expects 1 url argument"), nil)
}
cred := irma.NewCredentialTypeIdentifier(args[0])
update := &revocation.Update{}
if err := irma.UnmarshalValidateBinary(message, update); err != nil {
return server.BinaryResponse(nil, server.RemoteError(server.ErrorMalformedInput, err.Error()), nil)
}
status, bts := s.handlePostUpdate(cred, update)
return server.BinaryResponse(status, bts, nil)
}
if noun == "issuancerecord" && method == http.MethodPost {
if len(args) != 2 {
return server.BinaryResponse(nil, server.RemoteError(server.ErrorInvalidRequest, "POST issuancercord expects 2 url arguments"), nil)
......
......@@ -216,14 +216,6 @@ func (session *session) handlePostCommitments(commitments *irma.IssueCommitmentM
return sigs, nil
}
// POST revocation/update/{credtype}
func (s *Server) handlePostUpdate(typ irma.CredentialTypeIdentifier, update *revocation.Update) (interface{}, *irma.RemoteError) {
if err := s.conf.IrmaConfiguration.Revocation.AddUpdate(typ, update); err != nil {
return nil, server.RemoteError(server.ErrorRevocation, err.Error())
}
return nil, nil
}
// GET revocation/events/{credtype}/{pkcounter}/{from}/{to}
func (s *Server) handleGetEvents(
cred irma.CredentialTypeIdentifier, pkcounter uint, from, to uint64,
......
......@@ -51,10 +51,9 @@ type (
// RevocationSetting contains revocation settings for a given credential type.
RevocationSetting struct {
ServerMode bool `json:"server,omitempty" mapstructure:"server"`
PostURLs []string `json:"post_urls,omitempty" mapstructure:"post_urls"`
RevocationServerURL string `json:"revocation_server_url,omitempty" mapstructure:"revocation_server_url"`
Tolerance uint64 `json:"tolerance,omitempty" mapstructure:"tolerance"` // in seconds, min 30
ServerMode bool `json:"server,omitempty" mapstructure:"server"`
RevocationServerURL string `json:"revocation_server_url,omitempty" mapstructure:"revocation_server_url"`
Tolerance uint64 `json:"tolerance,omitempty" mapstructure:"tolerance"` // in seconds, min 30
// set to now whenever a new update is received, or when the RA indicates
// there are no new updates. Thus it specifies up to what time our nonrevocation
......@@ -326,8 +325,6 @@ func (rs *RevocationStorage) addUpdate(tx sqlRevStorage, id CredentialTypeIdenti
s := rs.getSettings(id)
s.updated = time.Now()
// POST record to listeners, if any, asynchroniously
go rs.client.PostUpdate(id, s.PostURLs, update)
return nil
}
......@@ -548,8 +545,6 @@ func (rs *RevocationStorage) updateAccumulatorTimes(types []CredentialTypeIdenti
s := rs.getSettings(r.CredType)
s.updated = time.Now()
// POST record to listeners, if any, asynchroniously
go rs.client.PostUpdate(r.CredType, s.PostURLs, &revocation.Update{SignedAccumulator: sacc})
}
return nil
})
......@@ -741,16 +736,6 @@ func (rs *RevocationStorage) getSettings(id CredentialTypeIdentifier) *Revocatio
return s
}
func (client RevocationClient) PostUpdate(id CredentialTypeIdentifier, urls []string, update *revocation.Update) {
transport := client.transport()
for _, url := range urls {
err := transport.Post(fmt.Sprintf("%s/revocation/update/%s", url, id.String()), nil, update)
if err != nil {
Logger.Warn("error sending revocation update", err)
}
}
}
func (client RevocationClient) PostIssuanceRecord(id CredentialTypeIdentifier, sk *revocation.PrivateKey, rec *IssuanceRecord, url string) error {
message, err := signed.MarshalSign(sk.ECDSA, rec)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment