Signature Service

Overview

Freja eID Signature Service allows Relying Parties to securely deliver messages to a user, as well as to prompt Freja eID end users to digitally sign data and documents. The end user will have previously downloaded the Freja eID mobile application on one or more iOS or Android devices they possess, and registered with Freja eID, allowing them to be referred to by Relying Parties through the use of one or more usernames (email, phone number, SSN). Signature Service is available to all end users regardless of their registration level, from those that have only undergone the basic registration by confirming their email address, to those that have added an ID document or upgraded to Freja eID Plus (Sweden only). Signatures created by the end users are PKI-based and therefore non-repudiable.

The signature flow is practically identical to that of authentication depicted in the section on Authentication Service. The key difference is that whereas a user can only have one authentication transaction active at any given time and the duration of authentication transactions is limited to two minutes, multiple signatures can be pending for a user's approval and each individual signature transaction can be open for up to 30 days (i.e. from the initiation by a Relying Party an end user may have up to 30 days to perform the signing). This allows for flexible signing solutions to be built on top of Freja eID where users can be prompted to sign even outside a direct online context.

Signature types

Freja eID allows for several types of signatures.

Simple signature type

The Simple signature type allows signing of UTF-8 text. Upon completion of the signature by the user, the Relying Party receives a JWS structure containing the data that was presented to the user, as well as evidence that the Freja eID infrastructure has validated the signature.

Extended signature type

The extended signature type allows signing of UTF-8 text (presented to the user) alongside binary data (not presented to the user). Upon completion of the signature by the user, the Relying Party receives a JWS structure containing the data that was presented to the user and the supplied binary data, as well as evidence that the Freja eID infrastructure has validated the signature.

Advanced signature type

The advanced signature type allows signing of UTF-8 text (presented to the user), binary data (not presented to the user) or both with one-time certificates tied to the end-user's personal data and that can be validated independently outside Freja. Note that no revocation data is supplied for the signing certificates as they are generated under user consent for one-time usage and are implicitly valid at the time of signing. The advanced signature is returned as part of the ordinary response signed by Freja eID. Currently supported advanced signature formats are listed in the table below:

Data TypeSignature FormatValue Returned to Relying Party
SIMPLE_UTF8_TEXTXML_MINAMEDDELANDENAn enveloping XML signature suitable for electronic mailbox services that integrate with Tekniska tjänstekontrakt-API Mina meddelanden

Before you begin


Disclaimer

We retain the right to extend the API with new optional parameters, new response fields and error codes. Within the same API version, these additions shall be made strictly without altering existing response fields and error codes so as not to compromise your system's stability. Therefore, your application MUST be able to handle unknown response fields and error codes.

In the case of unknown response fields, the application SHOULD ignore them and process only those it understands. In the case of unknown error codes, the application MUST present a generic error message to the end-user.

There are several technical requirements that must be in place before the implementation can start. Please complete the checklist below before proceeding:

  • Obtain an SSL client certificate providing you access to the Freja eID Test environment.
  • Import Freja eID Test root certificate as trusted into the trust store of your application.
  • Using Freja eID mobile application, register one or more users with the Freja eID Test infrastructure.

Production checklist

In order to use Freja eID in a production environment, you must fulfil the following:

  • Sign a contract allowing your organisation to access the production Freja eID Signature Service.
  • Provide Freja eID with a logo suitable to represent your organisation in the mobile application, as well as a display name and a short description. Please note that:
    • The logo must be delivered in one of the vector file formats: AI (Adobe Illustrator Artwork), EPS (Encapsulated PostScript) or editable PDF (Portable Document Format). The preferable format is AI (filename extension is .ai).
    • The display name is restricted to the maximum length of 100 characters and the description should not exceed 500 characters. The URL can be up to 100 characters long.
  • Obtain an SSL client certificate providing you access to the Freja eID Production environment.
  • Import Freja eID Production root certificate as trusted into the trust store of your application.

Methods

Freja eID Relying Party Signature Service consists of four methods: you can initiate a signature request, fetch the results of one or several initiated signature requests and cancel an initiated signature request.

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 latter 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.

More About QR Code Implementation

QR code signing is supported by the Freja eID Signature service. In essence, a user signs transaction by scanning a generated QR code and approving the signature action.

This method is the most user-friendly since the user does not need to type in any identifiers (emails, phone numbers etc.).

This document goes more into depth regarding the Freja eID API. If you would like to see more details QR code login implementation, please refer to this page about Implementation and Best Practices.

Regarding QR Code Signatures and Privacy

Inferred transactions are not bound to a specific user upon initiation, they are bound to a user when a QR code is scanned. More precisely, the first user that scans the QR code of a pending inferred transaction gets bound to it.

Therefore, you need to be aware of the privacy of the content of the signature: if the content is sensitive and intended for a specific recipient we strongly advise you to use one of the binding forms of the signature API.


Initiate sign method

This method is used by a Relying Party to initiate a signing transaction. The method is intended for creating signatures both in online contexts, where the access to the Relying Party's service or application is initiated by the end user, as well as in offline contexts, where the signature request is initiated by the Relying Party's service in its own right. Signature transactions, therefore, have configurable longevity — from the point of initiation, the user has between two minutes and 30 days to confirm the signature request. As opposed to authentication requests, multiple signature requests may be active at any given time, from the same or different Relying Parties.

Although in most cases possession and control of the handheld device on which a Freja eID app is installed are sufficient for allowing the user to view transaction content when initiating a transaction, a Relying Party can also specify whether the content is confidential or not. The confidentiality flag governs whether the user must present the PIN or, if enabled, use one of the biometric authentication alternatives on the handheld device, before being allowed to view the transaction content. The option effectively provides an option to have transactions that are "signed-for (for viewing) with explicit consent (for accepting the content)".

The method is called using HTTP POST through the URLs below:

System
Method endpoints
Test
https://services.test.frejaeid.com/sign/1.0/initSignature
Production
https://services.prod.frejaeid.com/sign/1.0/initSignature

The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:

Parameter name
Value
initSignRequest
{
   "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",
   "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"
      }
   ]
}

userInfoType: string, mandatory. Describes the type of user information supplied to identify the end user. Currently one of:

  • PHONE (end user's telephone number),
  • EMAIL (end user's email),
  • SSN (end user's social security number),
  • INFERRED (for QR code signature transactions)

userInfo: string, mandatory, 256 characters maximum. If userInfoType is EMAIL or PHONE, interpreted as a string value of the email or telephone number of the end user, respectively. If userInfoType is SSN, then it must be a Base64 encoding of the ssnuserinfo JSON structure described below. If userInfoType is INFERRED, then userInfo must be set to: "N/A" because there is no data for the user to enter.

If userInfoType is PHONE, the userInfo value MUST be in the form of: "+4673*******"; the leading plus '+' is present whereas the leading zero from the mobile phone operator code '0' is not. (See example below)

ssnuserinfo
{
   "country":"Country of SSN",
   "ssn":"Social security number of the end user"
}

country: string, mandatory. Contains the ISO-3166 two-alphanumeric country code of the country where the SSN is issued. In the current version of Freja eID, one of: ''SE'' (Sweden), ''NO'' (Norway), ''FI'' (Finland), ''DK'' (Danmark).
ssn: string, mandatory. Expected SSN of the end user as per pre-registration.

  • If country equal to "SE", the value must be the 12-digit format of the Swedish "personnummer" without spaces or hyphens. Example: 195210131234.
  • If country equal to ''NO'', the value must be the 11-digit format of the Norwegian "personnummer" without spaces or hyphens. Example: 13105212345.
  • If country equal to ''FI'', the value must be the 10-characters format of the Finish ''koodi'', with the hyphen before the last four control characters. Hyphen can be replaced with the letter A. Example format: 131052-308T or 131052A308T.
  • If country equal to ''DK'', the value must be the 10-digit format of the Danish "personnummer" without spaces or hyphens. Example: 1310521234.

minRegistrationLevel: string, optional. Minimum required registration level of a user in order to approve/decline signing transaction. Can be BASIC, EXTENDED  or PLUS. If not present, default level will be PLUS.

userConfirmationMethod: string, optional. Used to specify the method by which the user's identity is confirmed when performing an action. Can be DEFAULT or DEFAULT_AND_FACE.

title: string, optional, 128 characters maximum. The title to display in the transaction list if presented to the user on the mobile device. The title will be presented regardless of the confidentiality setting (see below). If not present, a system default text will be presented.

pushNotification: JSON structure, optional. The title and the text of the notification sent to the mobile device to alert the user of a signature request. The character limit for the push notification title and text is 256 characters for each. If not present, a system default title and text will be presented.

How much text the user sees in the push notification depends on the device's screen size.

expiry: long, optional. Describes the time until which the Relying Party is ready to wait for the user to confirm the signature request. Expressed in milliseconds since January 1, 1970, 00:00 UTC. Min value is current time +2 minutes, max value is current time +30 days. If not present, defaults to current time +2 minutes. 

Maximum expiry time for transactions with user info type INFERRED is current time +30 minutes. If not present, defaults to current time +2 minutes.

dataToSignType: string, mandatory. Describes the type of data to be signed. Currently, SIMPLE_UTF8_TEXT and EXTENDED_UTF8_TEXT are supported.

dataToSign: JSON structure, mandatory. Subject to dataToSignType; If SIMPLE_UTF8_TEXT, then all of dataToSign will be displayed to the user prior to asking for signature approval. If EXTENDED_UTF8_TEXT, then one part will be displayed to the user prior to asking for signature approval, while the binaryData part of dataToSign will not. JSON structure described below.

dataToSignTypeSIMPLE_UTF8_TEXT
dataToSign
{
   "text":"Base64 encoded UTF-8 text displayed to the end user"
}

text: string, mandatory, 4096 plain text characters maximum prior to Base64 encoding. The text that will be shown in the mobile application and signed by the end user. The content of the Base64 string are bytes representing a UTF-8 encoding of the text to be displayed to and signed by the user.

dataToSignTypeEXTENDED_UTF8_TEXT
dataToSign
{
   "text":"Base64 encoded UTF-8 text displayed to the end user",
   "binaryData":"Base64 encoded byte array not displayed to the user"
}

text: string, mandatory, 4096 plain text characters maximum prior to Base64 encoding. The text that will be shown in the mobile application and signed by the end user. The content of the Base64 string are bytes representing a UTF-8 encoding of the text to be displayed to and signed by the user.

binaryData: string, mandatory, 5 MB maximum prior to Base64 encoding. This is not shown to the user in the mobile application but is, nonetheless included in the signature.

signatureType: string, mandatory. The type of signature that is requested. Currently, SIMPLE, EXTENDED and XML_MINAMEDDELANDEN are supported and must match the dataToSignType parameterSIMPLE signature type supports SIMPLE_UTF8_TEXT data to sign type, EXTENDED signature type supports EXTENDED_UTF8_TEXT data to sign type and XML_MINAMEDDELANDEN supports SIMPLE_UTF8_TEXT data to sign type.

  • Simple signature type
    The Simple signature type allows signing of UTF-8 text. Upon completion of the signature by the user, the Relying Party receives a JWS structure containing the data that was presented to the user, as well as evidence that the Freja eID infrastructure has validated the signature.

  • Extended signature type
    The Extended signature type allows signing of UTF-8 text (presented to the user) alongside binary data (not presented to the user). Upon completion of the signature by the user, the Relying Party receives a JWS structure containing the data that was presented to the user and the supplied binary data, as well as evidence that the Freja eID infrastructure has validated the signature.

  • Advanced signature type
    The Advanced signature type XML_MINAMEDDELANDEN allows signing of UTF-8 text. Upon completion of the signature by the user, the Relying Party receives a JWS structure containing the data that was presented to the user, advancedSignature 
    as well as evidence that the Freja eID infrastructure has validated the signature. The XML signature contains the transaction text displayed to the user, the time of signing and evidence of end-user approval in a format suitable for integration with Tekniska tjänstekontrakt-API Mina meddelanden.

attributesToReturn: list of objects, optional. When retrieving results, additional information about the user can be returned based on the type of attributes required through this parameter. Each object should contain one attribute. Currently supported attribute types are:

  • BASIC_USER_INFO (name and surname),
  • EMAIL_ADDRESS (user's primary email address),

If you would prefer an email with a specific email domain please get in touch with partnersupport@frejaeid.com.

  • ALL_EMAIL_ADDRESSES (all user's email addresses),
  • ALL_PHONE_NUMBERS (all user's phone numbers)
  • DATE_OF_BIRTH (date of birth),
  • AGE (user's age based on their date of birth),
  • PHOTO (user's photo, Base64 encoded JPEG bytes),
  • ADDRESSES (user's current addresses),
  • SSN (social security number and country),
  • DOCUMENT (data of the document used for registration),
  • DOCUMENT_PHOTO (document photo, Base64 encoded JPEG bytes)

  • REGISTRATION_LEVEL (user's registration level in Freja eID)
  • RELYING_PARTY_USER_ID (a unique, user-specific value that allows the Relying Party to identify the same user across multiple sessions),
  • INTEGRATOR_SPECIFIC_USER_ID (a unique, user-specific value that allows the Integrator to identify the same user across multiple sessions regardless of the Integrated Relying Party service that the user is using. For more info, see the section about Integrator Relying Party Management),
  • CUSTOM_IDENTIFIER (a unique, Relying Party-specific, user identifier, set by the Relying Party through the Custom Identifier Management),

In order to be able to request this attribute, you must first get in touch with partnersupport@frejaeid.com.

Example request with userInfoType set to EMAIL:

If you wish to initiate a signature request for a user with an email address joe.black@verisec.com, follow these steps:

  1. Create the JSON structure {"userInfoType":"EMAIL","userInfo":"joe.black@verisec.com","minRegistrationLevel":"BASIC","title":"Sign transaction","expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT","dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE","attributesToReturn":[{"attribute":"CUSTOM_IDENTIFIER"}]}
  2. Encode the JSON structure to Base64.
  3. 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
ZlcmlzZWMuY29tIiwibWluUmVnaXN0cmF0aW9uTGV2ZWwiOiJCQVNJQyIsInRpdGxlIjoiU2lnbiB0
cmFuc2FjdGlvbiIsImV4cGlyeSI6MTUxNzUyNjAwMDAwMCwiZGF0YVRvU2lnblR5cGUiOiJTSU1QTE
VfVVRGOF9URVhUIiwiZGF0YVRvU2lnbiI6eyJ0ZXh0IjoiVkdocGN5QnBjeUJoSUhSbGVIUWdabTl5
SUhOcFoyNGdkSEpoYm5OaFkzUnBiMjR1In0sInNpZ25hdHVyZVR5cGUiOiJTSU1QTEUiLCJhdHRyaW
J1dGVzVG9SZXR1cm4iOlt7ImF0dHJpYnV0ZSI6IkNVU1RPTV9JREVOVElGSUVSIn1dfQ==
Example request with userIntoType set to PHONE:

If you wish to initiate a sign request for a user with a phone number '+46731234567':

  1. Create the JSON structure {"userInfoType":"PHONE","userInfo":"+46731234567","minRegistrationLevel":"BASIC","title":"Sign transaction","confidential":false,"expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT","dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE"}
  2. Encode the JSON structure to Base64.
  3. 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=eyJ1c2VySW5mb1R5cGUiOiJQSE9ORSIsInVzZXJJbmZvIjoiKzQ2NzMxMjM0NT
Y3IiwibWluUmVnaXN0cmF0aW9uTGV2ZWwiOiJCQVNJQyIsInRpdGxlIjoiU2lnbiB0cmFuc2FjdGlv
biIsImNvbmZpZGVudGlhbCI6ZmFsc2UsImV4cGlyeSI6MTUxNzUyNjAwMDAwMCwiZGF0YVRvU2lnbl
R5cGUiOiJTSU1QTEVfVVRGOF9URVhUIiwiZGF0YVRvU2lnbiI6eyJ0ZXh0IjoiVkdocGN5QnBjeUJo
SUhSbGVIUWdabTl5SUhOcFoyNGdkSEpoYm5OaFkzUnBiMjR1In0sInNpZ25hdHVyZVR5cGUiOiJTSU
1QTEUifQ==
Example request with userIntoType set to SSN:

If you wish to initiate a sign request for a user with an SSN '198905218072' and country 'SE':

  1. Create the JSON structure {"country":"SE","ssn":"198905218072"}, then do the base64 of this JSON.
  2. This is the Base64 of step 1:   'eyJjb3VudHJ5IjoiU0UiLCJzc24iOiIxOTg5MDUyMTgwNzIifQ==' , which is the userInfo value in our request.
  3. Create the JSON structure {"userInfoType":"SSN","userInfo":"eyJjb3VudHJ5IjoiU0UiLCJzc24iOiIxOTg5MDUyMTgwNzIifQ==",
    "minRegistrationLevel":"PLUS","title":"Sign transaction","expiry":1517526000000,"dataToSignType":"SIMPLE_UTF8_TEXT",
    "dataToSign":{"text":"VGhpcyBpcyBhIHRleHQgZm9yIHNpZ24gdHJhbnNhY3Rpb24u"},"signatureType":"SIMPLE"}
  4. Encode the JSON structure to Base64.
  5. 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
lqb2lVMFVpTENKemMyNGlPaUl4T1RnNU1EVXlNVGd3TnpJaWZRPT0iLCJtaW5SZWdpc3RyYXRpb25M
ZXZlbCI6IlBMVVMiLCJ0aXRsZSI6IlNpZ24gdHJhbnNhY3Rpb24iLCJleHBpcnkiOjE1MTc1MjYwMD
AwMDAsImRhdGFUb1NpZ25UeXBlIjoiU0lNUExFX1VURjhfVEVYVCIsImRhdGFUb1NpZ24iOnsidGV4
dCI6IlZHaHBjeUJwY3lCaElIUmxlSFFnWm05eUlITnBaMjRnZEhKaGJuTmhZM1JwYjI0dSJ9LCJzaW
duYXR1cmVUeXBlIjoiU0lNUExFIn0=



Possible errors returned by the method are the following:

Return code
Explanation
1001Invalid or missing userInfoType.
1002Invalid or missing userInfo.
1003Invalid restrict.
1004You are not allowed to call this method.
1005User has disabled your service.
1006Invalid confidential.
1007Invalid min registration level.
1008Unknown Relying Party.
1009You are not allowed to request integratorSpecificUserId parameter.
1010JSON request cannot be parsed.
1012User with the specified userInfo does not exist in Freja eID database.
3000Invalid or missing dataToSignType.
3001Invalid or missing dataToSign.
3002Invalid or missing signatureType.
3003Invalid expiry time.
3004Invalid push notification.
3005Invalid attributesToReturn parameter.
3006Custom identifier has to exist when it is requested.
3007Invalid title.
3008

Invalid SSN for advanced signing. Advanced signing cannot be performed by users from your country.

3009

Invalid advanced signing request. Missing SSN and basicUserInfo in its attributesToReturn parameters.


If HTTP 200 is returned from the method, the following return value will be present in the body of the response:

JSON Response Value in body
{ 
   "signRef":"Reference to be submitted in getOneResult method"
}

signRef: string, mandatory. A reference unique to the transaction, that can be used to query the result of a specific signing transaction (see Signature Service#Get one signature result method and Signature Service#Get signature results method below).


Get one signature result method

The method is called using HTTP POST through the URLs below:

System
Method endpoint
Test
https://services.test.frejaeid.com/sign/1.0/getOneResult
Production
https://services.prod.frejaeid.com/sign/1.0/getOneResult


The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:

Parameter name
Value
getOneSignResultRequest
{
   "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 an email address joe.black@verisec.com), follow these steps:

  1. Create the JSON structure {"signRef":"TrLA9zdxCBlNOQNvkdhAM14mJmlL20digC7+QgEVRwmE7SH8Qm0swWIc6whfKm4Y"}
  2. Encode the JSON structure to Base64.
  3. 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=eyJzaWduUmVmIjoiVHJMQTl6ZHhDQmxOT1FOdmtkaEFNMTRtSm1sTD
IwZGlnQzcrUWdFVlJ3bUU3U0g4UW0wc3dXSWM2d2hmS200WSJ9


Possible errors returned by the method are the following:

Return code
Explanation
1004You are not allowed to call this method.
1008Unknown Relying Party.
1100Invalid reference (for example, nonexistent or expired).


If HTTP 200 is returned from the method, the following return value will be present in the body of the response:


JSON Response Value in body
Response body
{
   "signRef":"Signature reference",
   "status":"Signature status",
   "details":"Signed data, see below",
   "requestedAttributes":{
      "basicUserInfo":{
         "name":"User's name",
         "surname":"User's surname"
      },
      "emailAddress":"User's primary email address",
      "allEmailAddresses":[
         {
            "emailAddress":"User's email address"
         },
         {
            "emailAddress":"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",
      "photo":"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 eID",
      "relyingPartyUserId":"Unique user ID reserved for Relying Parties",
      "integratorSpecificUserId":"Unique user ID reserved for Integrators"
   }
}

signRef: string, mandatory . The signature reference of the signing request.

status: string, mandatory. One of:

  • STARTED (the transaction has been started but not yet delivered to Freja eID application associated with the end user),
  • DELIVERED_TO_MOBILE (the Freja eID app has downloaded the transaction),
  • CANCELED (the end user declined the signature request), 
  • RP_CANCELED (the sign request was sent to the user but canceled by the Relying Party before the user could respond),
  • EXPIRED (the signature request was not approved by the end user within the signature validity limit as requested when the signature was initialised),
  • APPROVED (the signature was successful).

details: A signed object (see below), optional. Provides details and evidence of the signing if status was equal to APPROVED.

requestedAttributes: JSON object  (see below), optional. Provides additional attributes about a user if required in attributesToReturn parameter in related initSignRequest and the status was equal to APPROVED. 

details

The content of this response element will depend on the signatureType requested when the signature was initiated. For a Simple signature type, it will contain a 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"
}

x5t: mandatory, Base64URL encoding of the certificate's SHA-1 digest.
alg: mandatory, the value shall be RS256 which corresponds to 'RSA PKCS#1 signature with SHA-256'.


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, see below.
     } 
}

signRef: See signRef above.

status: See status above.

userInfoType: See userInfoType as described in Initiate sign method.

userInfo: See userInfo as described in Initiate sign method.

minRegistrationLevel: See registrationLevel as described in Initiate sign method.

timestamp: Long, mandatory. Describes the time when the confirmation by the end user was validated on Freja eID server side. Expressed in milliseconds, since January 1, 1970, 00:00 UTC.

signatureType: String, mandatory. The type of signature that is requested. Currently SIMPLE and EXTENDED are supported.

signatureData: See fields below, mandatory.

userSignature: The produced signature, string, mandatory. Contains the end user's signature in the requested format. The end user's signature will implicitly contain the dataToSign as requested in Initiate sign method as within its payload.

certificateStatus: Base64 string, mandatory. Contains the OCSP response regarding the state of the end-user certificate at the time of validating the signature.

advancedSignature: Base64 string, mandatory for advanced signature types. Contains signed data in requested format.

requestedAttributes: JSON object  (see below), optional. Provides additional attributes about a user if required in attributesToReturn parameter in related initSignRequest and the status was equal to APPROVED.

requestedAttributes

{
   "basicUserInfo":{
      "name":"User's name",
      "surname":"User's surname"
   },
   "emailAddress":"User's primary email address",
   "allEmailAddresses":[
      {
         "emailAddress":"User's email address"
      },
      {
         "emailAddress":"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", 
   "photo":"User's photo, 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 eID",
   "relyingPartyUserId":"Unique user ID reserved for Relying Parties",
   "integratorSpecificUserId":"Unique user ID reserved for Integrators"
}

basicUserInfo: JSON object which contains user's name and surname.

emailAddress: String, representing the user's primary email address.

allEmailAddresses: List of JSON objects which contains all end user's registered email addresses. The list will contain the primary email address and up to 2 other email addresses user might have connected to their account. Email addresses will be randomly sorted. If the user does not have any additional email addresses registered, the list will contain only the primary email address.

allPhoneNumbers:  List of JSON objects which contains all end user's registered phone numbers. This list will contain up to 3 phone numbers the user might have connected to their account. If no phone number is registered for a given user, an empty list will be returned.

dateOfBirth: String containing date of birth in format: YYYY-MM-DD.

age: Integer, calculated based on the date of birth.

photo: String, Base64 encoded JPEG bytes.

addresses: List of JSON objects which contains one or more end user's addresses. If no address is registered for a given user, an empty list will be returned. Each object will contain the following information:

country: String. Contains the ISO-3166 two-alphanumeric country code of the country where the user's address resides.
city: String. City in which the user's address resides.
postCode: String. Postal code of the city or city area in which the user's address resides. 
address 1, 2, 3: String. Up to three lines of address information containing, for example, street and number, house name or apartment number, and ‘care of’ or ‘attention’ designations, area or village clarifications. The number of lines in the response depends on the address information. At least one will be returned. 
validFrom: String. Date from which the address is valid, according to the source of information. Date is returned in format: YYYY-MM-DD (ISO-8601)
type: String. Type of address. Currently, can be RESIDENTIAL or POSTAL. 
sourceType: String. Type of source from which the information about the address has been obtained. Currently, only GOVERNMENT_REGISTRY can be returned. Namely, in the current version of Freja eID, the information about the end user's address is obtained from Statens personadressregister (SPAR) for Sweden and Det Sentrale Folkeregister (DSF) for Norway. 

ssn: JSON object which contains social security number and country.

documentList of JSON objects with information about the user's document used in registration. Each object will contain the following information:

  • type: String. The type of document used during registration abbreviated and returned as: "PASS" (passport), "DRILIC" (driving licence), "NATID" (national ID card), "IDSIS" (SIS-issued ID document), "TAXID" (document issued by the Swedish Tax Authority), and "OTHERID" (any other type of document).
  • countryString. Contains the ISO-3166 two-alphanumeric country code of the issuing country.
  • serialNumber: String representing the document's serial number.
  • expirationDate: String containing the document's expiration date in the format: YYYY-MM-DD.

documentPhoto: String, Base64 encoded JPEG bytes.

registrationLevel: the user's registration level in Freja eID, can be BASIC, EXTENDED or PLUS

relyingPartyUserId: String, mandatory. Represents a unique, user-specific value that allows the Relying Party to identify the same user across multiple sessions.

integratorSpecificUserId: String, represents a unique, user-specific value that allows Integrators to identify the same user across multiple sessions regardless of the Integrated Relying Party service that the user is using. For more info, see the section about Integrator Relying Party Management. 

customIdentifier: String, a unique, Relying Party-specific, user identifier, set by the Relying Party itself through the Custom Identifier Management.

advancedSignature

The XML_MINAMEDDELANDEN format generates XML signatures like this:

	<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#”>
	<SignedInfo>
		<CanonicalizationMethod> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/
			<SignatureMethod> Algorithm="https://www.w3.org/2001/04/xmldsig-more#rsa-sha256%22"/
				<Reference> URI="#object">
					<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256”>
						<DigestValue>JmvMxPgYwsd3oHadDF3v8cJQdN5qkBR7cCF3ap/ZAKI=</DigestValue>
					</Reference>
				</SignedInfo>
				<SignatureValue>ZZIkJR1I7imz2AG0+hsWFtmI/4JMxwAvozqkcKbEs3kAIR+KD5kDqnqsit1nULxk9sFfoFv6i4+l >
                9eAfegBCh4Jlcex+ZR2pjrPqNx0SPrtg+MtvLV9ruICbj0u/RO2nOhzJtcTBoTtHRfJxV/Ji0Lyw
                KmtAK6h/zEcIJujwSwqYZ37hX5KqmWxgtcgc00Loiaq8IxrJuyBQhUoWvH7jgqlwWHy5To+aMOlk
                XdGE7fa4HRvNxJolLMPevC54r/NR5X1x7LmMqiDeZYn4KB8Q+twM5jGS6C/5kGZBIzB5pf1ovkZ6
                0F2TuCklAegyfV/ksBIL9l6DN5ZJVJF0PFVmxA==</SignatureValue>
				<KeyInfo Id="frejaKeyInfo">
					<X509Data>
						<X509Certificate>base 64 end-entity certificate</X509Certificate>
						<X509Certificate>base 64 CA certificate</X509Certificate>
					</X509Data>
				</KeyInfo>
				<Object Id="object">
					<frejaSignedData id="frejaSignedData">
						<userData>
							<usrVisibleData>base64 encoded text that was displayed to the user</usrVisibleData>
							
							<userDeviceSignature>json signature produced on the mobile phone</userDeviceSignature>
						</userData>
						<additionalData>
							<signingTime>1666355503547</signingTime>
						</additionalData>
					</frejaSignedData>
				</Object>
			</Signature>


Get signature results method

The method is called using HTTP POST through the URLs below:

System
Method endpoint
Test
https://services.test.frejaeid.com/sign/1.0/getResults
Production
https://services.prod.frejaeid.com/sign/1.0/getResults


The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:

Parameter name
Value
getSignResultsRequest
{
   "includePrevious":"Include previously returned results"
}

includePrevious: string, mandatory. Must be equal to ALL. Indicates that the complete list of signature requests is successfully initiated by the Relying Party. 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 multiple signature results, follow these steps:

  1. Create the JSON structure {"includePrevious":"ALL"}
  2. Encode the JSON structure to Base64.
  3. 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 returned by the method are the following:

Return code
Explanation
1004You are not allowed to call this method.
1008Unknown Relying Party.
1200Invalid or missing includePrevious parameter.


If HTTP 200 is returned from the method, the following return value will be present in the body of the response:


JSON Response Value in body
Response body
{
   "signatureResults":[
      {
         "signRef":"Signature reference",
         "status":"Signature status",
         "details":"Signed data, see below",
         "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",
             "photo":"User's photo, 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 eID",
            "relyingPartyUserId":"Unique user ID reserved for Relying Parties",
            "integratorSpecificUserId":"Unique user ID reserved for Integrators"   
          }
      },
      {
         "signRef":"..."
      }
   ]
}

signatureResults: an array of JSON objects, mandatory. An array of signature result objects (if the signatureRef parameter was passed, the array will always be of length 1).

signRef: string, mandatory. The signature reference of the signing request.

status: string, mandatory. One of:

  • STARTED (the transaction has been started but not yet delivered to Freja eID application associated with the end user),
  • DELIVERED_TO_MOBILE (the Freja eID app has downloaded the transaction),
  • OPENED (the user has opened and seen the signature request but neither canceled nor approved yet),
  • CANCELED (the end user declined the signature request),
  • RP_CANCELED (the sign request was sent to the user but canceled by the Relying Party before the user could respond),
  • EXPIRED (the signature request was not approved by the end user within the signature validity limit as requested when the signature was initialised),
  • APPROVED (the signature was successful).

details: A signed object, optional. Provides details and evidence of the signature if status was equal to APPROVED (see details as described in the Signature Service#Get one signature result method above).

requestedAttributes: JSON object (see details as described in the Get one signature result method above), optional.


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:

System
Method endpoints
Test
https://services.test.frejaeid.com/sign/1.0/cancel
Production
https://services.prod.frejaeid.com/sign/1.0/cancel


The parameter of the method is a Base64 UTF8-encoded JSON payload according to the following:

Parameter name
Value
cancelSignRequest
{
   "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.

Example request:

If you wish to cancel a sign request, follow these steps:

  1. Create the JSON structure {"signRef":"TrLA9zdxCBlNOQNvkdhAM14mJmlL20digC7+QgEVRwmE7SH8Qm0swWIc6whfKm4Y"}
  2. Encode the JSON structure to Base64.
  3. 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 (line broken for clarity only):

cancelSignRequest=eyJzaWduUmVmIjoiVHJMQTl6ZHhDQmxOT1FOdmtkaEFNMTRtSm1sTDIwZGln
QzcrUWdFVlJ3bUU3U0g4UW0wc3dXSWM2d2hmS200WSJ9


Possible errors returned by the method are the following:

Return code
Explanation
1004You are not allowed to call this method.
1008Unknown Relying Party.
1100Invalid reference (for example, nonexistent or expired).

If HTTP 200 is returned from the method, the request was successfully fulfilled.