Skip to content

Latest commit

 

History

History
960 lines (756 loc) · 41.5 KB

File metadata and controls

960 lines (756 loc) · 41.5 KB

freja

The Freja module will allow you to interact with the Freja eID API. The module is designed to be used in a Node.js environment and will allow you to create authentication and signing requests, as well as manage user information.

Version: 1.1.0

freja.FrejaAPI

Kind: static class of freja
Properties

Name Type Description
UserAttributes Array.<FrejaUserAttributes> The user attributes to return.
RegistrationLevel FrejaRegistrationLevel The minimum requested level.
ConfirmationMethod FrejaConfirmationMethod
APIEnvironment APIEnvironment The API mode.
RelyingPartyId string The relying party ID (used by integrators only).

new FrejaAPI(apiEnvironment, authPfx, authPwd, [trustedJWTCertificates], [trustedCACertificates])

The main Freja API class.

Throws:

  • Error If the mode is invalid or if the password is missing.
  • Error If the PFX or CA certificate file does not exist. * @example
Param Type Description
apiEnvironment FrejaAPIEnvironment The API mode.
authPfx string The path to the PFX file.
authPwd string The password for the PFX file.
[trustedJWTCertificates] Object The JWT token files ({'x5t': 'file'}).
[trustedCACertificates] undefined | string | Array.<string> The path to the CA certificate file(s).

frejaAPI.UserInfoFactory(userData) ⇒ IUserInfo

Create a user info object.

Kind: instance method of FrejaAPI
Returns: IUserInfo - The user info object.
Throws:

  • Error If the data is invalid or missing.

Access: public

Param Type Description
userData Object | String The user data to create the object from (email, phone, ssn, orgid etc.)

frejaAPI.AuthRequest([userInfo], [orgId]) ⇒ Promise.<(IFailureResult|IInitializationSuccess)>

Initialize an authentication request (shorthand method).

Kind: instance method of FrejaAPI
Access: public

Param Type Default Description
[userInfo] undefined | string | object | IUserInfo The user to create the authentication request for.
[orgId] boolean false If the request is for an organisation id

frejaAPI.SignRequest(userInfo, title, text, [orgId]) ⇒ Promise.<(IFailureResult|IInitializationSuccess)>

Initialize an signing request (shorthand method).

Kind: instance method of FrejaAPI
Access: public

Param Type Default Description
userInfo string | object | IUserInfo The user to create the signing request for.
title string The title of the request (used for notification).
text string The text to sign.
[orgId] boolean false If the request is for an organisation id

frejaAPI.SignBufferRequest(userInfo, title, text, data, [orgId]) ⇒ Promise.<(IFailureResult|IInitializationSuccess)>

Initialize an signing request (shorthand method).

Kind: instance method of FrejaAPI
Access: public

Param Type Default Description
userInfo string | object | IUserInfo The user to create the signing request for.
title string The title of the request (used for notification).
text string The text to sign.
data Buffer The binary data to sign.
[orgId] boolean false If the request is for an organisation id

frejaAPI.AddOrgIdRequest(userInfo, title, identifier, value, [displayTypes])

Initialize an organisation id request (shorthand method).

Kind: instance method of FrejaAPI
Access: public

Param Type Default Description
userInfo string | object | IUserInfo The user to create the organisation id for
title string The title of the request (used for notification).
identifier string The identifier name
value string The identifier value
[displayTypes] Array.<FrejaIdentifierDisplayType> [FrejaIdentifierDisplayType.QR_CODE, FrejaIdentifierDisplayType.TEXT] The display types

frejaAPI.GetOrgIdUserList() ⇒ Promise.<(IFailureResult|IFrejaOrgIdUserList)>

Gets a full list of issued organisation ids

Kind: instance method of FrejaAPI
Access: public

frejaAPI.UpdateOrgId(identifier, additionalAttributes) ⇒ Promise.<(IFailureResult|IUpdateSuccessMessage)>

Updates a issued organisation id with additional attributes

Kind: instance method of FrejaAPI
Access: public

Param Type Description
identifier string The custom identifier to delete
additionalAttributes Array.<IFrejaUserOrganisationAttributes> Additional attributes to update

frejaAPI.RevokeOrgId(identifier) ⇒ Promise.<(IFailureResult|ISuccessResultMessage)>

Deletes a issued organisation id

Kind: instance method of FrejaAPI
Access: public

Param Type Description
identifier string The custom identifier to delete

frejaAPI.InitRequest(requestType, userInfo, ...additionalParams) ⇒ Promise.<(IFailureResult|IInitializationSuccess)>

Initialize an authentication or signature request.

Kind: instance method of FrejaAPI
Access: public

Param Type Description
requestType FrejaRequestType The type of request.
userInfo string | undefined | object The user information used to initialize, leave empty for inferred.
...additionalParams any Additional parameters for the request.

frejaAPI.CancelRequest(token) ⇒ Promise.<(IFailureResult|ICompletedRequestMessage)>

Retrieve the status of a request.

Kind: instance method of FrejaAPI
Access: public

Param Type Description
token string The token of the request.

frejaAPI.CheckCustodianship(swedishSSN) ⇒ Promise.<(IFailureResult|ISuccessResultMessage)>

Retrieve the status of a request.

Kind: instance method of FrejaAPI
Access: public

Param Type Description
swedishSSN string The social security number to check

frejaAPI.NewCustomIdentifier(customIdentifier, userInfo) ⇒ Promise.<(IFailureResult|ISuccessResultMessage)>

Retrieve the status of a request.

Kind: instance method of FrejaAPI
Access: public

Param Type Description
customIdentifier string The custom identifier to append
userInfo IUserInfo The user to which to append the custom identifier

frejaAPI.DeleteCustomIdentifier(customIdentifier) ⇒ Promise.<(IFailureResult|ISuccessResultMessage)>

Retrieve the status of a request.

Kind: instance method of FrejaAPI
Access: public

Param Type Description
customIdentifier string The custom identifier to append

frejaAPI.InquireRequest(token) ⇒ Promise.<(IFailureResult|IRequestStatusMessage|ICompletedRequestMessage)>

Retrieve the status of a request.

Kind: instance method of FrejaAPI
Access: public

Param Type Description
token string The token of the request.

FrejaAPI.GetError(errorCode) ⇒ string

Translate a code into a message

Kind: static method of FrejaAPI
Returns: string - The error message
Access: public

Param Type Description
errorCode number The error code

freja~FrejaAPIEnvironment : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
PRODUCTION string "PRODUCTION"
TEST string "TEST"

freja~FrejaRegistrationState : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
EXTENDED string "EXTENDED"
VETTING_CONFIRMED string "VETTING_CONFIRMED"
PLUS string "PLUS"

freja~FrejaIdentifierDisplayType : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
QR_CODE string "QR_CODE"
TEXT string "TEXT"

freja~FrejaRequestType : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
AUTH string "A"
SIGN string "S"
ORGID_AUTH string "O"
ORGID_SIGN string "I"
ORGID_MGMT string "M"

freja~FrejaSignatureType : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
SIMPLE string "SIMPLE"
EXTENDED string "EXTENDED"
XML_MINAMEDDELANDEN string "XML_MINAMEDDELANDEN"

freja~FrejaRegistrationLevel : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
BASIC string "BASIC"
EXTENDED string "EXTENDED"
PLUS string "PLUS"

freja~FrejaConfirmationMethod : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
DEFAULT string "DEFAULT"
DEFAULT_AND_FACE string "DEFAULT_AND_FACE"

freja~FrejaUserAttributes : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
BASIC_USER_INFO string First, last and full name
EMAIL_ADDRESS string Only primary email address
ALL_EMAIL_ADDRESSES string All the users email addresses
ALL_PHONE_NUMBERS string All the users phone numbers
DATE_OF_BIRTH string The date of birth
AGE string The user's age
PHOTO string User enrolled photo
ADDRESSES string All the user's addresses (Sweden and Norway only)
SSN string Social security number
DOCUMENT string Document information
REGISTRATION_LEVEL string The users registaion level
RELYING_PARTY_USER_ID string The relying party user ID
INTEGRATOR_SPECIFIC_USER_ID string The integrator specific user ID
UNIQUE_PERSONAL_IDENTIFIER string A freja globally unique identifier
LOA_LEVEL string The level of assurance for the identity

freja~FrejaUserAttributeCollections : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
ALL_EXTENDED Array.<UserAttributes> All user attributes (Requires EXTENDED or PLUS registration level)
ALL_BASIC Array.<UserAttributes> All attributes when running in basic mode (All attributes when in BASIC registration level)
COMMON_AUTH Array.<UserAttributes> Attributes commonly used for authentication (Requires EXTENDED or PLUS registration level)
COMMON_SIGN Array.<UserAttributes> Attributes commonly used for signing (Requires EXTENDED or PLUS registration level)

freja~FrejaLOALevel : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
LOA1 string "LOA1"
LOA2 string "LOA2"
LOA3 string "LOA1"
LOA3_NR string "LOA3_NR"

freja~FrejaRequestStatus : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
STARTED string "STARTED"
DELIVERED string "DELIVERED_TO_MOBILE"
CANCELLED string "CANCELLED"
REJECTED string "REJECTED"
EXPIRED string "EXPIRED"
RP_CANCELLED string "RP_CANCELLED"
RP_REJECTED string "RP_REJECTED"
APPROVED string "APPROVED"

freja~FrejaDocumentTypes : enum

Kind: inner enum of freja
Category: Enums
Read only: true
Properties

Name Type Description
PASSPORT string "PASS"
DRIVER_LICENSE string "DRILIC"
NATIONAL_ID string "NATID"
SIS_ID string "IDSIS"
SWEDISH_TAX_ID string "TAXID"
OTHER string "OTHER"

freja~FrejaUserAddressType : enum

Kind: inner enum of freja
Category: Freja
Read only: true
Properties

Name Type Description
POSTAL string "POSTAL"
RESIDENTIAL string "RESIDENTIAL"

freja~FrejaUserAddressSource : enum

Kind: inner enum of freja
Category: Freja
Read only: true
Properties

Name Type Description
GOVERNMENT_REGISTRY string "GOVERNMENT_REGISTRY"

freja~IFrejaOrgIdUserInfo : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
identifier string Title of the Organisation ID to be displayed to the end user
identifierName string Display name of specific organisation identifier
title string Value of specific organisation identifier
[ssn] string User SSN in international format if exist
country string User country
registrationState FrejaRegistrationState The extended error message

freja~IFrejaUserOrganisationName : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
EN string The name of the organisation in English
SV string The name of the organisation in Swedish

freja~IFrejaUserAddress : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
type FrejaUserAddressType The address type
validFrom string The date the address is valid from
validTo string The date the address is valid to
address Array.<string> The first line of the address
postcode string The postal code
city string The city
country string The country
source FrejaUserAddressSource The source of the address

freja~IFrejaUserDocument : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
type FrejaDocumentTypes The document type
country string The document country
number string The document number
expiration string The document expiration date

freja~IFrejaUserOrganisation : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
userId string The organisation user ID
issuerId string The organisation issuer ID
issuerCode string The organisation issuer code
issuerName IFrejaUserOrganisationName The organisation issuer name
[attributes] Array.<IFrejaUserOrganisationAttributes> The organisation attributes

freja~IFrejaUserAddOrganisation : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
title string Title of the Organisation ID to be displayed to the end user
identifierName string Display name of specific organisation identifier
identifier string Value of specific organisation identifier
identifierDisplayTypes Array.<FrejaIdentifierDisplayType> Displays for the identifier
[attributes] Array.<IFrejaUserOrganisationAttributes> The organisation attributes

freja~IFrejaSignNotification : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
title string The title of the notification
message string The message of the notification

freja~IFrejaUserOrganisationAttributes : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
key string The attribute key
value string The attribute value
displayText string The attribute display text

freja~IFrejaUserDetails : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
[firstname] string The user's first name
[lastname] string The user's last name
[fullname] string The user's full name
[age] number The user's age
[dateOfBirth] string The user's date of birth
[ssn] string The user's social security number
[ssc] string The user's social security country
[photo] string The user's photo

freja~IFrejaServiceData : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
freja.userInfo IUserInfo The user information object
[freja.relyingPartyUserId] string The relying party user ID
[freja.registrationLevel] FrejaRegistrationLevel The registration level
[freja.customIdentifier] string The custom identifier
[freja.loaLevel] FrejaLOALevel The level of assurance
[freja.uniquePersonalIdentifier] string The unique personal identifier

freja~IFrejaUserContact : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
[emailAddress] string The user's primary email address
[phoneNumber] string The user's primary (first) phone number
[postalAddress] IFrejaUserAddress The user's current postal address
[residentialAddress] IFrejaUserAddress The user's current residential address
[allEmailAddresses] Array.<string> The user's other email addresses
[allPhoneNumbers] Array.<string> The user's other phone numbers
[allAddresses] Array.<IFrejaUserAddress> The user's addresses

freja~IFrejaResponse : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
info IFrejaUserInfo The user information object
freja IFrejaServiceData The Freja object
[document] IFrejaUserDocument The document object
[organisation] IFrejaUserOrganisation The organisation object
contact IFrejaUserContact The contacts object
[signature] IFrejaSignatureData The signature data

freja~IFrejaSignatureData : Object

Kind: inner typedef of freja
Category: Freja
Properties

Name Type Description
type FrejaSignatureType The signature type
timestamp Date The date of the signature
payload String The signed data
transactionId String The id of the signing transaction from Freja
ocspResponse Buffer The OCSP response at time of signing
signature String The signature
kid String The signature key ID
alg String The signature algorithm
[advanced] Object The advanced signature

freja~IResultMessage : Object

Kind: inner typedef of freja
Category: Responses
Properties

Name Type
isOk boolean

freja~IFrejaOrgIdUserList : Object

Kind: inner typedef of freja
Extends: IResultMessage
Category: Responses
Properties

Name Type Description
isOk boolean
users Array.<IFrejaOrgIdUserInfo> The organisation information

freja~ISuccessResultMessage : Object

Kind: inner typedef of freja
Extends: IResultMessage
Category: Responses
Properties

Name Type
isOk boolean
data any

freja~IUpdateSuccessMessage : Object

Kind: inner typedef of freja
Extends: IResultMessage
Category: Responses
Properties

Name Type
isOk boolean
added number
updated number
deleted number

freja~IFailureResult : Object

Kind: inner typedef of freja
Extends: IResultMessage
Category: Responses
Properties

Name Type Description
isOk boolean Must be false
code number The error code
message string The error message
[extendedMessage] string The extended error message
[trace] string The error trace

freja~IInitializationSuccess : Object

Kind: inner typedef of freja
Extends: IResultMessage
Category: Responses
Properties

Name Type Description
isOk boolean Must be true
token string The transaction token
qrCodeUrl function The URL to the QR code
autostartUrl function The URL to the autostart

freja~IRequestStatusMessage : Object

Kind: inner typedef of freja
Extends: IResultMessage
Category: Responses
Properties

Name Type Description
isOk boolean Must be true
status FrejaRequestStatus The transaction status
isFinal boolean If the transaction is completed or should be checked again

freja~ICompletedRequestMessage : Object

Kind: inner typedef of freja
Extends: IRequestStatusMessage
Category: Responses
Properties

Name Type Description
isOk boolean Must be true
status FrejaRequestStatus The transaction status
data IFrejaResponse The results of the request
isFinal boolean Always true

freja~UserInfoType : enum

Kind: inner enum of freja
Category: UserInfo
Read only: true
Properties

Name Type Description
INFERRED string "INFERRED"
EMAIL string "EMAIL"
PHONE string "PHONE"
SSN string "SSN"
ORGID string "ORG_ID"

freja~ISocialSecurityNumber : Object

Kind: inner typedef of freja
Category: UserInfo
Properties

Name Type Description
country string The country code
ssn string The social security number

freja~IUserInfo : Object

Kind: inner typedef of freja
Category: UserInfo
Properties

Name Type Description
userInfoType FrejaUserInfoType The type of user information
userInfo string | ISocialSecurityNumber The user information

freja~IEmailUserInfo : Object

Kind: inner typedef of freja
Extends: IUserInfo
Category: UserInfo
Properties

Name Type Description
userInfoType FrejaUserInfoType Must be "EMAIL"
userInfo string The email address

freja~ISSNUserInfo : Object

Kind: inner typedef of freja
Extends: IUserInfo
Category: UserInfo
Properties

Name Type Description
userInfoType FrejaUserInfoType Must be "EMAIL"
userInfo ISocialSecurityNumber The social security number

freja~IInferredUserInfo : Object

Kind: inner typedef of freja
Extends: IUserInfo
Category: UserInfo
Properties

Name Type Description
userInfoType FrejaUserInfoType Must be "INFERRRED"
userInfo string Must be "N/A"

freja~IPhoneUserInfo : Object

Kind: inner typedef of freja
Extends: IUserInfo
Category: UserInfo
Properties

Name Type Description
userInfoType FrejaUserInfoType Must be "PHONE"
userInfo string The email address

freja~IOrgIdUserInfo : Object

Kind: inner typedef of freja
Extends: IUserInfo
Category: UserInfo
Properties

Name Type Description
userInfoType FrejaUserInfoType Must be "ORGID"
userInfo string The email address