diff --git a/Shared (Extension)/Resources/background.js b/Shared (Extension)/Resources/background.js index eb0381d..501f2d3 100644 --- a/Shared (Extension)/Resources/background.js +++ b/Shared (Extension)/Resources/background.js @@ -105,6 +105,18 @@ browser.runtime.onMessage.addListener( let [srfpIndex, srfpRelays] = message.payload; await saveRelaysForProfile(srfpIndex, srfpRelays); break; + case 'getNameForProfile': + let nameForProfile = await getNameForProfile(message.payload); + sendResponse(nameForProfile); + break; + case 'getPubKeyForProfile': + let pubKeyForProfile = await getNpubKey(message.payload); + sendResponse(pubKeyForProfile); + break; + case 'getPrivKeyForProfile': + let privKeyForProfile = await getNsecKey(message.payload); + sendResponse(privKeyForProfile); + break; default: break; } @@ -138,9 +150,22 @@ async function initialize() { ]); } -async function getNsecKey() { - let profile = await currentProfile(); - return profile.nsecKey; +async function getProfile(index) { + let profiles = await get('profiles'); + return profiles[index]; +} + +async function getNsecKey(index) { + let profile = await getProfile(index); + let nsecKey = nip19.nsecEncode(profile.privKey); + return nsecKey; +} + +async function getNpubKey(index) { + let profile = await getProfile(index); + let pubKey = getPublicKey(profile.privKey); + let npubKey = nip19.npubEncode(pubKey); + return npubKey; } async function getPrivKey() { @@ -148,12 +173,6 @@ async function getPrivKey() { return profile.privKey; } -async function getNpubKey() { - let pubKey = await getPubKey(); - let npubKey = nip19.npubEncode(pubKey); - return npubKey; -} - async function getPubKey() { let privKey = await getPrivKey(); let pubKey = getPublicKey(privKey); @@ -260,3 +279,9 @@ async function saveRelaysForProfile(profileIndex, relays) { profile.relays = relays; await storage.set({ profiles }); } + +async function getNameForProfile(profileIndex) { + let profiles = await get('profiles'); + let profile = profiles[profileIndex]; + return profile.name; +} diff --git a/Shared (Extension)/Resources/options.css b/Shared (Extension)/Resources/options.css index c326dde..2aafce4 100644 --- a/Shared (Extension)/Resources/options.css +++ b/Shared (Extension)/Resources/options.css @@ -8,7 +8,7 @@ } .input { - @apply bg-fuchsia-200 text-fuchsia-800 rounded-lg p-1 lg:p-1.5 focus:border-fuchsia-800; + @apply bg-fuchsia-200 text-fuchsia-800 rounded-lg p-1 lg:p-1.5 focus:border-fuchsia-800 w-64; } .checkbox { @@ -18,4 +18,8 @@ .section { @apply border-2 border-fuchsia-700 rounded-lg p-5 mt-6 shadow-md; } + + .section-header { + @apply text-2xl lg:text-5xl font-bold; + } } \ No newline at end of file diff --git a/Shared (Extension)/Resources/options.html b/Shared (Extension)/Resources/options.html index 5558c8e..c98b353 100644 --- a/Shared (Extension)/Resources/options.html +++ b/Shared (Extension)/Resources/options.html @@ -12,18 +12,47 @@

Nostore

+

-
+
-

Relays

+

Keys

+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + +
+

Relays

-