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
ff930a82
Commit
ff930a82
authored
Oct 03, 2019
by
Sietse Ringers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: asynchronously populate nonrevocation caches on irmaclient startup
parent
07ab5695
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
irmaclient/client.go
irmaclient/client.go
+36
-15
No files found.
irmaclient/client.go
View file @
ff930a82
...
...
@@ -130,7 +130,7 @@ func New(
return
nil
,
err
}
c
m
:=
&
Client
{
c
lient
:=
&
Client
{
credentialsCache
:
make
(
map
[
irma
.
CredentialTypeIdentifier
]
map
[
int
]
*
credential
),
keyshareServers
:
make
(
map
[
irma
.
SchemeManagerIdentifier
]
*
keyshareServer
),
attributes
:
make
(
map
[
irma
.
CredentialTypeIdentifier
][]
*
irma
.
AttributeList
),
...
...
@@ -138,57 +138,78 @@ func New(
handler
:
handler
,
}
c
m
.
Configuration
,
err
=
irma
.
NewConfigurationFromAssets
(
filepath
.
Join
(
storagePath
,
"irma_configuration"
),
irmaConfigurationPath
)
c
lient
.
Configuration
,
err
=
irma
.
NewConfigurationFromAssets
(
filepath
.
Join
(
storagePath
,
"irma_configuration"
),
irmaConfigurationPath
)
if
err
!=
nil
{
return
nil
,
err
}
schemeMgrErr
:=
c
m
.
Configuration
.
ParseOrRestoreFolder
()
schemeMgrErr
:=
c
lient
.
Configuration
.
ParseOrRestoreFolder
()
// If schemMgrErr is of type SchemeManagerError, we continue and
// return it at the end; otherwise bail out now
_
,
isSchemeMgrErr
:=
schemeMgrErr
.
(
*
irma
.
SchemeManagerError
)
if
schemeMgrErr
!=
nil
&&
!
isSchemeMgrErr
{
return
nil
,
schemeMgrErr
}
c
m
.
Configuration
.
RevocationPath
=
filepath
.
Join
(
storagePath
,
"revocation"
)
if
err
=
fs
.
EnsureDirectoryExists
(
c
m
.
Configuration
.
RevocationPath
);
err
!=
nil
{
c
lient
.
Configuration
.
RevocationPath
=
filepath
.
Join
(
storagePath
,
"revocation"
)
if
err
=
fs
.
EnsureDirectoryExists
(
c
lient
.
Configuration
.
RevocationPath
);
err
!=
nil
{
return
nil
,
err
}
// Ensure storage path exists, and populate it with necessary files
c
m
.
storage
=
storage
{
storagePath
:
storagePath
,
Configuration
:
cm
.
Configuration
}
if
err
=
c
m
.
storage
.
EnsureStorageExists
();
err
!=
nil
{
c
lient
.
storage
=
storage
{
storagePath
:
storagePath
,
Configuration
:
client
.
Configuration
}
if
err
=
c
lient
.
storage
.
EnsureStorageExists
();
err
!=
nil
{
return
nil
,
err
}
// Legacy storage does not need ensuring existence
cm
.
fileStorage
=
fileStorage
{
storagePath
:
storagePath
,
Configuration
:
cm
.
Configuration
}
if
c
m
.
Preferences
,
err
=
cm
.
storage
.
LoadPreferences
();
err
!=
nil
{
if
c
lient
.
Preferences
,
err
=
client
.
storage
.
LoadPreferences
();
err
!=
nil
{
return
nil
,
err
}
c
m
.
applyPreferences
()
c
lient
.
applyPreferences
()
// Perform new update functions from clientUpdates, if any
if
err
=
c
m
.
update
();
err
!=
nil
{
if
err
=
c
lient
.
update
();
err
!=
nil
{
return
nil
,
err
}
// Load our stuff
if
c
m
.
secretkey
,
err
=
cm
.
storage
.
LoadSecretKey
();
err
!=
nil
{
if
c
lient
.
secretkey
,
err
=
client
.
storage
.
LoadSecretKey
();
err
!=
nil
{
return
nil
,
err
}
if
c
m
.
attributes
,
err
=
cm
.
storage
.
LoadAttributes
();
err
!=
nil
{
if
c
lient
.
attributes
,
err
=
client
.
storage
.
LoadAttributes
();
err
!=
nil
{
return
nil
,
err
}
if
c
m
.
keyshareServers
,
err
=
cm
.
storage
.
LoadKeyshareServers
();
err
!=
nil
{
if
c
lient
.
keyshareServers
,
err
=
client
.
storage
.
LoadKeyshareServers
();
err
!=
nil
{
return
nil
,
err
}
if
len
(
c
m
.
UnenrolledSchemeManagers
())
>
1
{
if
len
(
c
lient
.
UnenrolledSchemeManagers
())
>
1
{
return
nil
,
errors
.
New
(
"Too many keyshare servers"
)
}
return
cm
,
schemeMgrErr
reportErr
:=
func
(
err
error
)
{
irma
.
Logger
.
Error
(
err
)
raven
.
CaptureError
(
err
,
nil
)
return
}
defer
func
()
{
var
cred
*
credential
var
err
error
for
credid
,
attrsets
:=
range
client
.
attributes
{
for
i
:=
range
attrsets
{
if
cred
,
err
=
client
.
credential
(
credid
,
i
);
err
!=
nil
{
reportErr
(
err
)
}
if
err
=
cred
.
PrepareNonrevCache
();
err
!=
nil
{
reportErr
(
err
)
}
}
}
}()
return
client
,
schemeMgrErr
}
func
(
client
*
Client
)
Close
()
error
{
...
...
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