open-index/open-npm huggingface dataset:
npm package: @itbuild/auth.proxy
Description: Universal package for authentication process.
Author: itbuildgroup
Latest version: 1.0.19

# Auth proxy SDK (JavaScript)
Universal package for authentication process.

## Configuration:

process.env variable are used for configuration:

```
AUTH_API_URL=https://test-project.api/
```

## Usage

### Obtaining a new session

The `signInUserKey` function is used to obtain the cookie:

```ts
var client = new AuthProxyClient(<YOUR_BASE_URL>);

await client.signInUserKey(<YOUR_USER_KEY>);

// Returns sessionId string if session exists
// null if session not found
const sessionId = client.GetSessionId();
```

After that, sessionId can be used to authorize requests.

### Creating or restoring a key

To restore a key, you need to perform the following sequence of requests:

1. Request key restoration
2. Initialize a new key
3. Create a new key

```ts
var client = new AuthProxyClient();

// Sends a code to the email associated with the phone number
// Returns a status string "Success"
// null in case of an error
const result = await client.ResetPassword('<PHONE_NUMBER>');

// Initializes the creation of a new key, sends an OTP code to the associated phone number, and returns data for creating a new key
// null in case of an error
const authOptions = await client.InitializeNewKey('<EMAIL_CODE>');

// Returns the user key, which is set in USER_KEY to obtain sessions
// null in case of an error
const userKey = await client.CreateUserKey('<OTP_CODE>', authOptions);
```
npm package: @itbuild/trex.wallet
Description: Universal package for crypto wallet operations.
Author: itbuildgroup
Latest version: 1.0.23

# Trex wallet SDK (JavaScript)

## Configuration:

process.env variable are used for configuration:

```
AUTH_API_URL=https://test-project.api/
```

## Response interface

Each return type from the SDK functions is wrapped in an ApiResponse<T> object:

```ts
export interface ApiResponse<T> {
  error?: ErrorObject | null;
  result?: T | null;
}

export interface ErrorObject {
  code: number; // Error code can be used to catch specific error codes
  readonly message: string | null; // Error description     
}
```

## Authorization

### Obtaining a new session

The `signInUserKey` function is used to obtain the cookie:

```ts
var authProxyClient = new AuthProxyClient();

await authProxyClient.signInUserKey(<YOUR_USER_KEY>);

// Returns sessionId string if session exists
// null if session not found
const sessionId = authProxyClient.GetSessionId();
```

After that, sessionId can be used to authorize requests.

## Usage

To use a wallet instance you need to log in via authProxyClient

### Create wallet instance

```ts
// authProxyClient is object of AuthProxyClient
var walletClient = new TrexWalletClient(authProxyClient);
```

### Create invoice

```ts
var response = await walletClient.createTransactionCode({
      amount: 10,
      currency: "USDT",
      timeLimit: true,
      typeTx: CodeTypeEnum.InvoiceTx,
      externalID: <YOUR_APP_ID>,
      partnerInfo: <YOUR_USER_ID>,
      tag: <YOUR_INFO>
    });

if (response.error) {
    throw; // Your error handling
}

var codeInfo = response.result;
```

### Get transaction history

```ts
var response = await walletClient.getTransactionHistory();

if (response.error) {
    throw; // Your error handling
}

var transactions = response.result;
```