/
account_decrypt_shared_key ()

account_decrypt_shared_key ()

Function prototype

account_decrypt_shared_key (shared_key, [language = “EN”])

API Version

2.6.12 and higher

Supported interfaces

SOAP, REST

Description

Decrypts a shared key and returns information about the channel by which it was sent

Input parameters:

  • shared_key: an encrypted string that contains information about the communication channel used to create the account (email, phone...). This shared_key can be obtained from:

    • account_create(): returns the shared key after creating a new account that needs to be activated, and also after trying to create an account that already exists but needs to be activated.

    • session_init(): returns the shared key if the account exists but needs to be activated

    • An invitation sent by a other user in the system. In this scenario the shared key is sent by email/sms embedded in an URL that redirects to LC2 interface (to the "activate account" page)

  • language: language code ('EN', 'ES', ...). If no language is provided, 'EN' will be used as default. This language will be used for the error description (if any)

Output parameters:

  • result: an data structure (XML or JSON) with information contained in the shared key. Depending on the type of shared key, the information will be different. Find below examples of the different shared keys and responses

  • ErrorMsg: If any error occurs, then this value contains a description of the error translated to the current language

  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

Request example

account_decrypt_shared_key ( “78csahi7chqw7r”, "ES");

Response

The response format is XML when the function has been invoked via the SOAP API, and JSON when it has been invoked via the REST API

Return Error codes

ERROR CODE

 

ERROR CODE

 

SHAREDKEY.INVALID

The shared key indicated is not valid

ACCOUNT.ACTIVATION_PENDING

Returned when the shared key is an ASSOCIATE INVITATION and the account is pending to be activated (using account_activate() )

ACCOUNT.ALREADY_ACTIVE

Returned when the shared key is an ACCOUNT VERIFICATION and the account is already active

PROGRAM.NOT_FOUND

Returned when the shared key is a PROGRAM INVITATION but the information contained in the shared key does not correspond to an existing PROGRAM

Types of Shared Keys

Type

 

Description

Example of XML returned

Type

 

Description

Example of XML returned

1

ASSOCIATE_INVITATION

Generated when a CASE sends an invitation to an ASSOCIATE using the function case_insert_associate()



<sharedkey> <type>3</type> <lang>es<lang> <channel>mymail@company.com</channel> <channel_type>EMAIL</channel_type> </sharedkey>



2

PROGRAM_INVITATION

An invitation to a PROGRAM. This type of invitation allows a new User to create a SUBSCRIPTION to a PROGRAM.

Generated by program_get_invitation() 



<sharedkey> <lang>es</lang> <type>2</type> <name>Detección de los genes BRCA</name> <description>BRCA de detección desarrollado para PRECEDI</description> </sharedkey>



3

ACCOUNT_VERIFICATION

Generated when a new USER is registered in Linkcare WS and need to be activated. This shared key can be generated by



<sharedkey> <type>3</type> <lang>es<lang> <channel>mymail@company.com</channel> <channel_type>EMAIL</channel_type> </sharedkey>





Related content