GithubHelp home page GithubHelp logo

mattyice / steem-keychain Goto Github PK

View Code? Open in Web Editor NEW
64.0 7.0 45.0 4.22 MB

A wallet browser extension for the Steem blockchain and cryptocurrency

License: MIT License

HTML 13.90% CSS 13.18% JavaScript 72.92%

steem-keychain's Introduction

Putting private keys directly into websites is not safe or secure. Even ones run by SteemIt, Inc. Yet this is currently how nearly every Steem-based site or service currently works. On top of that, most Steem users likely use their master password which is even worse

The Vessel desktop wallet software is a secure alternative, but it is too difficult to use for the majority of Steem users and does not easily interact with websites - which is Steem's primary use case.

On Ethereum, you never have to enter your private key into a website to use a dApp, you can just use a browser extension like Metamask, which dApp websites can interface with to securely store your keys and broadcast transactions to the blockchain.

Steem Keychain aims to bring the security and ease-of-use of Metamask to the Steem blockchain platform.

Installation

You can download and install the latest published version of the extension for the following browsers:

Features

The Steem Keychain extension includes the following features:

  • Store an unlimited number of Steem account keys, encrypted with AES
  • View balances, transaction history, voting power, and resource credits
  • Send STEEM and SBD transfers, manage witness votes, and update SP delegation right from the extension
  • Securely interact with Steem-based websites that have integrated with Steem Keychain
  • Manage transaction confirmation preferences by account and by website
  • Locks automatically on browser shutdown or manually using the lock button

Website Integration

Websites can currently request the Steem Keychain extension to perform the following functions / broadcast operations:

  • Send a handshake to make sure the extension is installed
  • Decrypt a message encrypted by a Steem account private key (commonly used for "logging in")
  • Post a comment (top level or reply)
  • Broadcast a vote
  • Broadcast a custom JSON operation
  • Send a transfer
  • Send Steem Engine tokens
  • Send Delegations
  • Power up/down
  • Vote for witnesses

Example

An example of a web page that interacts with the extension is included in the "example" folder in the repo. You can test it by running a local HTTP server and going to http://localhost:1337/main.html in your browser.

cd example python -m http.server 1337 //or any other method to run a static server

NOTE: On localhost, it will only run on port 1337.

API Documentation

The Steem Keychain extension will inject a "steem_keychain" JavaScript into all web pages opened in the browser while the extension is running. You can therefore check if the current user has the extension installed using the following code:

if(window.steem_keychain) {
    // Steem Keychain extension installed...
} else {
    // Steem Keychain extension not installed...
}

Handshake

Additionally, you can request a "handshake" from the extension to further ensure it's installed and that your page is able to connect to it:

steem_keychain.requestHandshake(function() {
    console.log('Handshake received!');
});

Transfer

Sites can request that the extension sign and broadcast a transfer operation for STEEM or SBD. Note that a confirmation will always be shown to the user for transfer operations and they cannot be disabled.

steem_keychain.requestTransfer(account_name, to_account, amount, memo, currency, function(response) {
	console.log(response);
},enforce);

where memo will be encrypted using Memo key if it is starting by #, and enforce doesn't allow the user to chose which account will make the transfer but rather enforce account_name.

Decode Memo / Verify Key

Sites can request that the extension decode a memo encrypted by the Memo, Posting, or Active key for a particular Steem account. This is messaged to the user as "Verify Key" since it is typically used to verify that they have access to the private key for an account in order to "log them in".

steem_keychain.requestVerifyKey(account_name, encrypted_message, key_type, function(response) {
    console.log(response);
});

The values for "key_type" can be: "Memo", "Posting", or "Active".

Comment Operation

Sites can request that the extension sign and broadcast a "comment" operation (which can be a top-level post or a reply).

steem_keychain.requestPost(account_name, title, body, parent_permlink, parent_author, json_metadata, permlink, function(response) {
	console.log(response);
});

Vote

Sites can request that the extension sign and broadcast a "vote" operation:

steem_keychain.requestVote(account_name, permlink, author, weight, function(response) {
	console.log(response);
});

Custom JSON

Sites can request that the extension sign and broadcast a "custom_json" operation using either the posting or active key for the account:

steem_keychain.requestCustomJson(account_name, custom_json_id, key_type, json, display_name, function(response) {
	console.log(response);
});

Where "key_type" can be "Posting" or "Active" and "display_name" is a user-friendly name of the operation to be shown to the user so they know what operation is being broadcast (ex. "Steem Monsters Card Transfer").

Sign

Sites can request that the extension sign messages:

steem_keychain.requestSignBuffer(account_name, message, key_type, function(response) {
        console.log(response);
});

Where "message" is any string and "key_type" can be "Posting" or "Active". This is equivalent to

Signature.signBufferSha256(hash.sha256(message), wif).toHex();

You can also pass in a JSON-stringified Node.js Buffer object. For example, if buffer is a Node.js Buffer to be signed, you can pass JSON.stringify(buffer) as message, then this method becomes equivalent to

Signature.signBufferSha256(hash.sha256(buffer), wif).toHex();

Add Account Authority

Sites can request that the extension add account authority for a given role:

steem_keychain.requestAddAccountAuthority(account_name, authorized_account_name, role, weight, function(response) {
        console.log(response);
});

where "role" can be "Posting" or "Active".

Remove Account Authority

Sites can request that the extension remove account authority for a given role:

steem_keychain.requestRemoveAccountAuthority(account_name, authorized_account_name, role, function(response) {
        console.log(response);
});

where "role" can be "Posting" or "Active".

Broadcast

Sites can request that the extension sign and broadcast general operations allowed by the steem-js library:

steem_keychain.requestBroadcast(account_name, operations, key_type, function(response) {
        console.log(response);
});

Where "operations" is the list of operations and "key_type" can be "Posting" or "Active". This is roughly equivalent to

broadcast.send({ extensions: [], operations }, keys, errorCallback);

Signed Call

Sites can request that per sign RPCs using steem authorities as specified in https://github.com/steemit/rpc-auth and implemented in the steem-js library method signedCall:

steem_keychain.requestSignedCall(account_name, method, params, key_type, function(response) {
        console.log(response);
});

Where "method" is the method name, e.g. conveyor.get_feature_flags, "params" are the method parameters, and "key_type" can be "Posting" or "Active".

Send Tokens

Sites can request that Keychain broadcasts a JSON with active authority to transfer tokens to another user. This works with tokens generated using Steem Engine.

steem_keychain.requestSendToken(username, to,amount,memo, token, function(response) {
    console.log(response);
});

where token is the symbol of the said token.

Delegate

Sites can request a delegation via Keychain, using the active authority :

steem_keychain.requestDelegation(username, delegatee, amount, unit, function(response) {
    console.log(response);
});

where unit can be either VESTS or SP. amount needs 6 decimals if the unit is VESTS, 3 if it is SP.

Vote for a Witness

Sites can request that the user votes for a particular witness :

steem_keychain.requestWitnessVote(username, witness,vote, function(response) {
    console.log(response);
});

Where vote is a boolean, set to true for voting a witness, false for unvoting.

Power Up

Sites can request a Power Up:

steem_keychain.requestPowerUp(username, to, amount, function(response) {
    console.log(response);
});

Where to is the recipient of the power up, and amount is expressed in STEEM (with 3 decimals).

Power Down

Sites can request a Power Down:

steem_keychain.requestPowerDown(username,  amount, function(response) {
    console.log(response);
});

Where amount is expressed in SP for more visibility for the user.

Related Projects

steem-keychain's People

Contributors

economicstudio avatar eonwarped avatar mattyice avatar quochuy3191313 avatar shawnpringle avatar stoodkev avatar syvb avatar tchap avatar vim-arcange 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

steem-keychain's Issues

Customizable Auto Lock

Lock should be customizable from the Settings.
Users will have 3 choices:

  • Manual Lock (also lock when browser or computer is off)
  • Lock when the computer is locked
  • Lock after xx minutes idle (in this case, user needs to specify the time)

Issue broadcasting two custom_json operations in a row

From @asgarth (SteemPeak developer):

when I have the check on keychain to avoid confirming each operation everything works as expected
but when I uncheck the box and keychain ask me to confirm both operations this is what I do:

1 - broadcasting the first one
2- the user confirm
3- callback get called
4- broadcast the second operation
5- the user confirm
6- I never get the second callback

I think there is something weird while I broadcast a second operation inside the callback of the first one

README: What is a message encrypted by a Steem account private key?

Hi,

I am trying to integrate Steem Keychain with a web app. I am not so much into crypto, so would it be possible to elaborate in the README how the user is supposed to generate a "message encrypted by a Steem account private key" to be passed to the extension to verify the key? I would actually love to know myself to test the integration :-)

Thanks!

Confirmation popup is messed up the first time it's used after browser has been idle

I'm not 100% sure how to reproduce this, but it happens to me pretty frequently. You can try it on the Steem Monsters test site I set up at https://sm.mrosen.com. When you log in it will send a "decode" request to the extension. From then on if you reload the page it saves your username and will send a "decode" request automatically.

I have found that if I leave the browser open, and then either load or reload that page after a while, the issue in the attached screenshot happens. I don't see any errors in the extension console...it might be a timing issue or something.

sw_issue

Add an open source license to the repository

Super excited about Steem Keychain and the increased security it will bring to the common Steem workflow! The introductory post mentions:

The code for the extension is all open source and available on Github here

However, I didn't see a LICENSE file in the repo / anything mentioned in the README. This is not ideal as described here. Open source licenses, in addition to granting users the ability to modify and distribute the software, also have disclaimers such that should a user of the software have an issue the developers are not personally responsible.

There are many OSI-approved licenses. Happy to answer any questions about their specific implications to the best of my ability (IANAL). Personally, I go with permissive licenses for my work such as MIT or BSD 3-Clause, but depending on your priorities copyleft licenses may be of interest.

Change how websites request custom_json transactions from the extension

I would like to change how websites request custom_json transactions to be like the following:

var request={type:"custom",
              username:$("#custom_username").val(),
              id: $("#custom_id").val(), // example 'follow' or 'sm_gift_cards', etc.
              key: $("#custom_key").val(), // example 'posting' or 'active'
              json: $("#custom_json").val() // example  { "property1": "value1", ... }
              };

open up broadcast.send API?

I was wondering if there were any thoughts to opening up just doing a generic broadcast send (basically what steem-js what condenser uses)? It seems it can almost plug right into condenser that way.

I notice commenting with comment options is one method that this keychain handles that is using that steem-js API.

Allow for info only notifications on operation signing

There is a setting to hide the confirmation for signing operations.

But some users would want to know when a signature happens, maybe even with a few seconds of time to cancel.

So I propose a two properties on each "ignore this op" setting:

  • Still show a confirmation popup that informs the tx took place
  • Delay in seconds to wait before submitting the tx, with a button to pause/cancel

Add an auto-lock timer option

There should be an optional setting to set the extension to auto-lock after a certain amount of time. This will add additional security for those who want it.

Remember the last account selected and show that by default when open extension

If I open the extension it always shows info for the first account in the list. If i change to a different account using the drop down menu, can you make it save that selection so that if i go out of the extension popup then when i go back in it will show the last account i selected instead of the first account in the list?

Let me know if this doesn't make sense!

Allow of sending Steem Keychain links just like sending SteemConnect links

If you get an official domain name steemkeychain.com then you could create a system where users can send a SteemKeychain link, for example:
https://steemkeychain.com/transfer?from=stoodkey&to=quochuy&amount=10%20STEEM

That page would then parse the query string and send a request to the keychain extension to generate and sign the transaction. If the extension is not installed, the page would invite the user to install it.

Add RC Mana

Add the RC Mana information (percentage)
Could also add the time before the mana is full on hover

Allow sending encrypted transfer memos

If you put a # at the beginning of your transfer memo using the keychain extension (either directly from the extension or requested by a website) and the memo private key has been added for the account, it should encrypt the memo.

Add ability to choose which RPC node to connect to

In the settings there should be an option to choose which RPC to connect to if you want to connect to something other than api.steemit.com. It should have a list of existing, popular RPC nodes (including testnet nodes) and also allow users to add other nodes not in the list via a free-form text field.

Don't let apps know if an account is not available in the extension

Currently if an app sends a transaction to the wallet extension for an account that hasn't been added to the extension by the user, it returns a "no_user" error message to the app. This can be used for malicious apps to determine which accounts a certain user "owns", which is a privacy concern.

Instead, the extension should always return the same error for failure (such as "user_cancel") so there is no way for the app to tell whether or not the current user has access to the specified account or not.

Implement notification preferences settings

In the spec document it says the following:

The extension will have settings which include turning off/on notifications or features for different operations for different websites.

I envision this working as follows:

  1. For all types of transactions EXCEPT transfers, there should be a checkbox on the popup notification that shows up to confirm the transaction that says "Always allow [transaction_type] transactions from [website]"

  2. If that box is checked, then in the future whenever the current website requests to publish that type of transaction via the extension, it just does it automatically without showing any confirmation popup.

  3. Somewhere in the main extension popup page there should be a settings button. When clicked it will show a settings screen which will show a list of the different types of transactions allowed by the extension, and within each type of transactions it will show a list of sites for which confirmations have been disabled. The user can then remove any of the websites listed if they want to start receiving confirmation popups if that site tries to publish that type of transaction through the extension in the future.

  4. Transfer transactions should always show the confirmation popup and that should not be able to be turned off by the user.

screen shot 2018-07-25 at 10 42 37 am

Feature request for when sending STEEM/SBD

  • Would be nice if the plugin shows a confirmation page before doing the actual transfer, just in case...
  • Every time a transfer is successful, store the recipient in the local storage and allows a selection of previous recipients in the transfer view

Voting Mana

Voting Power should be replaced by Voting Mana

Confirmation dialog cut off at bottom on windows

Hey, so it turns out the size of the confirmation dialog window is a bit different on windows than it is on mac/linux (which is why i had made those changes before). Do you think you can work something out so it looks nice on all platforms?

windows

Allow Steem Keychain to be triggered by a click on a Steem Connect link from any Steem dapp

SteemConnect links are widely used on the blockchain for a while now, all parameters in those links can be easily parsed and converted into a parameter for Steem Keychain.

Either Steem Keychain or Steem Plus could inject piece of JS when the current browser tab is on steemit.com or any other Steem condenser. That JS snippet would then check all anchors on the page and if it finds a steemconnect.com API URL, it would then parse and extract the parameters and convert it into a call to one of the Steem Keychain functions.

If Steem Keychain is not installed then render a modal dialog that describes what is the current action was supposed to be (transfer, upvote etc...) and give the user two options:

  1. Install Steem Keychain extension in order to perform that action in a more secure manner
  2. Let them continue to the original Steem Connect link (playing it fair ๐Ÿ˜Š)

Option comment_options

Users should be able to broadcast a comment_options along comments.
An additional parameter will hold the comment_options json.
Main options should be displayed on the popup.

Ability to check who's signed in

I have a tool which I would restrict to certain steem users. Would be good if I can interrogate steem keychain to see who is currently signed into the extension. Alternatively, the website could send a username and steem keychain would respond with true or false depending if that user is signed in with steem keychain.

Add witness vote message if not voted for us

The extension should check if the current account has voted for us for witness (if the vote is not proxied) and if not show a message to support us by voting for us as witness at the bottom of the popup with a vote icon button that when clicked will broadcast the vote tx right from the extension.

Allow website to specify either active or posting key to post custom_json transactions

I recently found out that custom_json transactions can be posted using either the posting key or the active key. To use the active key you just need to put the account name in the "required_auths" property instead of "required_posting_auths".

Can you please update the extension so that a website can specify which key they want to use to publish the transaction? If none is specified then posting key should be used by default.

Can we provide option to unlock wallet from transaction popup?

If a web page tries to make a call to the extension while it is locked, it shows the attached "wallet is locked" error screen. Is it possible to allow the user to enter their wallet password right in that popup window and then continue to finish the transaction?

screen shot 2018-07-25 at 10 06 28 am

Allow Steem Keychain to be triggered by a click on a Steem Connect link

SteemConnect links are widely used on the blockchain for a while now, all parameters in those links can be easily parsed and converted into a parameter for Steem Keychain.

Either Steem Keychain or Steem Plus could inject piece of JS when the current browser tab is on steemit.com or any other Steem condenser. That JS snippet would then check all anchors on the page and if it finds a steemconnect.com API URL, it would then parse and extract the parameters and convert it into a call to one of the Steem Keychain functions.

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.