0.3.21 • Published 10 months ago

@hautechai/sdk v0.3.21

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

sdk-server npm version

Hautech SDK

Installation

npm install @hautechai/sdk
# or
yarn add @hautechai/sdk

Usage

Creating tokens

To use the SDK, first you need to create a token via token signer.

// THIS CODE SHOULD BE RUN ON SERVER SIDE ONLY!!!

import { createTokenSigner } from '@hautechai/sdk';

const signer = createTokenSigner({
    appId: process.env.APP_ID!,
    appKeyId: process.env.APP_KEY_ID!,
    appKeySecret: process.env.APP_KEY_SECRET!,
});

Root token

For creating token that can be used on server side, you can create a root token.

const rootToken = signer.createRootToken({ expiresInSeconds: 3600 });

It's very not recommended to use root token on client side.

Account token

For creating token that can be used on client side by your users, you can create an account token.

const accountToken = signer.createAccountToken({ accountId: 'ACCOUNT_ID', expiresInSeconds: 3600 });

Initializing SDK

To initialize the SDK, you need to pass the function that returns the token to the createSDK function.

import { createSDK } from '@hautechai/sdk';

const sdk = createSDK({ authToken: () => accountToken }); // you should call the server here for getting the token

Using SDK

Docs about how to use the SDK are available here

0.3.21

10 months ago

0.3.20

10 months ago

0.3.19

10 months ago

0.3.18

10 months ago

0.3.17

10 months ago

0.3.16

10 months ago

0.3.15

10 months ago

0.3.13

10 months ago

0.3.12

10 months ago

0.3.11

11 months ago

0.3.10

11 months ago

0.3.9

11 months ago

0.3.8

11 months ago

0.3.7

11 months ago

0.3.6

11 months ago

0.3.5

11 months ago

0.3.4

11 months ago

0.3.3

11 months ago

0.3.2

11 months ago

0.3.1

11 months ago

0.3.0

11 months ago

0.2.7

11 months ago

0.2.6

11 months ago

0.2.5

11 months ago

0.2.4

11 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.0.29

12 months ago

0.0.28

12 months ago

0.0.27

12 months ago

0.0.26

12 months ago

0.0.25

12 months ago

0.0.24

12 months ago

0.0.22

12 months ago

0.0.21

12 months ago

0.0.20

12 months ago

0.0.19

12 months ago

0.0.18

12 months ago

0.0.17

12 months ago

0.0.16

12 months ago

0.0.15

12 months ago

0.0.14

12 months ago

0.0.13

12 months ago

0.0.12

12 months ago

0.0.11

12 months ago

0.0.10

12 months ago

0.0.9

12 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago