@qquik-identity/core
v0.5.4
Published
A lightweight TypeScript SDK for QQuik Identity services that provides seamless identity management for your applications.
Readme
@qquik-identity/core
A lightweight TypeScript SDK for QQuik Identity services that provides seamless identity management for your applications.
Installation
npm install @qquik-identity/core
# or
yarn add @qquik-identity/coreFeatures
- Secure device identification
- Identity and UID retrieval
- Configurable API endpoints
- TypeScript support with full type definitions
Usage
Basic Setup
import { QQuikIdentity } from '@qquik-identity/core';
// Initialize with your API key
const identity = new QQuikIdentity({
apiKey: 'your-api-key'
});
// Get user identity
const getIdentity = async () => {
const identity = await identity.getIdentity();
console.log(identity);
};
// Get user UID
const getUid = async () => {
const uid = await identity.getUid();
console.log(uid);
};HTML Import (Browser)
You can also use the library directly in the browser via CDN:
<script src="https://cdn.jsdelivr.net/npm/@qquik-identity/core/dist/qquikidentity.umd.production.min.js"></script>
<script>
// Create an instance with your API key
const identity = new QQuikIdentity.default({
apiKey: "your-api-key"
});
// Get user UID
identity.getUid()
.then(uid => console.log("User UID:", uid))
.catch(error => console.error("Error:", error));
// Get full identity object
identity.getIdentity()
.then(identityObj => console.log("Identity:", identityObj))
.catch(error => console.error("Error:", error));
</script>Advanced Configuration
import { QQuikIdentity } from '@qquik-identity/core';
// Initialize with custom configuration
const identity = new QQuikIdentity({
baseUrl: 'https://custom-api.example.com',
apiKey: 'your-api-key',
timeout: 5000 // Optional timeout in ms
});
// Get identity with custom configuration
const getIdentity = async () => {
const identity = await identity.getIdentity();
console.log(identity);
};API Reference
QQuikIdentity
The main class for identity operations.
Constructor
new QQuikIdentity(config?: IdentityConfig)config: Optional configuration objectapiKey: Your API key for authenticationbaseUrl: Optional API base URLtimeout: Optional request timeout in milliseconds
Methods
getIdentity(): Returns a Promise with the full identity objectgetUid(): Returns a Promise with the user's unique identifier
Types
interface IdentityObject {
uid: string;
// Additional identity properties
}Development
# Install dependencies
yarn install
# Start development mode
yarn start
# Build the package
yarn build
# Run tests
yarn testLicense
MIT
