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
fbfb8574
Commit
fbfb8574
authored
Oct 01, 2017
by
Sietse Ringers
Browse files
Rename CredentialManager.Store to ConfigurationStore
parent
1093f9d0
Changes
8
Hide whitespace changes
Inline
Side-by-side
store.go
→
config
store.go
View file @
fbfb8574
File moved
irmago_test.go
View file @
fbfb8574
...
...
@@ -165,7 +165,7 @@ func verifyStoreIsLoaded(t *testing.T, store *ConfigurationStore, android bool)
func
TestAndroidParse
(
t
*
testing
.
T
)
{
manager
:=
parseStorage
(
t
)
verifyStoreIsLoaded
(
t
,
manager
.
Store
,
true
)
verifyStoreIsLoaded
(
t
,
manager
.
Configuration
Store
,
true
)
verifyManagerIsUnmarshaled
(
t
,
manager
)
verifyCredentials
(
t
,
manager
)
verifyKeyshareIsUnmarshaled
(
t
,
manager
)
...
...
keyshare.go
View file @
fbfb8574
...
...
@@ -139,7 +139,7 @@ func startKeyshareSession(
)
{
ksscount
:=
0
for
_
,
managerID
:=
range
session
.
SchemeManagers
()
{
if
credManager
.
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
if
credManager
.
Configuration
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
ksscount
++
if
_
,
registered
:=
credManager
.
keyshareServers
[
managerID
];
!
registered
{
err
:=
errors
.
New
(
"Not registered to keyshare server of scheme manager "
+
managerID
.
String
())
...
...
@@ -166,7 +166,7 @@ func startKeyshareSession(
askPin
:=
false
for
_
,
managerID
:=
range
session
.
SchemeManagers
()
{
if
!
ks
.
credManager
.
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
if
!
ks
.
credManager
.
Configuration
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
continue
}
...
...
@@ -234,7 +234,7 @@ func (ks *keyshareSession) VerifyPin(attempts int) {
// If all is ok, success will be true.
func
(
ks
*
keyshareSession
)
verifyPinAttempt
(
pin
string
)
(
success
bool
,
tries
int
,
blocked
int
,
err
error
)
{
for
_
,
managerID
:=
range
ks
.
session
.
SchemeManagers
()
{
if
!
ks
.
credManager
.
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
if
!
ks
.
credManager
.
Configuration
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
continue
}
...
...
@@ -285,7 +285,7 @@ func (ks *keyshareSession) GetCommitments() {
for
_
,
builder
:=
range
ks
.
builders
{
pk
:=
builder
.
PublicKey
()
managerID
:=
NewIssuerIdentifier
(
pk
.
Issuer
)
.
SchemeManagerIdentifier
()
if
!
ks
.
credManager
.
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
if
!
ks
.
credManager
.
Configuration
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
continue
}
if
_
,
contains
:=
pkids
[
managerID
];
!
contains
{
...
...
@@ -297,7 +297,7 @@ func (ks *keyshareSession) GetCommitments() {
// Now inform each keyshare server of with respect to which public keys
// we want them to send us commitments
for
_
,
managerID
:=
range
ks
.
session
.
SchemeManagers
()
{
if
!
ks
.
credManager
.
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
if
!
ks
.
credManager
.
Configuration
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
continue
}
...
...
@@ -401,7 +401,7 @@ func (ks *keyshareSession) finishDisclosureOrSigning(challenge *big.Int, respons
for
i
,
builder
:=
range
ks
.
builders
{
// Parse each received JWT
managerID
:=
NewIssuerIdentifier
(
builder
.
PublicKey
()
.
Issuer
)
.
SchemeManagerIdentifier
()
if
!
ks
.
credManager
.
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
if
!
ks
.
credManager
.
Configuration
Store
.
SchemeManagers
[
managerID
]
.
Distributed
()
{
continue
}
msg
:=
struct
{
...
...
logs.go
View file @
fbfb8574
...
...
@@ -58,7 +58,7 @@ func (session *session) createLogEntry(response gabi.ProofList) (*LogEntry, erro
case
ActionIssuing
:
item
:=
&
IssuanceLog
{
Proofs
:
proofs
}
for
_
,
req
:=
range
session
.
jwt
.
(
*
IdentityProviderJwt
)
.
Request
.
Request
.
Credentials
{
list
,
err
:=
req
.
AttributeList
(
session
.
credManager
.
Store
)
list
,
err
:=
req
.
AttributeList
(
session
.
credManager
.
Configuration
Store
)
if
err
!=
nil
{
continue
// TODO?
}
...
...
manager.go
View file @
fbfb8574
...
...
@@ -22,7 +22,7 @@ type CredentialManager struct {
irmaConfigurationPath
string
androidStoragePath
string
Store
*
ConfigurationStore
ConfigurationStore
*
ConfigurationStore
updates
[]
update
}
...
...
@@ -114,7 +114,7 @@ func (cm *CredentialManager) credential(id CredentialTypeIdentifier, counter int
Attributes
:
append
([]
*
big
.
Int
{
cm
.
secretkey
.
Key
},
attrs
.
Ints
...
),
Signature
:
sig
,
Pk
:
pk
,
},
cm
.
Store
)
},
cm
.
Configuration
Store
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -152,7 +152,7 @@ func (cm *CredentialManager) Candidates(disjunction *AttributeDisjunction) []*At
for
_
,
attribute
:=
range
disjunction
.
Attributes
{
credID
:=
attribute
.
CredentialTypeIdentifier
()
if
!
cm
.
Store
.
Contains
(
credID
)
{
if
!
cm
.
Configuration
Store
.
Contains
(
credID
)
{
continue
}
creds
:=
cm
.
credentials
[
credID
]
...
...
@@ -212,7 +212,7 @@ func (cm *CredentialManager) groupCredentials(choice *DisclosureChoice) (map[Cre
if
identifier
.
IsCredential
()
{
continue
// In this case we only disclose the metadata attribute, which is already handled
}
index
,
err
:=
cm
.
Store
.
Credentials
[
identifier
.
CredentialTypeIdentifier
()]
.
IndexOf
(
identifier
)
index
,
err
:=
cm
.
Configuration
Store
.
Credentials
[
identifier
.
CredentialTypeIdentifier
()]
.
IndexOf
(
identifier
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -276,7 +276,7 @@ func (cm *CredentialManager) IssuanceProofBuilders(request *IssuanceRequest) (ga
proofBuilders
:=
gabi
.
ProofBuilderList
([]
gabi
.
ProofBuilder
{})
for
_
,
futurecred
:=
range
request
.
Credentials
{
pk
,
err
:=
cm
.
Store
.
PublicKey
(
futurecred
.
Credential
.
IssuerIdentifier
(),
futurecred
.
KeyCounter
)
pk
,
err
:=
cm
.
Configuration
Store
.
PublicKey
(
futurecred
.
Credential
.
IssuerIdentifier
(),
futurecred
.
KeyCounter
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -316,7 +316,7 @@ func (cm *CredentialManager) ConstructCredentials(msg []*gabi.IssueSignatureMess
// we save none of them to fail the session cleanly
gabicreds
:=
[]
*
gabi
.
Credential
{}
for
i
,
sig
:=
range
msg
{
attrs
,
err
:=
request
.
Credentials
[
i
]
.
AttributeList
(
cm
.
Store
)
attrs
,
err
:=
request
.
Credentials
[
i
]
.
AttributeList
(
cm
.
Configuration
Store
)
if
err
!=
nil
{
return
err
}
...
...
@@ -328,7 +328,7 @@ func (cm *CredentialManager) ConstructCredentials(msg []*gabi.IssueSignatureMess
}
for
_
,
gabicred
:=
range
gabicreds
{
newcred
,
err
:=
newCredential
(
gabicred
,
cm
.
Store
)
newcred
,
err
:=
newCredential
(
gabicred
,
cm
.
Configuration
Store
)
if
err
!=
nil
{
return
err
}
...
...
@@ -359,7 +359,7 @@ func (cm *CredentialManager) paillierKey(wait bool) *paillierPrivateKey {
func
(
cm
*
CredentialManager
)
unenrolledKeyshareServers
()
[]
*
SchemeManager
{
list
:=
[]
*
SchemeManager
{}
for
name
,
manager
:=
range
cm
.
Store
.
SchemeManagers
{
for
name
,
manager
:=
range
cm
.
Configuration
Store
.
SchemeManagers
{
if
_
,
contains
:=
cm
.
keyshareServers
[
name
];
len
(
manager
.
KeyshareServer
)
>
0
&&
!
contains
{
list
=
append
(
list
,
manager
)
}
...
...
@@ -369,7 +369,7 @@ func (cm *CredentialManager) unenrolledKeyshareServers() []*SchemeManager {
// KeyshareEnroll attempts to register at the keyshare server of the specified scheme manager.
func
(
cm
*
CredentialManager
)
KeyshareEnroll
(
managerID
SchemeManagerIdentifier
,
email
,
pin
string
)
error
{
manager
,
ok
:=
cm
.
Store
.
SchemeManagers
[
managerID
]
manager
,
ok
:=
cm
.
Configuration
Store
.
SchemeManagers
[
managerID
]
if
!
ok
{
return
errors
.
New
(
"Unknown scheme manager"
)
}
...
...
session.go
View file @
fbfb8574
...
...
@@ -191,7 +191,7 @@ func (session *session) do(proceed bool) {
}
session
.
Handler
.
StatusUpdate
(
session
.
Action
,
StatusCommunicating
)
if
!
session
.
irmaSession
.
Distributed
(
session
.
credManager
.
Store
)
{
if
!
session
.
irmaSession
.
Distributed
(
session
.
credManager
.
Configuration
Store
)
{
var
message
interface
{}
var
err
error
switch
session
.
Action
{
...
...
storage.go
View file @
fbfb8574
...
...
@@ -96,7 +96,7 @@ func NewCredentialManager(
attributes
:
make
(
map
[
CredentialTypeIdentifier
][]
*
AttributeList
),
irmaConfigurationPath
:
irmaConfigurationPath
,
androidStoragePath
:
androidStoragePath
,
Store
:
NewConfigurationStore
(
storagePath
+
"/irma_configuration"
),
ConfigurationStore
:
NewConfigurationStore
(
storagePath
+
"/irma_configuration"
),
}
exists
,
err
:=
PathExists
(
cm
.
irmaConfigurationPath
)
...
...
@@ -109,7 +109,7 @@ func NewCredentialManager(
if
err
=
cm
.
ensureStorageExists
();
err
!=
nil
{
return
nil
,
err
}
if
err
=
cm
.
Store
.
ParseFolder
();
err
!=
nil
{
if
err
=
cm
.
Configuration
Store
.
ParseFolder
();
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -222,14 +222,14 @@ func (cm *CredentialManager) ensureStorageExists() error {
return
errors
.
New
(
"credential storage path does not exist"
)
}
if
exist
,
err
=
PathExists
(
cm
.
Store
.
path
);
err
!=
nil
{
if
exist
,
err
=
PathExists
(
cm
.
Configuration
Store
.
path
);
err
!=
nil
{
return
err
}
if
!
exist
{
if
err
=
ensureDirectoryExists
(
cm
.
Store
.
path
);
err
!=
nil
{
if
err
=
ensureDirectoryExists
(
cm
.
Configuration
Store
.
path
);
err
!=
nil
{
return
err
}
cm
.
Store
.
Copy
(
cm
.
irmaConfigurationPath
,
false
)
cm
.
Configuration
Store
.
Copy
(
cm
.
irmaConfigurationPath
,
false
)
}
return
ensureDirectoryExists
(
cm
.
path
(
signaturesDir
))
}
...
...
@@ -366,7 +366,7 @@ func (cm *CredentialManager) loadAttributes() (list map[CredentialTypeIdentifier
return
nil
,
err
}
for
_
,
attrlist
:=
range
temp
{
attrlist
.
MetadataAttribute
=
MetadataFromInt
(
attrlist
.
Ints
[
0
],
cm
.
Store
)
attrlist
.
MetadataAttribute
=
MetadataFromInt
(
attrlist
.
Ints
[
0
],
cm
.
Configuration
Store
)
id
:=
attrlist
.
CredentialType
()
var
ct
CredentialTypeIdentifier
if
id
!=
nil
{
...
...
updates.go
View file @
fbfb8574
...
...
@@ -94,7 +94,7 @@ func (cm *CredentialManager) ParseAndroidStorage() (present bool, err error) {
gabicred
.
Signature
.
KeyshareP
=
oldcred
.
SharedPoints
[
0
]
}
var
cred
*
credential
if
cred
,
err
=
newCredential
(
gabicred
,
cm
.
Store
);
err
!=
nil
{
if
cred
,
err
=
newCredential
(
gabicred
,
cm
.
Configuration
Store
);
err
!=
nil
{
return
}
if
cred
.
CredentialType
()
==
nil
{
...
...
@@ -130,9 +130,9 @@ func (cm *CredentialManager) ParseAndroidStorage() (present bool, err error) {
cm
.
paillierKey
(
false
)
// trigger calculating a new one
}
if
err
=
cm
.
Store
.
Copy
(
cm
.
androidStoragePath
+
"/app_store/irma_configuration"
,
false
);
err
!=
nil
{
if
err
=
cm
.
Configuration
Store
.
Copy
(
cm
.
androidStoragePath
+
"/app_store/irma_configuration"
,
false
);
err
!=
nil
{
return
}
// Copy from assets again to ensure we have the latest versions
return
present
,
cm
.
Store
.
Copy
(
cm
.
irmaConfigurationPath
,
true
)
return
present
,
cm
.
Configuration
Store
.
Copy
(
cm
.
irmaConfigurationPath
,
true
)
}
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