Initialize hash signing via mobile id Table of contents Endpoint Request body parameter description Response body parameter description Successful response Failed response Sample request Sample response Sample success response Sample failed response Implementation CURL Using php-client This API initializes hash signing with qualified electronic signature stored on SIM card.
Endpoint Path (Locale: LT) /mobile/sign/hash.json Path (Locale: EN) /en/mobile/sign/hash.json Method POST Request Body Schema application/json
Request body parameter description Key Requirement Type Description access_token Mandatory String API Access Token hash Mandatory String Hash to sign phone Mandatory String Mobile phone number for which authentication is being initialized code Mandatory String Personal code related to the phone number hash_algorithm Mandatory String SHA256 or SHA512 country Mandatory String Signer’s country code: LT, EE message Optional String Message to be displayed on the phone screen.
Response body parameter description Successful response Key Type Description status String Status of the request, ok
in this case token String Unique token to be used in future request control_code String Verification code
Failed response Key Type Description status String Status of the request, error
in this case message String Brief message about what is wrong error_code Integer Unique code for the error. Error codes are listed here
Sample request
POST /en/mobile/sign/hash.json HTTP/1.1
Host: app.marksign.local
Content-Type: application/json
{
"access_token": "52900c96-3f60-5307-3719-5948f0191da6",
"hash": "5fef901dc387c585fb470ec7887e204a23d8e16434ec94940019951bd02ffe44",
"phone": "+37269000366",
"hash_algorithm": "SHA256",
"country": "EE",
"message": "any message",
"code": "60001017705"
}
Sample response Sample success response
{
"status": "ok",
"token": "320a35af-19c9-eecd-5f7e-8725393bd955",
"control_code": "3555"
}
Sample failed response
{
"status": "error",
"message": "Invalid parameter [country]: This value is not valid.",
"error_code": 40001
}
Implementation CURL
curl --location --request POST 'https://app.marksign.local/en/mobile/sign/hash.json' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_token": "52900c96-3f60-5307-3719-5948f0191da6",
"hash": "5fef901dc387c585fb470ec7887e204a23d8e16434ec94940019951bd02ffe44",
"phone": "+37269000366",
"hash_algorithm": "SHA256",
"country": "EE",
"message": "any message",
"code": "60001017705"
}'
Using php-client To use the php-client, please follow the installation and basic usage here , and use AppBundle\GatewaySDKPhp\RequestBuilder\MobileidInitHashSigningRequestBuilder
as request builder.
/**
* The token in response ($hashSignInitResArray['token'] in this example),
* might need to be saved for future purposes.
*/
$filePath = __DIR__ . '/demo.pdf';
$hashSignInitReq = (new MobileidInitHashSigningRequestBuilder)
->withHash(hash('sha256', file_get_contents($filePath)))
->withHashAlgorithm('SHA256')
->withCountry('EE')
->withPhone('+37269000366')
->withCode('60001017705')
->withMessage('Dummy')
->createRequest();
$hashSignInitRes = $client->postRequest($hashSignInitReq);
$hashSignInitResArray = $hashSignInitRes->toArray();
var_dump($hashSignInitResArray);