From 1b0202c9503e2511a466a63dd1d801adabc67c7c Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Sat, 25 Jan 2020 15:00:34 -0400 Subject: [PATCH] mySecret() util --- services/gunDB/contact-api/utils/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/gunDB/contact-api/utils/index.js b/services/gunDB/contact-api/utils/index.js index b9121093..5ce3bd4f 100644 --- a/services/gunDB/contact-api/utils/index.js +++ b/services/gunDB/contact-api/utils/index.js @@ -1,6 +1,7 @@ /** * @format */ +const { getUser, mySEA: SEA } = require('../../Mediator') const ErrorCode = require('../errorCode') const Key = require('../key') @@ -16,6 +17,14 @@ const Key = require('../key') */ const delay = ms => new Promise(res => setTimeout(res, ms)) +/** + * @returns {Promise} + */ +const mySecret = () => { + const user = getUser() + return SEA.secret(user._.sea.epub, user._.sea) +} + /** * @template T * @param {Promise} promise @@ -292,5 +301,6 @@ module.exports = { reqWasAccepted, currHandshakeAddress, tryAndWait, + mySecret, promisifyGunNode: require('./promisifygun') }