@quantabit/security-sdk
v1.0.2
Published
QuantaBit Security SDK - API signing, encryption/decryption, risk control, behavior recognition, and security audit logs
Maintainers
Readme
@quantabit/security-sdk
QuantaBit Security & Risk Control SDK - Risk detection, device fingerprinting, and verification challenges
📦 Installation
npm install @quantabit/security-sdk
# or
yarn add @quantabit/security-sdk🚀 Quick Start
1. Setup Provider
import { SecurityProvider } from "@quantabit/security-sdk";
import "@quantabit/security-sdk/styles.css";
function App() {
return (
<SecurityProvider
apiUrl="https://api.example.com/v1"
token="your-auth-token"
onRiskDetected={(risk) => console.log("Risk detected:", risk)}
onBlocked={(result) => console.log("Action blocked:", result)}
>
<YourComponent />
</SecurityProvider>
);
}2. Risk Detection
import { useSecurity } from "@quantabit/security-sdk";
function PaymentButton() {
const { checkRisk, verificationRequired } = useSecurity();
const handlePayment = async () => {
const result = await checkRisk("payment", { amount: 1000 });
if (result.allowed) {
// Proceed with payment
processPayment();
} else if (result.verification) {
// Verification required, modal will show automatically
} else {
// Blocked
alert(result.reason);
}
};
return <button onClick={handlePayment}>Pay</button>;
}3. Using Components
import { RiskBadge, VerificationModal } from "@quantabit/security-sdk";
// Risk level badge
<RiskBadge level="medium" />;
// Verification modal
{
verificationRequired && (
<VerificationModal
type={verificationRequired}
onSuccess={() => continueAction()}
onCancel={() => cancelAction()}
/>
);
}4. Encryption Tools
import {
sha256,
encryptAES,
decryptAES,
getFingerprint,
} from "@quantabit/security-sdk";
// SHA256 hash
const hash = await sha256("data");
// AES encrypt/decrypt
const encrypted = await encryptAES("plaintext", key);
const decrypted = await decryptAES(encrypted, key);
// Get device fingerprint
const fingerprint = await getFingerprint();🛡️ Risk Levels
import { RiskLevel } from "@quantabit/security-sdk";
RiskLevel.LOW; // Low risk - Allow
RiskLevel.MEDIUM; // Medium risk - May require verification
RiskLevel.HIGH; // High risk - Verification required
RiskLevel.CRITICAL; // Critical risk - Block📄 License
MIT License
🌐 Brand & Links
- Official Mainnet: QuantaBit Chain
- Developer Platform: Developer Platform
- Open Platform: Open Platform
- Payment Platform: Pay Platform
- Feedback: Feedback
