Giter VIP home page Giter VIP logo

extension's Introduction

Leather

Chrome Web Store coverage semantic-release storybook

Leather is the most popular and trusted wallet for apps built on Bitcoin. Connect to apps and manage assets secured by Bitcoin and Bitcoin L2s with battle-tested wallet for the Stacks blockchain.

๐Ÿ“š See Leather Developer Documentation โ†’

๐Ÿ“ฉ Join the mailing list for updates โ†’

Contibuting

Please see our contribution guide

Development

This application is a Web Extension. There is no ability to run it as a standalone web application.

Each child of the src directory represents the script context in which it is ran.

Install packages

pnpm i

Dev mode

pnpm dev

Optional: run test app

We bundle a test app to use along with the extension. It gives easy access to the various functions that the extension can do.

In a separate terminal, run:

pnpm dev:test-app

Loading extension in your browser

You'll need to add it to your browser of choice. Leather only supports Chromium and Firefox browsers. When you run pnpm dev, it will compile the application to the /dist folder

Testing

Several testing scripts are available in package.json.

The integration tests expect the extension to be built prior to running. The extension can be built for tests with the command below.

pnpm build:test

The integration tests use Playwright, which requires the system to have the browsers it needs. The following command installs everything Playwright needs.

pnpm playwright install --with-deps

Note that the installed browsers are tied to the version of Playwright being used, and it may be necessary to run the above command again in some situations, such as when upgrading Playwright or switching branches. Read the documentation for more information.

All integration tests can be run using:

pnpm test:integration

To run a suite of tests you can use:

pnpm playwright test specs/TEST.spec.ts
pnpm playwright test tests/specs --shard=3/8

To get more information when running tests you can pass the --debug flag or the --ui flag to playwright.

When running tests locally you must add the following to your .env file:

WALLET_ENVIRONMENT=testing

Unit tests

Unit tests can be run with vitest using:

pnpm test:unit

Production

See instructions on Leather.io to install from source

Alternatively, the following steps can be taken by technical users with the latest version of node installed on their machines.

Build from source

Run the following from within this repository's root directory if you've pulled it with Git:

pnpm && pnpm prepare && pnpm build

The extension is now built in the ./dist folder.

Firefox reviewers

To build the extension in Firefox mode, the TARGET_BROWSER=firefox variable needs to be set.

pnpm && pnpm prepare && TARGET_BROWSER=firefox pnpm build

Note that when building in a clean environment, some code may vary between this and the submitted build. This is because some variables are set within the scope of the production build's CI.

Security

We consider the security of our systems a top priority. But no matter how much effort we put into system security, there can still be vulnerabilities present.

If you discover a security vulnerability, please use one of the following means of communications to report it to us:

Please note this email is strictly for reporting security vulnerabilities. For support queries, contact [email protected]. Your efforts to responsibly disclose your findings are sincerely appreciated and will be taken into account to acknowledge your contributions.

Audit Report

In Q1 2021, Leather partnered with Least Authority, a leading security consultancy with experience in the crypto space, to audit Leather. On April 29th 2021, after addressing the major concerns described in the initial findings, as well as a concluding sign off from the Least Authority team, a final report was delivered.

Download and read the full report here

extension's People

Contributors

actions-user avatar alter-eggo avatar andresgalante avatar aulneau avatar beguene avatar blockstack-devops avatar charliec3 avatar dependabot[bot] avatar edgarkhanzadian avatar edu-stx avatar fabric-8 avatar fbwoolf avatar friedger avatar github-actions[bot] avatar hstove avatar janniks avatar jeeanribeiro avatar kyranjamie avatar leather-bot avatar luciorubeens avatar markmhendrickson avatar marvinjanssen avatar mihirkachroo avatar nithishvb avatar pete-watters avatar polybius93 avatar semantic-release-bot avatar snyk-bot avatar timstackblock avatar wileyj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

extension's Issues

Handle auth completion in original tab, instead of a new tab

The way Blockstack auth works right now (in production and in this app) is that after authentication, you go back to the app, in a new tab. The UX of this could be much better.

It's possible to execute a callback on the original app, after the authentication request is complete, without any new tab or page refresh behavior.

Configure end-to-end extension testing with Puppeteer

Puppeteer is a JS project for testing Google Chrome. I've done some research on testing extensions with it, and it is possible to run a (non-headless) chrome with an extension loaded, using the --loadExtensions flag. It is not currently possible to run headless chrome with an extension.

You can also interact with the actual UI of the extension by getting the extension ID of the project. Some useful information is found here: https://stackoverflow.com/questions/48089670/detect-and-test-chrome-extension-using-puppeteer

Remove initial modal from onboarding

Right now, the onboarding flow in the app includes the first modal, which is intended to be included only on the app before opening the popup.

We need to remove this from the app, and instead include it in @blockstack/connect. The first screen in this app should be the screen that comes after "Create Data Vault". Or, if "Sign in instead" is selected, then the sign in flow should show up right away.

Use dedicated domain for this app

Obviously, we'll have to determine the domain first. This doesn't have to be final, but we need something even just for pre-alpha testing.

Once this is setup, we can connect Netlify to use this domain.

[Intro modal] Icons alignment and size

All three icons are 24 by 24px. I attached them here: apps-icon.svglock-icon.svg

How I aligned the icons to the text:
For the first two, where the text wraps to two lines, I created a wrapper for the icons with 4px padding top and 12px padding bottom. This will bring the total height to 40px, matching the height of the text (20px line height).

image.png

Incorporate new `@blockstack/ui` package

I've tried to do a basic import of @blockstack/ui, but I ran into some type errors. After using a local version of the package on Kyran's latest branch, these errors are gone, but I'm still seeing odd import issues. I've tabled it for now, but I need to document (and maybe fix) these issues, and then I can actually use the package in this project.

Proof-of-concept around basic authentication

The first end-to-end flow we want as a proof of concept would be:

  • Install/run the browser extension in a Chromium browser
    • This can be installed in a more manual way, not from the Chrome store
  • Intercept blockstack auth and trigger the browser
  • Restore an existing identity
  • Approve app auth

This requires a few key components, which is why it's a good place to get started:

  • General packaging and installing
  • Integrating the blockstack-keychain package for seed management
  • Intercepting authentication
  • Some core components of the existing auth flow

Set up tests

Dev experience:

  • Easily able to watch and run tests
  • Code coverage reporting in Github
  • CircleCI running and reporting on tests from Github

Create MVP developer tooling for using this app

This is a placeholder issue for code that will live elsewhere. Eventually, probably in blockstack.js.

I already have code in place that works to authenticate to either the hosted version or the extension, if it's installed. We can either use a beta version of blockstack.js, or even release a micro-library specifically for apps that opt-in to testing this out. The micro-library would only be for starting the authentication request - everything else works out of the box with blockstack.js already.

Design screen for "fetching auth info"

Before we actually show the onboarding flow, we need to fetch some information about the app and the authentication request. This is how we can show things like the app name, icons, etc. This loading screen needs to work without any known app information.

The screenshot below has the Wink icon, but we can't use that for a generic loading screen, which could be for any app.

I've already built this screen:

image

Setup event tracking

We can just integrate segment during a pre-release, but before a developer preview we need to remove any 3rd party scripts, and proxy events instead (similar to how the Browser works).

There is already a function setup which gets called during all the events we want, it just isn't integrated with Segment yet.

Set up staging

We should set up an easy to use and automatic staging deployment of PRs like we have in other projects. Additionally we should chat about how to best test the ext. and ways to provide automatic packages of staging versions.

[Intro modal] Vertical rhythm

We're not using spacing (see Waffle) correctly. Sticking to multiples of 4 will allow us to create a sense of vertical rhythm that is currently missing, see design:

image.png

16, 28, 16, 16, 8, 20, 24.

In the implementation, I'm seeing 17.5, 70, 10.5, etc. Not only are these far off, they also don't follow our rule of multiples of 4.

image.png

Build app-side UI for modal before authentication

This is a placeholder issue until we move blockstack-connect into the public Github

We need @blockstack/connect to have an API to show a modal before users leave the app and go into authentication.

Incorporate performance improvements to restoring a wallet

@zone117x, you mentioned in SF that you have some performance enhancements to some of our keychain-related code. This is pretty necessary, as the current process is very slow, and is only non-blocking because I've moved it into a Web Worker. Can you share more information about exactly the changes you've found, and how I can incorporate it?

Import recent changes from Wink into onboarding

@kyranjamie - a week ago, I ported over the onboarding code from our beta app. I see you've added some changes to that app recently. Let's make sure those changes get incorporated here (if they're part of onboarding), and then also make sure we're not duplicating too much work moving forward.

Hopefully, we'll be able to ditch the dummy onboarding of the beta app soon, so we can focus on work in this repo.

Add "Magic Recovery Code" support

Some users will only have a "magic recovery code" from the legacy browser, which is just an encrypted 12-word seed. We need to:

  • dial in the language for what we call this thing
  • handle the case where users enter their recovery code in the "seed phrase" prompt
  • error messaging and handling
  • UI to enter your password to decrypt the recovery code

These screens are already designed in Figma, but are not in the codebase yet.

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.