**Device Registration: Register new Device**
=
# Introduction
> The purpose of this document is to out line a success case for onboarding a new device for an existing TCS profile.
# Table Of Content
> [TOC]
Step 0: Determine User Device status
=
> Assume the user has logged into TCS
>
**R0:** Query Auth Service! (using username & ~~password~~ & emCertID)
**Q1:** Is the device registered on Auth Service?
**A0:** No device found on Auth Service & TSG.
**Q2** Is Registered on TSG? (*[subject_info](https://www.entersekt.com/docs/transakt/discover/overview/features/subject-info.html#basic-usage)*)
> NOTE: ***SubjectID*** is the *emCertID*
**A1:** No device found on Auth Service & TSG.
*ResponseMessage:* *'**Device not found on our records**'*)
**P0.1:** Notify User of *'A0' & 'A1'*.
**P0.2:** Update registration status to **'Not_Found'**
Step 1: 'Sign up' User on Entersekt
=
**R1:** Add new device!(registered email OR registered cell number)
**P1.1:** Request Sign up Code.(sign_up endpoint)
**P1.2:** Send sign up code to user device(**sms OTP OR QR Code OR email OTP**)
**P1.3:** Update registration status to **'Sign_Up_In_Progress'**
Step 2: Wait for user to complete sign up
=
Q2: User completes sign_up (enters OTP'Sign_up_Code' OR scans QR code)
- App SDK sends user's credentials(See '[*credential*](https://www.entersekt.com/docs/transakt/discover/overview/features/sign-up.html#basic-usage)' tag)
**R2.1:** TSG Pushes to sign_up action to our server(Auth Service?? or Middleware??)
**R2.2:** Upon Success case of R3.1:
- Validate '*external_reference*' (Check for empty external reference)
> To initiate the sign-up process, the institution requests a sign-up code from the Secure Gateway with specified complexity. This request includes an **external_reference** parameter that the institution provides to link the sign-up code to a specific user or session. The **external_reference** is often set to a distinguishable userID of the user to whom the code was issued.
- Keep user ***'subject_id'*** for registration.
**P2.1:** Update registration status to **'Sign_Up_Complete'**
---
Step 3: 'Register' Device on on Entersekt
=
**Q3:** Has user has successfully signed up in *'Step 2'*
**A3:** Yes
**P3.1:** Register user on TSG (using ***'subject_id'*** retrieved from *'Step 2'*)
**P3.2:** On Success of P4.1 We can notify the user.
> At this point the device has been registered with the TSG.
> The device has an associated emCertID on the TSG.
> We now have a registered user.
**P3.3:** Update registration status to **'Register_Complete'**
---
Step 4: Add user device to Auth Service
=
**R4:** Query Auth Service! (using username & ~~password~~ & emCertID)
**Q4.1:** Is the device registered on Auth Service?
**A4.1:** No
**Q4.2:** Is Registered on TSG?
**A4.2:** Yes
**P4.1:** Notify User of '***A4.2***'.(Associate this device with Auth Service)
**P4.2:** Update registration status to **'Device_Activate'**
> ***Device Activation is complete.***
Glossary
=
R: Request by the user via phone to auth service.
Q: Query to auth service/auth service database.
A: Answer from query.
P: Background Procedure