@kairosauth/sdk
v0.2.0
Published
Device-first, blockchain-anchored authentication SDK — P-256 keys, WebAuthn PRF, on-chain Merkle proofs
Downloads
209
Maintainers
Readme
@kairosauth/sdk
Device-first, blockchain-anchored authentication SDK. Zero runtime dependencies.
Features
- P-256 (secp256r1) key generation via SubtleCrypto
- WebAuthn PRF for hardware-backed key wrapping (Secure Enclave)
- HKDF / Argon2id key derivation
- IndexedDB encrypted key storage
- On-chain Merkle proof verification
- ERC-4337 smart wallet integration
- Offline-first with network failover
Install
npm install @kairosauth/sdkQuick Start
import { KairosAuthClient } from "@kairosauth/sdk";
const client = new KairosAuthClient({
projectId: "ka_proj_abc123",
apiKey: "ka_test_xxx",
});
// Register / Login
const flow = await client.register("[email protected]");
const result = await flow.submitOTP("ABC12345");
console.log("Identity:", result.identityId);Security Tiers
| Tier | Storage | Key Protection | |------|---------|----------------| | 1 | Secure Enclave | WebAuthn PRF + HKDF (non-extractable) | | 2 | IndexedDB | Argon2id password wrapping |
API
Client
KairosAuthClient- Main orchestrator (register, login, wallet)
Crypto
generateKeyPair()- P-256 ECDSA key generationwrapKey()/unwrapKey()- AES-GCM key wrappingsignChallenge()- ECDSA signaturederiveWrappingKey()- HKDF from device secret
WebAuthn
createCredential()- Register a passkey with PRFgetAssertion()- Authenticate with passkeydetectTier()- Check device capabilities
Storage
storeWrappedKey()/getWrappedKey()- IndexedDB operationshasStoredIdentity()- Check for existing credentials
License
MIT
