@quantabit/security-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/index.cjs +1474 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.esm.js +1444 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +90 -0
- package/types/index.d.ts +97 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 QuantaBit Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# @quantabit/security-sdk
|
|
2
|
+
|
|
3
|
+
> QuantaBit Security & Risk Control SDK - Risk detection, device fingerprinting, and verification challenges
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @quantabit/security-sdk
|
|
9
|
+
# or
|
|
10
|
+
yarn add @quantabit/security-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 🚀 Quick Start
|
|
14
|
+
|
|
15
|
+
### 1. Setup Provider
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { SecurityProvider } from "@quantabit/security-sdk";
|
|
19
|
+
import "@quantabit/security-sdk/styles.css";
|
|
20
|
+
|
|
21
|
+
function App() {
|
|
22
|
+
return (
|
|
23
|
+
<SecurityProvider
|
|
24
|
+
apiUrl="https://api.example.com/v1"
|
|
25
|
+
token="your-auth-token"
|
|
26
|
+
onRiskDetected={(risk) => console.log("Risk detected:", risk)}
|
|
27
|
+
onBlocked={(result) => console.log("Action blocked:", result)}
|
|
28
|
+
>
|
|
29
|
+
<YourComponent />
|
|
30
|
+
</SecurityProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Risk Detection
|
|
36
|
+
|
|
37
|
+
```jsx
|
|
38
|
+
import { useSecurity } from "@quantabit/security-sdk";
|
|
39
|
+
|
|
40
|
+
function PaymentButton() {
|
|
41
|
+
const { checkRisk, verificationRequired } = useSecurity();
|
|
42
|
+
|
|
43
|
+
const handlePayment = async () => {
|
|
44
|
+
const result = await checkRisk("payment", { amount: 1000 });
|
|
45
|
+
|
|
46
|
+
if (result.allowed) {
|
|
47
|
+
// Proceed with payment
|
|
48
|
+
processPayment();
|
|
49
|
+
} else if (result.verification) {
|
|
50
|
+
// Verification required, modal will show automatically
|
|
51
|
+
} else {
|
|
52
|
+
// Blocked
|
|
53
|
+
alert(result.reason);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return <button onClick={handlePayment}>Pay</button>;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Using Components
|
|
62
|
+
|
|
63
|
+
```jsx
|
|
64
|
+
import { RiskBadge, VerificationModal } from "@quantabit/security-sdk";
|
|
65
|
+
|
|
66
|
+
// Risk level badge
|
|
67
|
+
<RiskBadge level="medium" />;
|
|
68
|
+
|
|
69
|
+
// Verification modal
|
|
70
|
+
{
|
|
71
|
+
verificationRequired && (
|
|
72
|
+
<VerificationModal
|
|
73
|
+
type={verificationRequired}
|
|
74
|
+
onSuccess={() => continueAction()}
|
|
75
|
+
onCancel={() => cancelAction()}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 4. Encryption Tools
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
import {
|
|
85
|
+
sha256,
|
|
86
|
+
encryptAES,
|
|
87
|
+
decryptAES,
|
|
88
|
+
getFingerprint,
|
|
89
|
+
} from "@quantabit/security-sdk";
|
|
90
|
+
|
|
91
|
+
// SHA256 hash
|
|
92
|
+
const hash = await sha256("data");
|
|
93
|
+
|
|
94
|
+
// AES encrypt/decrypt
|
|
95
|
+
const encrypted = await encryptAES("plaintext", key);
|
|
96
|
+
const decrypted = await decryptAES(encrypted, key);
|
|
97
|
+
|
|
98
|
+
// Get device fingerprint
|
|
99
|
+
const fingerprint = await getFingerprint();
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 🛡️ Risk Levels
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
import { RiskLevel } from "@quantabit/security-sdk";
|
|
106
|
+
|
|
107
|
+
RiskLevel.LOW; // Low risk - Allow
|
|
108
|
+
RiskLevel.MEDIUM; // Medium risk - May require verification
|
|
109
|
+
RiskLevel.HIGH; // High risk - Verification required
|
|
110
|
+
RiskLevel.CRITICAL; // Critical risk - Block
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 📄 License
|
|
114
|
+
|
|
115
|
+
MIT License
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 🌐 Brand & Links
|
|
122
|
+
- Official Mainnet: [QuantaBit Chain](https://qbitchain.io/)
|
|
123
|
+
- Developer Platform: [Developer Platform](https://developer.quantabit.io/)
|
|
124
|
+
- Open Platform: [Open Platform](https://open.quantabit.io/)
|
|
125
|
+
- Payment Platform: [Pay Platform](https://pay.qbitwallet.io/)
|
|
126
|
+
- Feedback: [Feedback](https://xwin.live/qbit)
|