Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
7090bfd7
Commit
7090bfd7
authored
Nov 13, 2017
by
Sietse Ringers
Browse files
Add client update for scheme manager signatures
parent
706b5a49
Changes
3
Hide whitespace changes
Inline
Side-by-side
irmaclient/client.go
View file @
7090bfd7
...
...
@@ -129,9 +129,6 @@ func New(
if
err
!=
nil
{
return
nil
,
err
}
if
err
=
cm
.
Configuration
.
ParseFolder
();
err
!=
nil
{
return
nil
,
err
}
// Ensure storage path exists, and populate it with necessary files
cm
.
storage
=
storage
{
storagePath
:
storagePath
,
Configuration
:
cm
.
Configuration
}
...
...
@@ -149,6 +146,10 @@ func New(
return
nil
,
err
}
if
err
=
cm
.
Configuration
.
ParseFolder
();
err
!=
nil
{
return
nil
,
err
}
// Load our stuff
if
cm
.
secretkey
,
err
=
cm
.
storage
.
LoadSecretKey
();
err
!=
nil
{
return
nil
,
err
...
...
irmaclient/updates.go
View file @
7090bfd7
...
...
@@ -29,6 +29,19 @@ var clientUpdates = []func(client *Client) error{
_
,
err
:=
client
.
ParseAndroidStorage
()
return
err
},
func
(
client
*
Client
)
error
{
// Adding scheme manager index, signature and public key
// Check the signatures of all scheme managers, if any is not ok,
// copy the entire irma_configuration folder from assets
conf
:=
client
.
Configuration
for
manager
:=
range
conf
.
SchemeManagers
{
valid
,
err
:=
conf
.
VerifySignature
(
manager
)
if
err
!=
nil
||
!
valid
{
return
conf
.
CopyFromAssets
(
false
)
}
}
return
nil
},
}
// update performs any function from clientUpdates that has not
...
...
irmaconfig.go
View file @
7090bfd7
...
...
@@ -40,8 +40,9 @@ type Configuration struct {
publicKeys
map
[
IssuerIdentifier
]
map
[
int
]
*
gabi
.
PublicKey
reverseHashes
map
[
string
]
CredentialTypeIdentifier
path
string
initialized
bool
path
string
assets
string
}
// ConfigurationFileHash encodes the SHA256 hash of an authenticated
...
...
@@ -56,14 +57,15 @@ type SchemeManagerIndex map[string]ConfigurationFileHash
// ParseFolder() should be called to parse the specified path.
func
NewConfiguration
(
path
string
,
assets
string
)
(
conf
*
Configuration
,
err
error
)
{
conf
=
&
Configuration
{
path
:
path
,
path
:
path
,
assets
:
assets
,
}
if
err
=
fs
.
EnsureDirectoryExists
(
conf
.
path
);
err
!=
nil
{
return
nil
,
err
}
if
assets
!=
""
{
if
err
=
conf
.
Copy
(
a
ssets
,
false
);
err
!=
nil
{
if
conf
.
assets
!=
""
{
if
err
=
conf
.
Copy
FromA
ssets
(
false
);
err
!=
nil
{
return
nil
,
err
}
}
...
...
@@ -266,19 +268,19 @@ func (conf *Configuration) Contains(cred CredentialTypeIdentifier) bool {
conf
.
CredentialTypes
[
cred
]
!=
nil
}
// Copy recursively copies the directory tree
at source into the directory
// of this Configuration.
func
(
conf
*
Configuration
)
Copy
(
source
string
,
parse
bool
)
error
{
// Copy
FromAssets
recursively copies the directory tree
from the assets folder
//
into the directory
of this Configuration.
func
(
conf
*
Configuration
)
Copy
FromAssets
(
parse
bool
)
error
{
if
err
:=
fs
.
EnsureDirectoryExists
(
conf
.
path
);
err
!=
nil
{
return
err
}
err
:=
filepath
.
Walk
(
source
,
filepath
.
WalkFunc
(
err
:=
filepath
.
Walk
(
conf
.
assets
,
filepath
.
WalkFunc
(
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
path
==
source
{
if
path
==
conf
.
assets
{
return
nil
}
subpath
:=
path
[
len
(
source
)
:
]
subpath
:=
path
[
len
(
conf
.
assets
)
:
]
if
info
.
IsDir
()
{
if
err
:=
fs
.
EnsureDirectoryExists
(
conf
.
path
+
subpath
);
err
!=
nil
{
return
err
...
...
@@ -289,11 +291,11 @@ func (conf *Configuration) Copy(source string, parse bool) error {
return
err
}
defer
srcfile
.
Close
()
b
yte
s
,
err
:=
ioutil
.
ReadAll
(
srcfile
)
b
t
s
,
err
:=
ioutil
.
ReadAll
(
srcfile
)
if
err
!=
nil
{
return
err
}
if
err
:=
fs
.
SaveFile
(
conf
.
path
+
subpath
,
b
yte
s
);
err
!=
nil
{
if
err
:=
fs
.
SaveFile
(
conf
.
path
+
subpath
,
b
t
s
);
err
!=
nil
{
return
err
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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