Skip to content
GitLab
Menu
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
1acbda2b
Commit
1acbda2b
authored
Dec 17, 2019
by
Ivar Derksen
Committed by
Sietse Ringers
Feb 05, 2020
Browse files
Not always store all credential when only one changes
parent
d633e203
Changes
2
Hide whitespace changes
Inline
Side-by-side
irmaclient/client.go
View file @
1acbda2b
...
...
@@ -246,7 +246,7 @@ func (client *Client) addCredential(cred *credential, storeAttributes bool) (err
return
}
if
storeAttributes
{
err
=
client
.
storage
.
StoreAttribute
s
(
client
.
attributes
)
err
=
client
.
storage
.
StoreAttribute
(
id
,
client
.
attributes
[
id
]
)
}
return
}
...
...
@@ -270,7 +270,7 @@ func (client *Client) remove(id irma.CredentialTypeIdentifier, index int, storen
attrs
:=
list
[
index
]
client
.
attributes
[
id
]
=
append
(
list
[
:
index
],
list
[
index
+
1
:
]
...
)
if
storenow
{
if
err
:=
client
.
storage
.
StoreAttribute
s
(
client
.
attributes
);
err
!=
nil
{
if
err
:=
client
.
storage
.
StoreAttribute
(
id
,
client
.
attributes
[
id
]
);
err
!=
nil
{
return
err
}
}
...
...
irmaclient/storage.go
View file @
1acbda2b
...
...
@@ -175,6 +175,18 @@ func (s *storage) TxStoreSecretKey(tx *bbolt.Tx, sk *secretKey) error {
return
s
.
txStore
(
tx
,
skKey
,
sk
,
userdataBucket
)
}
func
(
s
*
storage
)
StoreAttribute
(
credTypeID
irma
.
CredentialTypeIdentifier
,
attrlistlist
[]
*
irma
.
AttributeList
)
error
{
return
s
.
db
.
Update
(
func
(
tx
*
bbolt
.
Tx
)
error
{
return
s
.
TxStoreAttribute
(
tx
,
credTypeID
,
attrlistlist
)
})
}
func
(
s
*
storage
)
TxStoreAttribute
(
tx
*
bbolt
.
Tx
,
credTypeID
irma
.
CredentialTypeIdentifier
,
attrlistlist
[]
*
irma
.
AttributeList
)
error
{
return
s
.
txStore
(
tx
,
credTypeID
.
String
(),
attrlistlist
,
attributesBucket
)
}
func
(
s
*
storage
)
StoreAttributes
(
attributes
map
[
irma
.
CredentialTypeIdentifier
][]
*
irma
.
AttributeList
)
error
{
return
s
.
db
.
Update
(
func
(
tx
*
bbolt
.
Tx
)
error
{
return
s
.
TxStoreAttributes
(
tx
,
attributes
)
...
...
@@ -183,7 +195,7 @@ func (s *storage) StoreAttributes(attributes map[irma.CredentialTypeIdentifier][
func
(
s
*
storage
)
TxStoreAttributes
(
tx
*
bbolt
.
Tx
,
attrs
map
[
irma
.
CredentialTypeIdentifier
][]
*
irma
.
AttributeList
)
error
{
for
credTypeID
,
attrlistlist
:=
range
attrs
{
err
:=
s
.
t
xStore
(
tx
,
credTypeID
.
String
()
,
attrlistlist
,
attributesBucket
)
err
:=
s
.
T
xStore
Attribute
(
tx
,
credTypeID
,
attrlistlist
)
if
err
!=
nil
{
return
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