Giter VIP home page Giter VIP logo

make-software / casper-wallet Goto Github PK

View Code? Open in Web Editor NEW
21.0 8.0 4.0 10.44 MB

Securely manage your CSPR tokens, interact with dapps, and sign transactions with Casper Wallet, the go-to self-custody wallet for the Casper Network.

Home Page: https://casperwallet.io

License: Apache License 2.0

Shell 0.11% TypeScript 97.46% JavaScript 1.85% HTML 0.18% Dockerfile 0.03% CSS 0.11% Swift 0.25%
extension dapp blockchain dapp-developers casper-network chrome-extension firefox-extension safari-extension blockchain-wallet hacktoberfest

casper-wallet's Introduction

Casper Wallet

signer logo

Securely manage your CSPR tokens, interact with dapps and sign transactions with Casper Wallet, the Go-To self-custody wallet for the Casper blockchain.


Integrate Casper Wallet Into Your App

The recommended way of integrating Casper Wallet into your app is through CSPR.click, which provides a combined integration of major wallets in the Casper ecosystem, all at once, without the burden of maintaining multiple integrations at the same time. Please head over to the CSPR.click documentation to start.

Testing Casper Wallet integration on Casper Wallet Playground

Casper Wallet Playground is a React webapp created as a developer tool to help test integration with various features available in Casper Wallet.

Access Casper Wallet Playground repo

Open https://github.com/make-software/casper-wallet-playground

Clone this repository and run following commands from the repo root folder. NOTE: Node.js LTS is required.

npm install
npm run start

This will open webapp automatically in a new tab.

Load Wallet Extension in Chrome

  1. Navigate chrome://extensions/ in Chrome browser
  2. Enable Developer mode (right top corner, at least for Chrome 98)
  3. Click on Load unpacked button (left top corner)
  4. Pick build/chrome folder from builds.zip deliverable or builds folder when building from sources.

To open as a tab:

  1. Open a new tab and use the link chrome-extension://{paste ID here}/popup.html

Load Wallet Extension in Firefox

  1. Navigate about:debugging#/runtime/this-firefox in Firefox browser
  2. Click on Load Temporary Add-on... button.
  3. Pick build/firefox/manifest.json file from builds.zip deliverable or builds folder when building from sources.

To open as a tab:

  1. Open new tab and fill the link moz-extension://{paste Internal UUID here}/popup.html

Load Wallet Extension in Safari

  1. Open build/safari folder from builds.zip or builds folder when building from sources.
  2. Double click on "Casper Wallet.app" file.
  3. Follow instructions and enable Casper Wallet in opened Extensions Preferences window.
  4. Open Safari and enable unsigned extensions. Extension should be available.

For more information please follow the link

Development setup

Working on any macOS or Linux machine with NodeJS LTS installed.

Install dependencies

Clone this repository and run following commands from the repo root folder. NOTE: Node.js LTS is required.

npm install

Grant script execution permissions for scripts folder

chmod +x scripts/*

Start watcher script to rebuild on changes (output folder)

Chrome:

npm run start:chrome

Firefox:

npm run start:firefox

Safari:

npm run start:safari

You can run all these commands in parallel.

Build deliverable from sources (build folder)

Chrome:

npm run build:chrome

Firefox:

npm run build:firefox

Safari:

npm run build:safari

All at once:

npm run build:all

Redux DevTools

What is it?

Developer Tools to power-up Redux development workflow or any other architecture which handles the state change.

It can be used as a browser extension (for Chrome, Edge and Firefox), as a standalone app or as a React component integrated in the client app.

You can read more about Redux DevTools on link https://github.com/reduxjs/redux-devtools

How to configure?

We are using redux devtool as separate local server. It can be started with devtools:redux npm start script.

All npm start scripts, except Safari (start:chrome, start:firefox) for dev-environment, already include launching the redux dev tools on 8000 port for Chrome and 8001 port for Firefox.

You should install Redux DevTools browser extension and connect it to Redux DevTool local server

How to run?

  1. Install browser extension

  2. Start npm script for browser you need. For example, run npm run start:chrome for Chrome

  3. Connect your extension with local redux dev server with steps:

    1. Open extension and click by right mouse button on it then pick Redux DevTools menu item and click on Open Remote DevToolsOpening Redux DevTools app
    2. Open Settings of Redux DevTools app then select use local (custom) server option and set hostname as a localhost and set a port depends on browser you need (8000 for Chrome and 8001 for Firefox) Redux DevTools settings
    3. Click Connect button and enjoy ๐Ÿ™‚

E2E tests

Write tests into e2e-tests folder.

To run e2e tests, you must use npm script npm run e2e:chrome:ui:popup or e2e:chrome:ui:onboarding. Tests are run in UI mode.

All information about how to run and debug tests can be found in playwright docs.

casper-wallet's People

Contributors

alioss avatar comp0te avatar dependabot[bot] avatar mrkara avatar mssteuer avatar ost-ptk avatar piotrwitek avatar vladimir-gachkovsky avatar

Stargazers

 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

casper-wallet's Issues

Input focus highlight

STR:

  • Open App in browser
  • Go to Create New Vault page
  • Put cursor in password input

Actual: focus highlights input inside inputs field
Expected: focus highlights input by inputs outer border

image.png

Account Balance Epic

  • Implement Casper Provider module. The module is used to query account balance.
  • Show real account balance values using the Casper provider module

"Create Vault" page

Make Create Vault page and vault creation functionality

https://www.figma.com/file/mBlqs6l6I2d3ihX80Mswm4/Casper-Signer?node-id=101%3A567


For password requirement, the user only needs to come up with a phrase of at least 12 characters. Include helper text under the Confirm Password field:
Think of a random and memorable phrase with at least 12 characters. Avoid using personally identifiable information.
Justification for this password approach: https://support.1password.com/strong-account-password/

"Timeout" page

Timeout page
Signer will autolock after a specified duration of inactivity. Users can specify the duration in the Timeout screen.

The options presented to the user will be different from what exists in Signer 1.0 today. They will include:

  1. 1 min
  2. 5 min
  3. 15 min
  4. 30 min
  5. 1 hour
  6. 24 hours

Set default selection to 5 min.

Screenshot 2022-04-01 at 16.38.27.png

As a Signer user I can Remove an account

Any imported account (ie one uploaded by file) can be removed from Signer. Once an account is removed it is no longer accessible from within Signer. It is no longer visible in the Accounts list. The only way to bring it back is to reimport the private key file again for that same account.

Figma: https://www.figma.com/file/mBlqs6l6I2d3ihX80Mswm4/Casper-Signer?node-id=1196%3A5966

image

Requirements
The account settings screen for imported accounts will include a trash can button. When clicked, the user is directed to a Remove Account? confirmation screen.
Three buttons are on this screen:

  • Back - directs the user back to the Account Settings screen with no change.
  • Remove - acts as a confirmation button, removing the account, and navigating the user to the Home screen. The removed account will no longer be present in the account list.
  • Cancel - directs the user back to the Account Settings screen with no change.

HD accounts, those which were not imported but rather created via secret phrase, cannot be removed ever. The trash icon will not appear in the Account Settings menu for these accounts.

Edge cases
If the account is active when it is removed, the next account in the Home screen's account list will become active.
If the account is active when it is removed, and connected to a dapp, the next account in the Home screen's account list will become active but the connection is severed. The user must re-connect to the Dapp.

Backend management of whitelisted sites and dapps

  • Implement all legacy Signer integrations (Skybridger, dotoracle, etc)
  • Ability to read from github the list of whitelisted sites and import into the Signer extension. We need to determine which Repo this will live in.

Integrate localization framework in casper signer v2

It should implement all the following parts from the casper explorer:

  • apps/web/src/app/i18n.ts
  • apps/web/src/app/language-detector.ts
  • apps/web/src/app/domain/language.ts
  • translate all existing strings using react-i18next
  • implement following npm scripts so they work the same as in casper explorer:
    • "locale:extract_pot": "i18next 'apps/web/src/**/*.{ts,tsx}' && node scripts/locale_extract_pot.js"
    • "locale:update_translations": "node scripts/locale_update_translations.js"

Display Private key/Mnemonic onscreen and enable account recovery using private key/mnemonic on Casper Wallet

To recover a lost account in the Signer app, a user must import their account using a .PEM file containing the account secret key.
Casper Wallet will continue to support account import by file if only to accommodate users migrating their accounts to Casper Wallet from Signer. The gold standard for account recovery in a web wallet is to use a HD-based recovery phrase. All users new to Casper Wallet will be prompted to generate such a phrase.

Support for secret phrase via CEP72 was originally planned for legacy Signer. Here are the old tickets for reference, which may help to accelerate investigations around technical design for Casper Wallet:
casper-network/ceps#72
casper-ecosystem/signer#92

Onboarding - Recovery Phrase set up
Design: https://www.figma.com/file/mBlqs6l6I2d3ihX80Mswm4/Casper-Signer?node-id=1838%3A7567
As a Casper Wallet user, during onboarding I can generate a new, unique CEP72 mnemonic recovery phrase for my HD key
As a Casper Wallet user, during onboarding I can click on the obfuscated recovery phrase to reveal the words
As a Casper Wallet user, during onboarding I can click a copy button to copy the recovery phrase to my clipboard for one minute
As a Casper Wallet user, during onboarding when I click the copy button a message appears confirming that the phrase is copied to clipboard
As a Casper Wallet user, during onboarding after seeing my recovery phrase I am prompted to verify that i know the phrase by filling in missing words in the sequence.
As a Casper Wallet user, during onboarding, when prompted to Confirm my secret phrase, the Confirm button is disabled until I fill in all of the missing values in the sequence by clicking on the word tags at the top of the screen.
As a Casper Wallet user, during onboarding if I do not enter the right missing values and I click Confirm I will encounter an error message screen prompting me to start over. Clicking the Start over button takes me back to the Confirm Your Secret Phrase screen.
As a Casper Wallet user who selects the right missing values in the Confirm my Secret Phrase step, clicking Confirm will direct me to a confirmation screen indicating that the secret phrase has been generated successfully: "Your secret phrase is confirmed!"
As a Casper Wallet user who has successfully generated a secret phrase for my wallet I will not be prompted to generate a new secret phrase the next time I log in.

Additionally, Signer 2 should support a secret phrase architecture which easily integrates with Ledger. For example Ledger supports a 24 word secret - Signer 2 should do the same.

Recovery phrase retrieval
As a Casper Wallet user, I can view my secret phrase at any time from the Settings menu by clicking on Backup secret phrase
image.png

Recovering your accounts using a recovery phrase
As a Casper Wallet user, during onboarding, if I click the 'I already have a Secret Phrase button' I will be prompted to enter it in an input field.
image.png
image.png
As a Casper Waller user, during onboarding, if I enter an unrecognized recovery phrase into the input field and click 'Confirm', I will encounter an error screen prompting me to start over. Clicking Start Over will direct me one step back to the Recovery Phrase input screen

Header and Header Menu

Make Header with Menu and Icon Buttons area
Screenshot 2022-04-01 at 16.19.22.pngScreenshot 2022-04-01 at 16.18.28.png
Background color of Header can be blue or red
Icon Buttons set depends on current page and state

Home page layout

Tickets:

  1. Header
  2. Hamburger menu with pop out sidebar menu
  3. Generic dialog (to be used for security prompt, etc)

As a Signer user I can Rename my account

Any account in Signer can be named. Naming an account is performed within the Account Settings menu

Design: https://www.figma.com/file/mBlqs6l6I2d3ihX80Mswm4/Casper-Signer?node-id=1196%3A5966

image

Requirements
A pencil button will appear at the top of the Account Settings screen. When clicked, the user is taken to the "Rename account" screen. This screen includes:

  • Back button - directs the user back to the account settings screen with no changes made.
  • Input field - where the user may type in their new account name The input field displays the existing account name by default.
  • Update button - applies the value entered into the input field as the new account name and directs the user to the Account setting screen. The name change will propagate to all areas of Signer that display the account name including the Account list and account settings screen. The Update button is in a disabled state until the default text in the input field is modified.
  • Cancel button - directs the user back to the account settings screen with no changes made.

Input Validation
This is an alphanumeric input.

Spaces are allowed.

Special characters are not allowed. If typed, display error message immediately "Please include alphanumeric characters only.

A maximum of 20 characters may be typed.

If user double clicks on the Account name on the Home screen...
image
...automatically direct to user to the Rename account prompt screen:
image

Edge cases
If the user modifies the input field text, but then types in the account's existing name, Update button becomes disabled again.

As a Signer user I can import an existing account

Figma: https://www.figma.com/file/mBlqs6l6I2d3ihX80Mswm4/Casper-Signer?node-id=115%3A933

Requirements
This ticket will enable legacy Signer users to import their account using a private key .PEM file in Signer 2.

  1. Logged into their vault, a user will have an option to Import Account.
    image
  2. The user will click 'Import with a file' and be prompted to upload their Private Key file. If the user uploads an unsupported file format, an error will display 'Please upload a .PEM containing your private key.'
    image
  3. Once a valid key file is uploaded, a user is directed to a new screen with the filename displayed. A text input field allows the user to name their account. A max of 23 characters is allowed, including spaces. A back button allows the user to move back to the upload screen.
    image
  4. Once a valid account name is included in the input field the user will be able to click the Import button to finish importing
    image
  5. Once imported, a confirmation screen appears confirming the successful import. By clicking Thanks the user is taken to the home screen with their new account set as the Active account. If user imports multiple accounts back to back, display them in a list on the home screen by the account name.
    image

Out of Scope in this ticket
Importing account with Secret Phrase (will be added in as part of #1

As a Signer user I can review a list of sites that I've previously Connected to

As a Casper Wallet user, I can review a list of dapps that I have connected to, broken down by account.
The user opens a Connected Sites screen from the Settings menu of Casper Wallet.
Any dapp that has been connected to with an account will be listed with it's URL and favicon.
A list of the accounts that have connected to that dapp will appear beneath the dapp URL as a sublist
As a Casper Wallet user, when I disconnect an account from a dapp, the account no longer appears beneath that dapp in the Connected Sites list.
As a Casper Wallet user, when I remove disconnect the only connected account from a dapp, the dapp is immediately no longer listed in the Connected Sites list.
As a Casper Wallet user, I can disconnect an individual account from a dapp by clicking on the X button in the Connect Sites screen.
As a Casper Wallet user, I can disconnect ALL accounts from a dapp at the same time by clicking the Disconnect button next to the Dapp URL.

Design: https://www.figma.com/file/mBlqs6l6I2d3ihX80Mswm4/Casper-Signer?node-id=101%3A567
image.png

Start script for Safari open Firefox and Safari

Firefox and Safari will open If Firefox was opened when Safari's start script is running.

STR:

  • Open Firefox
  • Run npm run start:safari

Actual: Extension opened in new tab in Firefox and Safari
Expected: Extension will opened only in Safari

How to work Safari build with Webpack dev server

Need clarify how to works Safari build in details with Webpack Dev Server.

At the moment, npm run start:safari opens the application in Safari browser and we can open every file in the build/firefox folder, but changing those files does nothing. It looks like the Safari build has "copies" of these files. Purpose of this task is need to figure out exactly how the build works

As a Signer user I can create a new account

Casper Signer v2 supports HD wallet, which allows users to generate unlimited new key pairs from a master key pair. Therefore, users who have generated their unique recovery phrase are enabled to create unlimited accounts, all of which can be recovered through the one seed phrase. This ticket defines the account creation experience.

Requirements
Users will be able to create accounts with just a few clicks. When a user clicks Create Account either from the Home screen or hamburger menu, the user will be prompted to add an alphanumeric name for their account. After adding a name, the user can click a Done button. The new account appears in the users account list and is selected by default.
image

Design for private key/mnemonic and enable account recovery using key/mnemonic

A gold standard among web3 wallets is the use of a private key secret phrase. Secret phrases are a more intuitive approach to private key storage and account recorvey compared to Signer's current PEM download. Phrases are easier to write down, easier to remember, and are generally more user friendly.

Areas impacted by CEP72 in Signer 2:

  1. During account creation a user will be prompted to write down their 24 word secret phrase. The user should be tested to ensure the phrase was actually recorded. Here are some popular examples: https://docs.google.com/presentation/d/10P3orkHpTdS_opynS9xLDd4ENloaVLsH5QyhftQERVE/edit?usp=sharing
  2. A user is able to look up the secret phrase for any account in their Signer vault.
  3. A user is able to add/import an account to their Signer vault by entering their secret phrase

As a Signer user I can Review and Sign transactions on the Casper network

Tasks:

  • Implement UI
  • Write business logic to call Casper SDK
  • Tests should also be added to playground application so anyone can test transactions

User stories:
As a Casper Wallet user, when I initiate a transaction using a an app/dapp, I can review the details of the transaction on the Casper Network before I sign it.
As a Casper Wallet user, I can cancel a transaction prompt if I don't want to execute the transaction
As a Casper Wallet user, I can sign a transaction on the Casper Network

CSPR Name Service support

A Casper Name Service (like ENS on ethereum) is coming soon which basically enables users to use domain names e.g. alice.cspr instead of the usual public key/account hash.

Signer will support domain names when available. Requirements soon to come.

Integrate a theme-config following the casper-explorer design system standard

There should be a theme-config file that follows the same design system standard that is used in the casper-explorer, use it as a reference.
Requirements:

  • libs/ui/src/theme-config.ts file including all the types inside
  • at the app initialization
  • no dark theme for now as it's scheduled for later to be done in tandem with casper-explorer

As a Signer user I can Connect/Disconnect to compatible dapps/sites

Issues for this epic:

  • User can Connect one or more accounts to any compatible site such as DotOracle or CSPR.Live. User is prompted to approve the connection before the connection is made.
  • Once connected, the User can Disconnect any account from the site.
  • As a user I see a status of Connected/disconnected
  • Signer should save a list of Connected sites in storage
  • UI to view and manage list of Connected Sites

Figma link is here: https://www.figma.com/file/mBlqs6l6I2d3ihX80Mswm4/Casper-Signer?node-id=115%3A855

1 sprint

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.