swaponline / swap.io-keys Goto Github PK
View Code? Open in Web Editor NEWhttps://keys.swap.io
License: MIT License
https://keys.swap.io
License: MIT License
Let's create an API description for the interaction with frontend.
This API will have the following functionality:
Creates a new profile - basically a pair of ECDSA keys. This profile is saved encrypted in local storage on the domain (keys.swap.io) and can further be referenced to sign txs.
This method pops an iframe on your website with dialog to create a new profile.
This method will also be used to restore a previously backed-up profile. When addProfile is invoked, a dialog with Restore Profile / New Profile prompts will be shown....
After the addProfile method is executed the frontend will be responsible to lookup all addresses associalted with the profile if there are any known addresses, or prompt user to manually restore addresses.
Creates one or more blockchain addresses.
This routine should take parameters to create one or more addresses for user based on network, address path, and template used to create an address... Different templates may be used to create addresses for the same address. For example bitcoin address is derived differently by different bitcoin clients.
Our profile is basically a mnemonic phrase, however, using the same phrase you can't get the same addresses in electrum wallet and bitcoind. Therefore we need to define commonly used templates.
The swap.io-networks needs to cointain static network definitions used for deriving addresses for different networks, whereas this repo will cointain the library to actually use the definitions to create the addresses.
I think its logical for the frontend to be responsible for keeping the list of derived addresses, with all the parameters needed for the createAddresses() for each of the addresses derived. The frontend is also responsible for backing them up on server if needed...
Having the derivation parameters for each of the addresses will often be important to restore the funds, hence the address restore paths/params need to be backed up in a centralized and may be decentralized way - as step one it will be kept on the server part of the backend... We will need to think of a way to store the settings in a way that they are disconnected from the actual profile, so that only owner of the profile can know what address derivation parameters are associated with her profile... But storage of the address definitions is not in the scope of this ticket, rather this needs to be kept in mind while designing the API.
Signs a transaction for an address. In our design, i believe the keys.swap.io doesn't have to be address-aware, meaning.. it doesn't need to have every address derived for a profile stored along the master keypairs. Hence the sign method can take the same derivation parameters that createAddress takes, so it derives a keyPair for each address a transaction is signed with on the fly ...
Another approach is to store the derived addresses with the derivation parameters, on the side of keys.swap.io ... This has an advantage that the sign(), signMessage routine is easy to use - you only pass an address to identify the needed address... however this way we will either need to make keys.swap.io be responsible for backing up the address definitions or to keep the definitions both on frontend and on keys.swap.io
This signs a message - a common function in many blockchains, often used for address owner proves. This shall take similar arguments like in sign() method.
The newrork definitions will be used to sign the messages, many blockchains prefix the signed message with a string prior to signing a message. the prefixes will need to be defined for every network...
this will verify the crypto signature of a previously signed message.
Returns public key for a specific address.
Pops up a dialog on your website with private key for specific address.
Pops up a dialog to backup a profile.
The task of this ticket is to describe the API in every detail, with examples from diffrerent blockchains... In particular ethereum, bitcoin (bitcoind), bitcoin (elecrtrum - compatible wallets) ....
Test cases for future implementation need to be collected for at least these networks:
bitcoin
bitcoin-testnet
litecoin
(as btc-like)litecoin-testnet
ethereum
etherem-ropsten
handshake
(hns)stellar
(xlm)polkadot
(dot)tron
(trx)solana
(sol)We will need to see how each testcase will look like in API calls...
похоже https://fortmatic.com/ так же делает кастодиальное хранилище, т.е. отдает ключи со своего домена, возможно стоит перенять их опыт в подключении web3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.