use tryandwait()
This commit is contained in:
parent
ad941bcdb1
commit
9a9ea5e7a2
1 changed files with 14 additions and 5 deletions
|
|
@ -182,11 +182,20 @@ const successfulHandshakeAlreadyExists = async recipientPub => {
|
||||||
* @returns {Promise<string|null>}
|
* @returns {Promise<string|null>}
|
||||||
*/
|
*/
|
||||||
const recipientToOutgoingID = async recipientPub => {
|
const recipientToOutgoingID = async recipientPub => {
|
||||||
const maybeEncryptedOutgoingID = await require('../../Mediator/index')
|
const maybeEncryptedOutgoingID = await tryAndWait(async (_, user) => {
|
||||||
.getUser()
|
const oid = await user
|
||||||
.get(Key.RECIPIENT_TO_OUTGOING)
|
.get(Key.RECIPIENT_TO_OUTGOING)
|
||||||
.get(recipientPub)
|
.get(recipientPub)
|
||||||
.then()
|
.then()
|
||||||
|
|
||||||
|
if (typeof oid !== 'string' && oid !== null) {
|
||||||
|
throw new Error(
|
||||||
|
'Expected outgoing id from recipient-to-outgoing-id map to be an string or null'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return oid
|
||||||
|
})
|
||||||
|
|
||||||
if (typeof maybeEncryptedOutgoingID === 'string') {
|
if (typeof maybeEncryptedOutgoingID === 'string') {
|
||||||
const outgoingID = await require('../../Mediator/index').mySEA.decrypt(
|
const outgoingID = await require('../../Mediator/index').mySEA.decrypt(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue