Skip to content

Commit

Permalink
Merge pull request #30 from lorena-ssi/memberOfConfirm
Browse files Browse the repository at this point in the history
memberOfConfirm returns a boolean or throws an error, like memberOf
  • Loading branch information
celeduc committed Apr 15, 2020
2 parents 6171652 + 75ec013 commit a6a5af0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"Dspace",
"GMVZE",
"Puig",
"Tqnl",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -63,7 +63,7 @@ Throws an error and emits `error` if fails.

#### `connect(connectionstring)`

Connect to Lorena IDSpace.
Connect to Lorena IDspace.
`connectionstring` is a concatenation of username-password-did

Returns true if the connection is success
Expand All @@ -72,7 +72,7 @@ Throws an error and emits `error` if fails.

#### `handshake()`

Establishes a connection with the idspace, checking public-key signatures.
Establishes a connection with the IDspace, checking public-key signatures.

#### `callRecipe(recipe, { payloadText: 'text', payloadETC: 'ETC'})`

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@lorena-ssi/lorena-sdk",
"version": "1.0.4",
"version": "1.0.5",
"description": "Lorena Client",
"author": "Alex Puig <alex@caelumlabs.com>",
"license": "MIT",
Expand Down
7 changes: 4 additions & 3 deletions src/main.js
Expand Up @@ -191,6 +191,7 @@ export default class Lorena extends EventEmitter {
*
* @param {string} roomId Contact Identifier
* @param {string} secretCode secret Code
* @returns {Promise} result boolean true or thrown error
*/
async memberOfConfirm (roomId, secretCode) {
return new Promise((resolve) => {
Expand All @@ -207,17 +208,17 @@ export default class Lorena extends EventEmitter {
if (result.payload.msg === 'member verified') {
this.wallet.update('contacts', { roomId: roomId }, { status: 'verified' })
this.wallet.add('credentials', result.payload.credential)
resolve(result.payload.msg)
resolve(true)
} else {
resolve(result.payload.msg)
throw new Error(`memberOf: ${result.payload.message}`)
}
})
}
})
}

/**
* Connect to Lorena IDSpace.
* Connect to Lorena IDspace.
*/
async connect () {
if (this.ready === true) return true
Expand Down

0 comments on commit a6a5af0

Please sign in to comment.