Signature in Organisation ID Service
- 1 Initiate Sign Method
- 2 Methods for Retrieving Signature Results
- 2.1 Get One Signature Result Method
- 2.1.1 JSON Example for getOneSignResultRequest
- 2.1.2 Example Request
- 2.1.3 Possible Errors
- 2.1.4 JSON Response Value
- 2.1.4.1 details
- 2.2 Get Signature Results Method
- 2.2.1 JSON Example for getSignResultsRequest
- 2.2.2 Example Request
- 2.2.3 Possible Errors
- 2.2.4 JSON Response Value
- 2.3 Cancel Sign Method
- 2.3.1 JSON Example for cancelSignRequest
- 2.3.2 Example Request
- 2.3.3 Possible Errors
- 2.1 Get One Signature Result Method
Initiate Sign Method
This page covers signing within Freja’s Organisation ID service. For a general guide on the Freja Signature Service, check this page.
The method is called using HTTP POST through the URLs below:
Environment | Endpoint |
|---|---|
TEST |
|
PRODUCTION |
|
Important!
You need to have an Organisation ID set for a user to be able to initiate signature requests using these URLs. If that is not the case, please refer to Organisation ID Service.
JSON Example for initSignRequest
The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:
{
"userInfoType":"User info type",
"userInfo":"User information corresponding to user info type",
"minRegistrationLevel":"Minimum required registration level of a user",
"userConfirmationMethod":"Method used to confirm user's identity",
"useDynamicQrCode":"Flag to enable dynamic QR code",
"title":"Title to display in transaction list",
"pushNotification":{
"title":"Title to display in push notification to user",
"text":"Text to display in push notification to user"
},
"expiry":"Expiry time for the request",
"dataToSignType":"Type of data to sign",
"dataToSign":"The data to be signed",
"signatureType":"Signature type",
"attributesToReturn":[
{
"attribute":"Type of attribute to be returned"
}
]
"orgIdIssuer":"Optional, should be ANY if requested organisation ID is set by another Relying Party"
} |
|
For more information on userInfo refer to https://frejaeid.atlassian.net/wiki/spaces/DOC/pages/2162814/Signature+Service#JSON-Example-for-initSignRequest | |
In order to be able to request organisation ID set by another Relying Party, you must first get in touch with partnersupport@frejaeid.com. | |
For more information about the rest of the parameters refer to https://frejaeid.atlassian.net/wiki/spaces/DOC/pages/2162814/Signature+Service#JSON-Example-for-initSignRequest |
Example Request with ORG_ID userInfoType
If you wish to initiate a signature request for a user with the specific organisation identifier 'vejobla', follow these steps:
Create the JSON structure {"userInfoType":"ORG_ID","userInfo":"vejobla","title":"Sign transaction","expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT",
"dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE","attributesToReturn":[{"attribute":"BASIC_USER_INFO"}]}Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name initSignRequest and the Base64 encoded JSON structure from the step 2 as its value.
The HTTP body should be the following (compact format, line broken for clarity only):
initSignRequest=eyJ1c2VySW5mb1R5cGUiOiJPUkdfSUQiLCJ1c2VySW5mbyI6InZlam9ibGEiLC
J0aXRsZSI6IlNpZ24gdHJhbnNhY3Rpb24iLCJleHBpcnkiOjE1MTc1MjYwMDAwMDAsImRhdGFUb1Np
Z25UeXBlIjoiU0lNUExFX1VURjhfVEVYVCIsImRhdGFUb1NpZ24iOnsidGV4dCI6IlZHaHBjeUJwY3
lCaElIUmxlSFFnWm05eUlITnBaMjRnZEhKaGJuTmhZM1JwYjI0dSJ9LCJzaWduYXR1cmVUeXBlIjoi
U0lNUExFIiwiYXR0cmlidXRlc1RvUmV0dXJuIjpbeyJhdHRyaWJ1dGUiOiJCQVNJQ19VU0VSX0lORk
8ifV19Example Request with EMAIL userInfoType
If you wish to initiate a signature request for a user with an email address joe.black@freja.com, follow these steps:
Create the JSON structure {"userInfoType":"EMAIL","userInfo":"joe.black@freja.com","title":"Sign transaction","expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT",
"dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE","attributesToReturn":[{"attribute":"ORGANISATION_ID_IDENTIFIER"}]}Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name initSignRequest and the Base64 encoded JSON structure from the step 2 as its value.
The HTTP body should be the following (compact format, line broken for clarity only):
initSignRequest=eyJ1c2VySW5mb1R5cGUiOiJFTUFJTCIsInVzZXJJbmZvIjoiam9lLmJsYWNrQH
ZlcmlzZWMuY29tIiwidGl0bGUiOiJTaWduIHRyYW5zYWN0aW9uIiwiZXhwaXJ5IjoxNTE3NTI2MDAw
MDAwLCJkYXRhVG9TaWduVHlwZSI6IlNJTVBMRV9VVEY4X1RFWFQiLAoiZGF0YVRvU2lnbiI6eyJ0ZX
h0IjoiVkdocGN5QnBjeUJoSUhSbGVIUWdabTl5SUhOcFoyNGdkSEpoYm5OaFkzUnBiMjR1In0sInNp
Z25hdHVyZVR5cGUiOiJTSU1QTEUiLCJhdHRyaWJ1dGVzVG9SZXR1cm4iOlt7ImF0dHJpYnV0ZSI6Ik
9SR0FOSVNBVElPTl9JRF9JREVOVElGSUVSIn1dfQ==Example Request with PHONE userInfoType
If you wish to initiate a sign request for a user with a phone number '+46731234567':
Create the JSON structure {"userInfoType":"PHONE","userInfo":"+46731234567","title":"Sign transaction","confidential":false,"expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT","dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE"}
Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name initSignRequest and the Base64 encoded JSON structure from the step 2 as its value.
The HTTP body should be the following:
initSignRequest=eyJ1c2VySW5mb1R5cGUiOiJQSE9ORSIsInVzZXJJbmZvIjoiKzQ2NzMxMjM0NTY
3IiwidGl0bGUiOiJTaWduIHRyYW5zYWN0aW9uIiwiY29uZmlkZW50aWFsIjpmYWxzZSwiZXhwaXJ5Ij
oxNTE3NTI2MDAwMDAwLCJkYXRhVG9TaWduVHlwZSI6IlNJTVBMRV9VVEY4X1RFWFQiLCJkYXRhVG9Ta
WduIjp7InRleHQiOiJWR2hwY3lCcGN5QmhJSFJsZUhRZ1ptOXlJSE5wWjI0Z2RISmhibk5oWTNScGIy
NHUifSwic2lnbmF0dXJlVHlwZSI6IlNJTVBMRSJ9Example Request with SSN userInfoType
If you wish to initiate a sign request for a user with an SSN '198905218072' and country 'SE':
Create the JSON structure {"country":"SE","ssn":"198905218072"}, then do the base64 of this JSON.
This is the Base64 of step 1: 'eyJjb3VudHJ5IjoiU0UiLCJzc24iOiIxOTg5MDUyMTgwNzIifQ==' , which is the userInfo value in our request.
Create the JSON structure {"userInfoType":"SSN","userInfo":"eyJjb3VudHJ5IjoiU0UiLCJzc24iOiIxOTg5MDUyMTgwNzIifQ==","title":"Sign transaction","expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT","dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE"}
Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name initSignRequest and the Base64 encoded JSON structure from the step 4 as its value.
The HTTP body should be the following:
initSignRequest=eyJ1c2VySW5mb1R5cGUiOiJTU04iLCJ1c2VySW5mbyI6ImV5SmpiM1Z1ZEhKNU
lqb2lVMFVpTENKemMyNGlPaUl4T1RnNU1EVXlNVGd3TnpJaWZRPT0iLCJ0aXRsZSI6IlNpZ24gdHJh
bnNhY3Rpb24iLCJleHBpcnkiOjE1MTc1MjYwMDAwMDAsImRhdGFUb1NpZ25UeXBlIjoiU0lNUExFX1
VURjhfVEVYVCIsImRhdGFUb1NpZ24iOnsidGV4dCI6IlZHaHBjeUJwY3lCaElIUmxlSFFnWm05eUlI
TnBaMjRnZEhKaGJuTmhZM1JwYjI0dSJ9LCJzaWduYXR1cmVUeXBlIjoiU0lNUExFIn0=Example request with UPI userInfoType
If you wish to initiate a signature request for a user with unique personal identifier 5633-823597-7862, follow these steps:
Create the JSON structure {"userInfoType":"UPI","userInfo":"5633-823597-7862","title":"Sign transaction","expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT", "dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE","attributesToReturn":[{"attribute":"ORGANISATION_ID_IDENTIFIER"}]}
Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name initSignRequest and the Base64 encoded JSON structure from the step 2 as its value.
The HTTP body should be the following (compact format, line broken for clarity only):
initSignRequest=eyJ1c2VySW5mb1R5cGUiOiJVUEkiLCJ1c2VySW5mbyI6IjU2MzMtODIzNTk3LTc
4NjIiLCJ0aXRsZSI6IlNpZ24gdHJhbnNhY3Rpb24iLCJleHBpcnkiOjE1MTc1MjYwMDAwMDAsImRhdG
FUb1NpZ25UeXBlIjoiU0lNUExFX1VURjhfVEVYVCIsCiJkYXRhVG9TaWduIjp7InRleHQiOiJWR2hwY
3lCcGN5QmhJSFJsZUhRZ1ptOXlJSE5wWjI0Z2RISmhibk5oWTNScGIyNHUifSwic2lnbmF0dXJlVHlw
ZSI6IlNJTVBMRSIsImF0dHJpYnV0ZXNUb1JldHVybiI6W3siYXR0cmlidXRlIjoiT1JHQU5JU0FUSU9
OX0lEX0lERU5USUZJRVIifV19Possible Errors
Code Returned | Explanation |
|---|---|
0 | Internal error. |
1001 | Invalid or missing userInfoType. |
1002 | Invalid or missing userInfo. |
1004 | You are not allowed to call this method. |
1005 | User has disabled your service. |
1006 | Invalid confidential. |
1008 | Unknown Relying Party. |
1009 | You are not allowed to request integratorSpecificUserId parameter. |
1010 | JSON request cannot be parsed. |
1012 | User with the specified userInfo does not exist in Freja eID database. |
3000 | Invalid or missing dataToSignType. |
3001 | Invalid or missing dataToSign. |
3002 | Invalid or missing signatureType. |
3003 | Invalid expiry time. |
3004 | Invalid push notification. |
3005 | Invalid attributesToReturn parameter. |
3006 | Custom identifier has to exist when it is requested. |
3007 | Invalid title. |
4001 | In order to use organisational transactions, user must have an Organisation ID set. |
4007 | Invalid organisation ID issuer. |
JSON Response Value
If HTTP 200 is returned from the method, the following return value will be present in the body of the response:
{
"signRef":"Reference to be submitted in getOneResult method"
} |
|
Methods for Retrieving Signature Results
There are two methods that can be used for fetching digital signature results:
one that returns a single result for a specified signature reference (signRef returned from a call to Initiate Sign Method), and
one that returns multiple signature results.
The second is the preferred way of fetching results in situations where a Relying Party has many concurrent signatures in progress, as it reduces the number of polling requests.
Get One Signature Result Method
The method is called using HTTP POST through the URLs below:
Environment | Endpoint |
|---|---|
TEST |
|
PRODUCTION |
|
JSON Example for getOneSignResultRequest
The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:
{
"signRef":"Signature reference"
} | signRef: string, mandatory. The value must be equal to a signature reference previously returned from a call to the Initiate Sign Method. The time period during which a specific signature reference is available for checking will depend on the longevity of the signature operation see the expiry parameter in the Initiate Sign method) and is calculated as expiry time plus 3 days. |
Example Request
If you wish to fetch a single signature result with the signature reference previously returned from a call to initSignRequest (for a user with specific organisation identifier 'vejobla'), follow these steps:
Create the JSON structure {"signRef":"TrLA9zdxCBlNOQNvkdhAM14mJmlL20digC7+QgEVRwmE7SH8Qm0swWIc6whfKm4Y"}
Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name getOneSignResultRequest and the Base64 encoded JSON structure from the step 2 as its value.
The HTTP body should be the following (compact format, line broken for clarity only):
getOneSignResultRequest=eyJzaWduUmVmIjoiVHJMQTl6ZHhDQmxOT1FOdmtkaEFNM
TRtSm1sTDIwZGlnQzcrUWdFVlJ3bUU3U0g4UW0wc3dXSWM2d2hmS200WSJ9Possible Errors
Code Returned | Explanation |
|---|---|
1008 | Unknown Relying Party. |
1100 | Invalid reference (for example, nonexistent or expired). |
JSON Response Value
If HTTP 200 is returned from the method, the following return value will be present in the body of the response:
{
"signRef":"Signature reference",
"status":"Signature status",
"details":"JWS signed data",
"requestedAttributes":"Additional attributes about the user"
} |
|
details
The content of this response element will depend on the signatureType requested when the signature was initiated.
Simple Signature Type
JWS in compact serialised form as following:
BASE64URL(UTF8(JWS Protected Header)) || ’.’ || BASE64URL(JWS Payload) || ’.’ || BASE64URL(JWS Signature)
JWS Protected Header | |
{
"x5t":"SHA-1 digest of the signing certificate",
"alg":"algorithm used to secure the JWS"
} |
|
JWS Payload | |
{
"signRef":"Signature reference",
"status":"Signature status",
"userInfoType":"User info type",
"userInfo":"User information corresponding to user info type",
"minRegistrationLevel":"Minimum required registration level of a user",
"timestamp":"Time when signature was confirmed by end user",
"signatureType":"Signature type",
"signatureData": {
"userSignature":"The signature produced by the end user",
"certificateStatus":"Evidence of end-users certificate status",
"advancedSignature" : "If requested, the advanced signature"
},
"requestedAttributes":{
"JSON object"
},
} |
|
Get Signature Results Method
The method is called using HTTP POST through the URLs below:
Environment | Endpoint |
|---|---|
TEST |
|
PRODUCTION |
|
JSON Example for getSignResultsRequest
The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:
{
"includePrevious":"Include previously returned results"
} |
|
Example Request
If you wish to fetch multiple signature results, follow these steps:
Create the JSON structure {"includePrevious":"ALL"}
Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name getSignResultsRequest and the Base64 encoded JSON structure from the step 2 as its value.
The HTTP body should be the following:
getSignResultsRequest=eyJpbmNsdWRlUHJldmlvdXMiOiJBTEwifQ==Possible Errors
Code Returned | Explanation |
|---|---|
1008 | Unknown Relying Party. |
1100 | Invalid reference (for example, nonexistent or expired). |
JSON Response Value
If HTTP 200 is returned from the method, the following return value will be present in the body of the response:
{
"signatureResults":[
{
"signRef":"Signature reference",
"status":"Signature status",
"details":"Signed data",
"requestedAttributes":{
"basicUserInfo":{
"name":"User's name",
"surname":"User's surname"
},
"emailAddress":"User's primary email address",
"allEmailAddresses"[
{
"emailAddress":"User's primary email address"
},
{
"emailAddress":"Other user's email address"
},
],
"allPhoneNumbers":[
{
"phoneNumber":"User's phone number"
},
{
"phoneNumber":"User's phone number"
},
],
"dateOfBirth":"User's date of birth",
"age":"User's age",
"gender":"User's gender",
"photo":"User's photo, Base64 encoded JPEG bytes",
"nfcIdPhoto":"User's photo from ID document, Base64 encoded JPEG bytes",
"addresses":[
{
"country":"Country",
"city":"City",
"postCode":"Postal code",
"address1":"Street, number or equivalent",
"address2":"Street, number or equivalent",
"address3":"Street, number or equivalent",
"validFrom":"Date from which the address is valid",
"type":"Type of user's address",
"sourceType":"Source from which the address is obtained"
}
],
"customIdentifier":"Custom identifier set by the Relying Party",
"ssn":{
"ssn":"Social security number of the end user",
"country":"Country of SSN"
},
"document":{
"type":"Type of document used for registration e.g. passport",
"country":"Document issuing country",
"serialNumber":"Document serial number",
"expirationDate":"Document expiration date"
},
"documentPhoto":"Document photo, Base64 encoded JPEG bytes",
"registrationLevel":"User's registration level in Freja",
"uniquePersonalIdentifier":"User's unique personal identifier in Freja",
"loaLevel":"User's level of assurance (LOA) in Freja",
"relyingPartyUserId":"Unique user ID reserved for Relying Parties",
"integratorSpecificUserId":"Unique user ID reserved for Integrators"
}
},
{
"signRef":"...",
}
]
} |
|
Cancel Sign Method
This method is used by a Relying Party to cancel a signature request. The method is called using HTTP POST through the URLs below:
Environment | Endpoint |
|---|---|
TEST |
|
PRODUCTION |
|
JSON Example for cancelSignRequest
The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:
{
"signRef":"Authentication reference"
} |
|
Example Request
If you wish to cancel a sign request, follow these steps:
Create the JSON structure {"signRef":"TrLA9zdxCBlNOQNvkdhAM14mJmlL20digC7+QgEVRwmE7SH8Qm0swWIc6whfKm4Y"}
Encode the JSON structure to Base64.
Create the HTTP POST request with a POST parameter name cancelSign and the Base64 encoded JSON structure from the step 2 as its value.
The HTTP body should be the following:
|
Possible Errors
Code Returned | Explanation |
|---|---|
1004 | You are not allowed to call this method. |
1008 | Unknown Relying Party. |
1100 | Invalid reference (for example, nonexistent or expired). |
If HTTP 200 is returned from the method, the request was successfully fulfilled.