Web application with scanning qrcode

Login

For WEB application, you can scan the QR code to login via the MYKEY APP as long as you follow the SimpleWallet protocol.

WEB application should pass below JSON data to MYKEY:

// The QR code data format for login
{
protocol string // procotol name, wallet used to distinguish different protocols, this protocol is SimpleWallet
version string // Protocol version information, such as 1.0
dappName string // dapp name
dappIcon string // dapp Icon
action string // The assignment for login
uuID string // The unique id generated by dapp server for this login verification
loginUrl string // The url on dapp server to accept the login validation information
expired number // Qr code expiration time, unix timestamp
loginMemo string // Login note information, wallet for display, optional
chain string // EOS, ETH or ANY(EOS will be used for ANY if EOS account exists)
}

MYKEY APP scan the QR code, request authentication to login, and post the signed data to the loginUrl specified by WEB application.

WEB application will receive below JSON data from MYKEY:

{
protocol string // protocol name,use "SimpleWallet" by default
version string // protocol version, e.g. "1.0"
timestamp number // current UNIX timestamp number
sign string // eos signature
uuID string // dapp server generated for the unique identity in this login verification
Account string // eos account name
Ref string // source, such as the wallet name mykey
}

The server side of WEB application should use the Reserved public key to verify the signature. Reserved public key could be acquired by reading MYKEY smart contract, please check DOC.

Call Contract

Sequence diagram for Web QR code scan

Please pass the data to MYKEY as follows, the data format is json:

// Contract call data format
{
protocol string // protocol name,use "SimpleWallet" by default
version string // protocol version, e.g. "1.0"
action string // action type, use "transaction"
dappName string // DApp name
dappIcon string // DApp icon url
desc string // Semantic description of MYKEY display to the user contract call
callback string // Deeplink MYKEY callback to DApp, e.g. custom://custom.com/contract
notifyUrl string // The callback URL endpoint of DAppServer for receive success notification from MYKEY
ContractRequest [ // Arrary of contact actions, include transfer and non-transfer actions
{ // non-transfer
account string // contract code name
name string // contract action name
info string // Semantic description of MYKEY display to the user about this action
data object // The parameter object passed according to the contract abi definition e.g. {key1: value1, key2: value2 }
},
{ // transfer
account string // contract code name
name string // contract action name
info string // Semantic description of MYKEY display to the user about this action
TransferDataRequest {
from string // From
to string // To
quantity string // Amount and Symbol,e.g. "1.0000 EOS"
memo string // Memo
}
}
]
expired number // Only in web QR code mode, expire date,unix timestamp
}

Sign

Sequence diagram for Web QR code scan

Please pass the data to MYKEY as follows, the data format is json:

// Sign call data format
{
protocol string // protocol name,use "SimpleWallet" by default
version string // protocol version, e.g. "1.0"
action string // action type, use "sign"
dappName string // DApp name
dappIcon string // DApp icon url
desc string // Semantic description of MYKEY display to the user contract call
message string // Unsigned messages
callback string // Deeplink MYKEY callback to DApp, e.g. custom://custom.com/contract
notifyUrl string // The callback URL endpoint of DAppServer for receive success notification from MYKEY
expired number // Only in web QR code mode, expire date,unix timestamp
}