FIPA7V1_SignToLogIn(en-US)



  • FIPA7: SignToLogIn
    Version: 1
    Language: en-US
    Author: master_wang, C_armX, Deisler-JJ_Sboy
    Status: draft
    Create: 2021-05-30
    Update:2022-11-08
    PID: 
    TXID: 
    

    FIPA7V1_SignToLogIn(en-US)

    Contents

    About FEIP

    About this protocol

    Login process

    Data Format

    Return data

    Login process

    
    Protocol type: FIPA
    Serial number: 7
    Protocol name: SignToLogIn
    Version: 1
    Description : Log in to applications with signatures in different scenarios.
    Author: C_armX, master_wang, Deisler-JJ_Sboy
    Language: zh-CN
    Create: 2021-05-30
    Update:2022-11-08
    Previous version PID:
    
    

    About FEIP

    FIPA protocols make improvements to the FCH ecosystem. These improvements will not lead to a hard fork of the main network, and will not write information on the blockchain.

    About this protocol

    1. This protocol specifies the ways for using signature of FCH to log in to APPs.

    2. APP uses FCH address as account or binds it to account.

    3. When loging in, the user signs parameters with the private key of the address and provides the signature to the APP. If the APP verifies the signature successfully, the user is allowed to log in with the corresponding account.

    4. The parameters being signed must include 1) the ciphertextSymKey of a symmetric key(symKey) encrpted with a publick key(pubKey) provided by the APP and 2) the request timestamp.

    5. APPs can custom their own parameters in the filed of "otherParms".

    6. AID is registered on the FCH blockchain in accordance with 《FEIP15_CAPP》.

    7. The parameters in the json data should be in ascending order when signing.

    Login Data Format

    field number field name type content required
    1 meta String Fixed: "FC"<br>Case insensitive Y
    2 type String Fixed: "FIPA"<br>Case insensitive Y
    3 sn int Serial number<br>Fixed: 8 Y
    4 ver int Fixed: 1 Y
    5 name String Fixed: "SignToLogIn"<br>Case insensitive N
    6 pid hex Sha256 value of this protocol file N
    7 algorithm string Signature algorithm, the default is "ecdsa". Not case sensitive. N
    9 message.ciphertextSymKey string Symmetric key encrpted with a publick key provided by the APP Y
    10 message.timestamp time stamp The time of signing Y
    11 message.otherParms object More parameters customed by the APP N
    12 address string The address logging in Y
    13 signature string Signature of “message” signed with the private key of “address” Y

    JSON example

    {
    	"meta": "FC",
        "type": "FIPA",
        "sn": 7,
        "ver": 1,
        "name": "SignToLogIn",
        "pid": "",
        "algorithm": "ecdsa",
        "message":{
            "ciphertextSymKey": "******************************************************",
            "timestamp": 1435113975,
            "otherParms": {"lang":"chinese","location":"Beijing"}
            },
        "address": "FEk41Kqjar45fLDriztUDTUkdki7mmcjWK",
        "signature": "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
    }
    

    The message to be signed is:

    {"aid":"1cf960e0cf914bf7d19565d304a61a1123600e49eeb12f2fb7988c83cba18bb0","otherParms":{"lang":"chinese","location":"Beijing"},"timestamp":1435113975,"userIP":"119.102.1.122"}
    

    Login process

    There are three scenarios and processes for signing in with a signature:

    1. Log in from the signing tool

    The signing tool is an application that stores the user's private key and can provide signatures.

    In this scenarios, the tool can get the pubKey from blockchain of Freecash, then make and send the ciphertextSymKey and signature to the APP to log in.

    The process is:

    login from tool.png

    The data sent from the signing tool to the APP is:

    {
    	"meta": "FC",
        "type": "FIPA",
        "sn": 7,
        "ver": 1,
        "name": "SignToLogIn",
        "pid": "",
        "algorithm": "ecdsa",
        "message":{
            "ciphertextSymKey": [Symmetric key encrpted with a publick key provided by the APP],
            "timestamp": [Current time stamp],
            "otherParms": {string array. [Other paramaters]}
            },
        "address": [string. FCH Address of the user],
        "signature": [string. Signature of the compressed message value]
    }
    
    

    2. Log in by scanning QR

    When the APP and the signing tool are on different devices, the APP shows the login QR code to the user, and the user scans the QR to log in with the signing tool.

    The process is:

    login by scanning.png

    The data in the QR is:

    {
    	"meta": "FC",
    	"type": "FIPA",
    	"sn": 7,
    	"ver": 1,
    	"name": "SignToLogIn",
    	"pid": "",
    	"data": {
    		"getUrl": [string.The url for signing tool to get information of the APP],
    		"putUrl": [string.The url for signing tool put signature to the APP]
    	}
    }
    
    

    The data sent from the app to the signing tool through getUrl is:

    {
    	"meta": "FC",
        "type": "FIPA",
        "sn": 7,
        "ver": 1,
        "name": "SignToLogIn",
        "pid": "",
        "data":{
    		"pubKey": [string, public key used to encypted the symKey.],
            "aid": [string. txid in which the APP was registed on chain.],
            "otherParms": [string array. Other paramaters]
            }
    }
    
    

    The data sent from the signing tool to the APP with putUrl is:

    {
    	"meta": "FC",
        "type": "FIPA",
        "sn": 7,
        "ver": 1,
        "name": "SignToLogIn",
        "pid": "",
        "algorithm": "ecdsa",
        "message":{
            "ciphertextSymKey": [Symmetric key encrpted with a publick key provided by the APP],
            "timestamp": [Current time stamp],
            "otherParms": [string array. Other paramaters]
            },
        "address": [FCH Address of the user],
        "signature": [Signature of the compressed message value]
    }
    
    

    3. Log in by waking up the signing tool

    When the APP and the signing tool are on the same device, the user can wake up the signing tool from the APP to sign for login.

    The process is:

    login by waking tool.png

    The data sent from the APP to the signing tool is:

    {
        "meta": "FC",
        "type": "FIPA",
        "sn": 7,
        "ver": 1,
        "name": "SignToLogIn",
        "pid": "",
        "data":{
    		"pubKey": [string, public key used to encypted the symKey.],
            "aid": [string. txid in which the APP was registed on chain.],
            "otherParms": [string array. Other paramaters]
            }
    }
    
    

    The data sent from the signing tool to the APP is:

    {
        "meta": "FC",
        "type": "FIPA",
        "sn": 7,
        "ver": 1,
        "name": "SignToLogIn",
        "pid": "",
        "algorithm": "ecdsa",
        "message":{
            "ciphertextSymKey": [Symmetric key encrpted with a publick key provided by the APP],
            "timestamp": [Current time stamp],
            "otherParms": [string array. Other paramaters]
            },
        "address": [string.FCH Address of the user],
        "signature": [string.Signature of the compressed message value]
    }
    
    

    Return data

    field type content
    code int
    msg sting
    pubKey string The public key provided by APP
    code msg
    0 OK
    1 Unknown error.
    1200 User refused to sign.
    1201 The AID is wrong.
    1202 The signer was denied access.
    1203 The logging in IP is not authorized in the signature
    1204 Signature timed out.
    1205 The signature failed verification.
    1300 The private key was not found.
    1400 No response received.
    • JSON example
    {
        "code":1202, 
        "msg":"The signer was denied access.",
    	"pubKey": "PPPPPPPPPPPPPPPPPPPPPPPPPP""
    }
    

Log in to reply