Skip to content

Commit

Permalink
Merge pull request #64 from lorena-ssi/multiCred
Browse files Browse the repository at this point in the history
Handle member credentials in SDK
  • Loading branch information
celeduc committed Jun 26, 2020
2 parents 752bbe6 + d1fceb7 commit 177bf25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@lorena-ssi/lorena-sdk",
"version": "2.0.4",
"version": "2.0.5",
"description": "Lorena SDK",
"author": "Alex Puig <alex@caelumlabs.com>",
"license": "MIT",
Expand Down
10 changes: 6 additions & 4 deletions src/index.js
Expand Up @@ -263,14 +263,16 @@ export default class Lorena extends EventEmitter {
*/
async handleMemberNotify (element) {
// If there's no credential then ignore the update
if (element.payload.credential === null) {
debug('handleMemberNotify null credential')
debug('handleMemberNotify: ', element)
if (!element.payload.credential) {
debug('handleMemberNotify has no credential')
debug('handleMemberNotify element: ', element)
return
}

// If it's a memberOf credential it has a roleName, so update it in the wallet.
if (element.payload.credential.credentialSubject.member.roleName) {
if (element.payload.credential.credentialSubject &&
element.payload.credential.credentialSubject.member &&
element.payload.credential.credentialSubject.member.roleName) {
this.wallet.data.credentials[0] = element.payload.credential
} else {
this.wallet.add('credentials', element.payload.credential)
Expand Down

0 comments on commit 177bf25

Please sign in to comment.