From 1b44fe1fd07250e6a8450a97ca03f76409f9685d Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Sat, 25 Jan 2020 16:46:10 -0400 Subject: [PATCH] userToIncomingID getter --- services/gunDB/contact-api/getters.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/gunDB/contact-api/getters.js b/services/gunDB/contact-api/getters.js index fa704e37..d0cc8baa 100644 --- a/services/gunDB/contact-api/getters.js +++ b/services/gunDB/contact-api/getters.js @@ -1,3 +1,5 @@ +const {getUser} = require('../Mediator') + const Key = require('./key') const Utils = require('./utils') @@ -13,4 +15,17 @@ exports.currentOrderAddress = async (pub) => { } return currAddr +} + +/** + * @param {string} pub + * @returns {Promise} + */ +exports.userToIncomingID = async (pub) => { + const incomingID = await getUser().get(Key.USER_TO_INCOMING).get(pub).then() + + if (typeof incomingID === 'string') return incomingID + + return null + } \ No newline at end of file