GithubHelp home page GithubHelp logo

lwandsyj / aka-extension-chrome-extension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neilck/aka-extension

0.0 0.0 0.0 1.49 MB

Nostr Signing Extension for Chrome supporting multiple key pairs.

Home Page: https://chrome.google.com/webstore/detail/aka-profiles/ncmflpbbagcnakkolfpcpogheckolnad

JavaScript 19.54% TypeScript 80.22% CSS 0.24%

aka-extension-chrome-extension's Introduction

AKA Profiles

screenshot

Nostr signer extension with multiple keys

AKA Profiles is a Chrome Extension, based on nos2x and adds support for multiple public / private key pairs.

The primary purpose is enabling web apps to request the signing of events using the locally stored private key, thereby eliminating the need to give the private key to web apps.

It also stores a list of your public keys, reducing copying / pasting of keys into various apps.

Version 1.05

  • updated to newer permission model in nos2x
  • support for NIP-07 switching accounts
  • removed support for signing delegation
  • fixed screen width errors

Supported

NIP-07

  • getPublicKey()
  • signEvent()
  • getRelays()

NIP-04

  • nip04.encrypt()
  • nip04.decrypt()

NIP-07 switching accounts

  • window.nostr.on('accountChanged', accountChangedHandler)

These javascript functions are made available to web apps through injection of window.nostr script element defined in nostr-provider.js into the DOM.

AKA Profiles uses the same app permission model as nos2x

User Guide

Compiling

npm run build

The built extension files are written to dist folder.

Installation

Install from Chrome Web Store,

Otherwise, use the files in the dist folder after compiling:

  1. Open Chrome browser and paste chrome://extensions into the address bar.
  2. Enable Developer mode by clicking Developer mode toggle (top right)
  3. Click Load Unpacked button in the menu bar.
  4. Select the dist folder.
  5. Click the Extension icon in Chrome, and click AKA Profiles icon.
  6. Paste in your private key.

Tips

  • "Add new profile..." is available in dropdown in top right
  • Right click on AKA Profiles icon and select Options to revoke app permissions or to add preferred relays

If Access Request prompt dialog doesn't appear when loading a web page

  • Check to see if it is already open, but got hidden behind the current window
  • Ensure other signer extensions are not also enabled (e.g. nos2x, Alby)

Integration Examples

To integrate, see the following compatible web apps

Search repositories for window.nostr.getPublicKey()

Developer Notes

As much underlying code as possible was reused from nos2x. For reference, this is how both AKA Profiles and nos2x processes application requests.

As specified in NIP-07, the browser extension's contentScript.js injects nostr-provider.js script into element window.nostr on page load. The calling application needs to wait for the insertion before accessing.

Functions like window.nostr.getPublicKey() are defined in nostr-provider.js, and when called, post a message (window.postMessage) with ext: "aka-profiles".

contentScript.js, which runs in the context of the web page, listens for those messages, and in turn sends the message (browser.runtime.sendMessage) to background.js.

background.js then processes the request, opening up a new window if user interaction is necessary. The result is then returned as as response back up the chain of message senders.

aka-extension-chrome-extension's People

Contributors

neilck avatar manshu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.