npm package: @lacspace/auth
Description: Lacspace API authentication and request library
Author: Lacspace
Latest version: 1.0.5

# @lacspace/auth

**Lacspace API Authentication and Request Library**  
*Built by Lacspace - THINK | INNOVATE | EXECUTE*

The `@lacspace/auth` package provides a seamless interface for authenticating and interacting with the **Lacspace API**. It supports secure HTTP requests to endpoints such as `/products`, `/users`, and `/stores`, with automatic `X-Timestamp` header generation and token-based authentication.

---

## 🚨 **Critical Warning**

**This library is exclusively for use with the Lacspace API.** The Lacspace API requires a **proprietary license issued solely by Lacspace**. Unauthorized access or use of the Lacspace API is **strictly prohibited** and may result in legal consequences. To obtain an API token and license, you **must** contact Lacspace at [**support@lacspace.com**](mailto:support@lacspace.com).

**Do not attempt to use this library without a valid Lacspace API license.**

---

## Installation

Install the package via npm:

```bash
npm install @lacspace/auth

During installation, you’ll be prompted to enter:

API URL (e.g., https://api.lacspace.com/api)
API Token (e.g., 99f74459341f35151e1092d0bf6a18ab5986d449687e28380c90cccaLacSpacE)

These details are stored in a lacspace-config.json file in your project root for automatic loading.

Note: A valid Lacspace API token is required and can only be obtained through a Lacspace-issued license. Contact Lacspace for access.


Usage
Use the LacspaceAuth class to make authenticated requests to Lacspace API endpoints:
const { LacspaceAuth } = require('@lacspace/auth');

// Initialize with auto-loaded config from lacspace-config.json
const auth = new LacspaceAuth();

// Fetch users
auth.get('users')
  .then(data => console.log('Users:', data))
  .catch(err => console.error('Error:', err.message));

// Create a product
auth.post('products', { name: 'Widget', price: 10 })
  .then(data => console.log('Product:', data))
  .catch(err => console.error('Error:', err.message));


Supported Endpoints
The Lacspace API supports endpoints including:

/products: Manage product data (e.g., fetch, create).
/users: Manage user data (e.g., fetch, update).
/stores: Manage store data (e.g., fetch, create).

For a complete list of endpoints, refer to the Lacspace API Documentation, provided exclusively to licensed users.

Configuration
The library loads configuration from lacspace-config.json. To re-run the configuration prompt:
node node_modules/@lacspace/auth/dist/config.js

Or manually edit lacspace-config.json:
{
  "apiUrl": "https://api.lacspace.com/api",
  "apiToken": "your-api-token"
}


Warning: Your API token is sensitive and tied to your Lacspace license. Never share it publicly.


Requirements

Node.js: Version 14 or higher
Lacspace API License: Obtain exclusively from contact@lacspace.com
Lacspace API Token: Provided with your license
Internet Access: Required to connect to the Lacspace API


License
The @lacspace/auth package is distributed under the MIT License for the library code. However, access to the Lacspace API requires a proprietary license issued exclusively by Lacspace. Unauthorized use of the API violates Lacspace’s terms and conditions and is strictly prohibited.
To obtain a Lacspace API license:

Email: contact@lacspace.com
Website: https://lacspace.com


Support
For issues with the library or API access:

GitHub Issues: https://github.com/lacspace/lacspace-auth/issues
Email Support: contact@lacspace.com

Support is available only to licensed Lacspace API users.

Development
To contribute or modify the library:

Clone the repository:git clone https://github.com/lacspace/lacspace-auth.git


Install dependencies:npm install


Build the project:npm run build


Run tests:npm test




Security

API Token: Store securely and never expose in public repositories.
Rate Limits: Adhere to Lacspace API rate limits (details provided with license).
Updates: Keep @lacspace/auth updated for the latest security patches.


Disclaimer
This library is provided as is for licensed Lacspace API users. Lacspace is not responsible for misuse, unauthorized access attempts, or damages resulting from improper use. A valid Lacspace API license is mandatory for usage.
Developed by Lacspace - THINK | INNOVATE | EXECUTE.```
# lacspace-auth