> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nexveil.net/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript & TypeScript SDK

> A JavaScript & TypeScript SDK for interacting with the Auth API.

<Info>
  [https://www.npmjs.com/package/nexveil-auth](https://www.npmjs.com/package/nexveil-auth)
</Info>

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install nexveil-auth
  ```

  ```bash yarn theme={null}
  yarn add nexveil-auth
  ```

  ```bash pnpm theme={null}
  pnpm add nexveil-auth
  ```
</CodeGroup>

## Example Usage

```javascript theme={null}
const NexveilAuth = require('nexveil-auth')
const auth = new NexveilAuth({
  // Required
  appName: 'MyApp',              // Your app name registered in Nexveil
  secret1: '64_char_hex...',     // First secret (from app metadata)
  secret2: '64_char_hex...',     // Second secret (from app metadata)
  secret3: '64_char_hex...',     // Third secret (from app metadata)
  
  // Optional
  apiUrl: 'https://...',         // API base URL (default: production)
  autoHWID: true,                // Auto-generate HWID (default: true)
  customHWID: null,              // Custom HWID override (default: null)
  strictSSL: true                // Enforce strict SSL (default: true)
});
auth.verify("license_key_here")
```

<ResponseField name="verify(key)" type="json">
  verify a license key

  **Returns:** `Promise<Object>`

  ```javascript theme={null}
  {
    success: true,           // Boolean - verification succeeded
    code: 'KEY_VALID',       // String - response code
    message: 'Success',      // String - human-readable message
    signature: 'abc123...',  // String - server signature
    isActivated: false,      // Boolean - true if key was just activated
    isValid: true,           // Boolean - key is valid (activated or valid)
    timestamp: '2024-...',   // String - verification timestamp
    data: {                  // Object - additional data
      key: {
        expiresAt: '2025-01-01T00:00:00Z',
        activatedAt: '2024-06-15T10:30:00Z',
        note: 'Premium tier'
      },
      app: {
        version: '1.2.3'
      }
    }
  }
  ```

  **Response Codes:**

  * `KEY_VALID` - License is valid (already activated)
  * `KEY_ACTIVATED` - License just activated (first use)
  * `KEY_NOT_FOUND` - License key doesn't exist
  * `KEY_EXPIRED` - License has expired
  * `KEY_REVOKED` - License has been revoked
  * `KEY_DISABLED` - License disabled by administrator
  * `HWID_MISMATCH` - Hardware ID doesn't match
  * `USER_BANNED` - User or device is banned
  * `PROJECT_MISMATCH` - Key doesn't belong to this app
  * `SIGNATURE_INVALID` - Request signature invalid
  * `TIMESTAMP_EXPIRED` - Request timestamp out of range
  * `SERVER_ERROR` - Internal server error
</ResponseField>

**Full documentation**: [https://github.com/venoxcc/nexveil-auth](https://github.com/venoxcc/nexveil-auth)
