> For the complete documentation index, see [llms.txt](https://t1t.gitbook.io/t1c-js-guide-v3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://t1t.gitbook.io/t1c-js-guide-v3/v3.1.4/migration-guide-v2-greater-than-v3.md).

# Quick-Migration Guide

## Introduction

Migration from the v2 to the v3 of the Trust1Connector can be done in 2 ways;

1. Integration of the API
2. Integration via the deprecated Javascript SDK

Both are viable integrations but we strongly suggest to integrate via the API since the JS SDK does not include all features, only the ones which were available in the v2. When integrating via the API you have more control over the Javascript packages used.

The Javascript SDK has the following packages as dependencies;

```
"@types/lodash": "^4.14.150",
"Base64": "^1.1.0",
"axios": "^0.19.2",
"jsencrypt": "^3.0.0-rc.1",
"lodash": "^4.17.15",
"logger-bootstrap": "^2.0.0-alpha2",
"semver": "^7.3.2",
"sha256": "^0.2.0",
"store2": "^2.11.1",
"uuid": "^8.0.0"
```

## Update a v2 application to v3

For updating your web application first of all you need to use the new Javascript SDK. After this there are some differences in using the SDK from the v2.

### Configuration

The configuration from the v2 has changed, we simplified this.

The v2 had the following configuration options;

```
export class GCLConfigOptions {
    constructor(public gclUrl?: string,
                public gwOrProxyUrl?: string,
                public apiKey?: string,
                public gwJwt?: string,
                public tokenExchangeContextPath?: string,
                public ocvContextPath?: string,
                public dsContextPath?: string,
                public dsFileContextPath?: string,
                public pkcs11Config?: Pkcs11ModuleConfig,
                public agentPort?: number,
                public implicitDownload?: boolean,
                public forceHardwarePinpad?: boolean,
                public sessionTimeout?: number,
                public consentDuration?: number,
                public consentTimeout?: number,
                public syncManaged?: boolean,
                public osPinDialog?: boolean,
                public containerDownloadTimeout?: number,
                public localTestMode?: boolean,
                public lang?: string,
                public providedContainers?: T1CContainerid[]) {
    }
}
```

With the v3 this is significantly simplified to the following;

```
export class T1CConfigOptions {
  constructor(
    public t1cApiUrl?: string,
    public t1cApiPort?: string,
    public t1cRpcPort?: string,
    public t1cProxyUrl?: string,
    public t1cProxyPort?: string,
    public dsUrl?: string,
    public jwt?: string,
    public osPinDialog?: boolean
  ) {}
}
```

{% hint style="warning" %}
Some of the config options of the v3 are still in review and can be removed up until the final release of the v3, in the table below you will find more information
{% endhint %}

| V2 config option         | V3 config option | Description                                                                                                                                    |
| ------------------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| gclUrl                   | t1cApiUrl        | in the V2 this was <https://localhost:10443> while in the V3 this will be <https://t1c.t1t.io> (for T1T)                                       |
|                          | t1cApiPort       | is the port where the webserver is listening on, in the v2 this is 10443 but in the v3 by default(T1T) this is 51983                           |
|                          | t1cRpcPort       | this is the port where the sandbox is running (card communication)                                                                             |
|                          | t1cProxyPort     | This value represents the port where the Proxy webserver is listening on. By default this is 51983                                             |
| gwOrProxyUrl             | t1cProxyUrl      | Similar to the api url this is the URL where the proxy used in shared environment is running on. This is by default the same as the API url    |
| apiKey                   | /                |                                                                                                                                                |
| gwJwt                    | jwt              | JWT token used for authentication of the web application towards the Trust1Connector. This must be retrieved from the web applications backend |
| tokenExchangeContextPath | /                |                                                                                                                                                |
| ocvContextPath           | /                |                                                                                                                                                |
| dsContextPath            | dsUrl            | in v2 this was the context path for the DS based on the gwOrProxyUrl, in the v3 this is the complete DS root url                               |
| dsFileContextPath        | /                |                                                                                                                                                |
| pkcs11Config             | /                |                                                                                                                                                |
| agentPort                | /                |                                                                                                                                                |
| implicitDownload         | /                |                                                                                                                                                |
| forceHardwarePinpad      | /                |                                                                                                                                                |
| sessionTimeout           | /                |                                                                                                                                                |
| consentDuration          | /                |                                                                                                                                                |
| syncManaged              | /                |                                                                                                                                                |
| osPinDialog              | osPinDialog      | boolean which depicts the default os pin dialog value (This is up for review to be removed from v3 config)                                     |
| containerDownloadTimeout | /                |                                                                                                                                                |
| localTestMode            | /                |                                                                                                                                                |
| lang                     | /                |                                                                                                                                                |
| providedContainers       | /                |                                                                                                                                                |

### Initialisation

After you've created your configuration object you can do the initialisation of the Trust1Connector SDK. This has largely remained the same except for the error codes.

V2 example:

```javascript
config = new GCLLib.GCLConfig(configoptions);
    GCLLib.GCLClient.initialize(config).then(res => {
        client = res;
        core = client.core();
        console.log("GCLClient: ", res)
    }, err => {
        console.log("GCL error:", err)
        if (err.code == 301 || err.code == 302) {
            err.client.download("v2.1.0").then(res => {
                let download = "Download the GCL here";
                document.querySelector(".download").classList.remove("hidden")
                document.querySelector(".download").innerHTML = download.link(res.url);
            });
        }
    })
```

V3 example;

```javascript
config = new T1CSdk.T1CConfig(configoptions);
T1CSdk.T1CClient.initialize(config).then(res => {
    client = res;
    console.log("Client config: ", client.localConfig)
    core = client.core();

}, err => {
    if (err.code == 500) {
        console.log(err)
        client = err.client
        $('#consentModal').modal('show', {
            keyboard: false
        });
        $('.consent-token').text(makeid(20));
    } else if (err.code == 115) {
        $('.consent-token').text(makeid(20));
    } else if (err.code == 199) {
        document.querySelector("#initAlert").classList.remove("d-none")
        document.querySelector("#initAlert").innerHTML = err.description;
    } else {
        console.error("T1C error:", err)
    }
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://t1t.gitbook.io/t1c-js-guide-v3/v3.1.4/migration-guide-v2-greater-than-v3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
