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
e784e2f1
Commit
e784e2f1
authored
Jul 24, 2017
by
Sietse Ringers
Browse files
Add IsInitialized() to metastore
parent
7eccd8ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
store.go
View file @
e784e2f1
...
...
@@ -24,15 +24,16 @@ type ConfigurationStore struct {
PublicKeys
map
[
string
][]
*
gabi
.
PublicKey
reverseHashes
map
[
string
]
string
initialized
bool
}
func
newConfigurationStore
()
(
store
*
ConfigurationStore
)
{
store
=
&
ConfigurationStore
{
make
(
map
[
string
]
*
SchemeManager
),
make
(
map
[
string
]
*
Issuer
),
make
(
map
[
string
]
*
CredentialType
),
make
(
map
[
string
][]
*
gabi
.
PublicKey
),
make
(
map
[
string
]
string
),
SchemeManagers
:
make
(
map
[
string
]
*
SchemeManager
),
Issuers
:
make
(
map
[
string
]
*
Issuer
),
Credentials
:
make
(
map
[
string
]
*
CredentialType
),
PublicKeys
:
make
(
map
[
string
][]
*
gabi
.
PublicKey
),
reverseHashes
:
make
(
map
[
string
]
string
),
}
return
}
...
...
@@ -59,10 +60,14 @@ func (store *ConfigurationStore) hashToCredentialType(hash []byte) *CredentialTy
return
nil
}
func
(
store
*
ConfigurationStore
)
IsInitialized
()
bool
{
return
store
.
initialized
}
// ParseFolder populates the current store by parsing the specified irma_configuration folder,
// listing the containing scheme managers, issuers, credential types and public keys.
func
(
store
*
ConfigurationStore
)
ParseFolder
(
path
string
)
error
{
return
iterateSubfolders
(
path
,
func
(
dir
string
)
error
{
err
:=
iterateSubfolders
(
path
,
func
(
dir
string
)
error
{
manager
:=
&
SchemeManager
{}
exists
,
err
:=
pathToDescription
(
dir
+
"/description.xml"
,
manager
)
if
err
!=
nil
{
...
...
@@ -74,6 +79,11 @@ func (store *ConfigurationStore) ParseFolder(path string) error {
}
return
nil
})
if
err
!=
nil
{
return
err
}
store
.
initialized
=
true
return
nil
}
func
(
store
*
ConfigurationStore
)
parseIssuerFolders
(
path
string
)
error
{
...
...
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