Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
irmago
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
IRMA
Github mirrors
irmago
Commits
76ea866a
Commit
76ea866a
authored
Nov 11, 2019
by
Sietse Ringers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support sending multiple revocation records
parent
f37717b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
revocation.go
revocation.go
+17
-9
No files found.
revocation.go
View file @
76ea866a
...
...
@@ -128,18 +128,24 @@ func (rs *RevocationStorage) LatestRevocationRecords(typ CredentialTypeIdentifie
func
(
rs
*
RevocationStorage
)
AddRevocationRecords
(
records
[]
*
RevocationRecord
)
error
{
var
err
error
for
_
,
r
:=
range
records
{
if
err
=
rs
.
AddRevocationRecord
(
r
);
err
!=
nil
{
if
err
=
rs
.
addRevocationRecord
(
rs
.
db
,
r
,
false
);
err
!=
nil
{
return
err
}
}
if
len
(
records
)
>
0
{
// POST record to listeners, if any, asynchroniously
go
rs
.
client
.
PostRevocationRecords
(
rs
.
getSettings
(
records
[
0
]
.
CredType
)
.
PostURLs
,
records
)
}
return
nil
}
func
(
rs
*
RevocationStorage
)
AddRevocationRecord
(
record
*
RevocationRecord
)
error
{
return
rs
.
addRevocationRecord
(
rs
.
db
,
record
)
return
rs
.
addRevocationRecord
(
rs
.
db
,
record
,
true
)
}
func
(
rs
*
RevocationStorage
)
addRevocationRecord
(
tx
revStorage
,
record
*
RevocationRecord
)
error
{
func
(
rs
*
RevocationStorage
)
addRevocationRecord
(
tx
revStorage
,
record
*
RevocationRecord
,
post
bool
)
error
{
// Unmarshal and verify the record against the appropriate public key
pk
,
err
:=
rs
.
Keys
.
PublicKey
(
record
.
CredType
.
IssuerIdentifier
(),
record
.
PublicKeyIndex
)
if
err
!=
nil
{
...
...
@@ -161,7 +167,10 @@ func (rs *RevocationStorage) addRevocationRecord(tx revStorage, record *Revocati
s
:=
rs
.
getSettings
(
record
.
CredType
)
s
.
updated
=
time
.
Now
()
go
rs
.
client
.
PostRevocationRecord
(
s
,
record
)
// POST record to listeners, if any, asynchroniously
if
post
{
// POST record to listeners, if any, asynchroniously
go
rs
.
client
.
PostRevocationRecords
(
s
.
PostURLs
,
[]
*
RevocationRecord
{
record
})
}
return
nil
}
...
...
@@ -259,7 +268,7 @@ func (rs *RevocationStorage) revokeAttr(tx revStorage, typ CredentialTypeIdentif
},
CredType
:
typ
,
}
if
err
=
rs
.
addRevocationRecord
(
tx
,
record
);
err
!=
nil
{
if
err
=
rs
.
addRevocationRecord
(
tx
,
record
,
true
);
err
!=
nil
{
return
err
}
return
nil
...
...
@@ -419,11 +428,10 @@ func (rs *RevocationStorage) getSettings(typ CredentialTypeIdentifier) *Revocati
return
rs
.
settings
[
typ
]
}
// TODO support POSTing multiple records
func
(
RevocationClient
)
PostRevocationRecord
(
s
*
RevocationSetting
,
record
*
RevocationRecord
)
{
func
(
RevocationClient
)
PostRevocationRecords
(
urls
[]
string
,
records
[]
*
RevocationRecord
)
{
transport
:=
NewHTTPTransport
(
""
)
for
_
,
url
:=
range
s
.
PostURL
s
{
if
err
:=
transport
.
Post
(
url
+
"/-/revocation/records"
,
nil
,
&
[]
*
RevocationRecord
{
record
}
);
err
!=
nil
{
for
_
,
url
:=
range
url
s
{
if
err
:=
transport
.
Post
(
url
+
"/-/revocation/records"
,
nil
,
&
records
);
err
!=
nil
{
Logger
.
Warn
(
"error sending revocation update"
,
err
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment