@huatek/ghostkey-core
v0.1.8
Published
Core contracts for GhostKey Auth.
Downloads
28
Readme
@huatek/ghostkey-core
Core contracts for GhostKey Auth.
This package contains shared TypeScript types, adapter interfaces, errors and utility helpers used by every GhostKey package. Install it directly when you are building a custom database/cache adapter or extending the framework.
Install
npm install @huatek/ghostkey-coreMain exports
DatabaseAdapterCacheAdapterGhostKeyUserGhostKeyDeviceGhostKeyChallengeGhostKeySessionTrustedLocationRequestContextRiskEngineRiskResultGhostKeyAuthErrorGhostKeyRiskErrorcreateId()createSecret()sha256()
Adapter example
import type { DatabaseAdapter } from "@huatek/ghostkey-core";
export function createMyAdapter(): DatabaseAdapter {
return {
async createUser(input) {
// Persist and return a GhostKeyUser.
throw new Error("implement me");
}
// Implement the rest of the DatabaseAdapter contract.
} as DatabaseAdapter;
}Security notes
- Do not store passwords.
- Do not store private keys.
- Device fingerprint values are risk signals only.
- Challenges and refresh tokens should be stored hashed or protected by the server-side adapter where applicable.
