Commit 563bd417 authored by Ivar Derksen's avatar Ivar Derksen Committed by Sietse Ringers
Browse files

Bolthold load limit on oldest logs fix and make removal accessible from bridge

parent a8d3e3f3
......@@ -289,7 +289,7 @@ func (client *Client) remove(id irma.CredentialTypeIdentifier, index int, storen
if storenow {
return client.storage.AddLogEntry(&LogEntry{
Type: actionRemoval,
Type: ActionRemoval,
Time: irma.Timestamp(time.Now()),
Removed: removed,
})
......@@ -328,7 +328,7 @@ func (client *Client) RemoveAllCredentials() error {
}
logentry := &LogEntry{
Type: actionRemoval,
Type: ActionRemoval,
Time: irma.Timestamp(time.Now()),
Removed: removed,
}
......
......@@ -34,7 +34,7 @@ type LogEntry struct {
request irma.SessionRequest // cached parsed version of Request; get with LogEntry.SessionRequest()
}
const actionRemoval = irma.Action("removal")
const ActionRemoval = irma.Action("removal")
func (entry *LogEntry) SessionRequest() (irma.SessionRequest, error) {
if entry.request != nil {
......@@ -71,7 +71,7 @@ func (entry *LogEntry) setSessionRequest() error {
// GetDisclosedCredentials gets the list of disclosed credentials for a log entry
func (entry *LogEntry) GetDisclosedCredentials(conf *irma.Configuration) ([][]*irma.DisclosedAttribute, error) {
if entry.Type == actionRemoval {
if entry.Type == ActionRemoval {
return [][]*irma.DisclosedAttribute{}, nil
}
......@@ -136,7 +136,7 @@ func (session *session) createLogEntry(response interface{}) (*LogEntry, error)
}
switch entry.Type {
case actionRemoval:
case ActionRemoval:
case irma.ActionSigning:
// Get the signed message and timestamp
......
......@@ -207,7 +207,7 @@ func (s *storage) LoadKeyshareServers() (ksses map[irma.SchemeManagerIdentifier]
func (s *storage) LoadLogs(before time.Time, max int) ([]*LogEntry, error) {
var logs []*LogEntry
return logs, s.db.Find(&logs,
bolthold.Where(bolthold.Key).Lt(before.UnixNano()).Limit(max),
bolthold.Where(bolthold.Key).Lt(before.UnixNano()).SortBy("Time").Reverse().Limit(max),
)
}
......
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