@decentrys/protect 0.1.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 +82 -0
- package/dist/browser/decentrys-protect.js +901 -0
- package/dist/browser/decentrys-protect.mjs +876 -0
- package/dist/cache.d.ts +41 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +75 -0
- package/dist/cache.js.map +1 -0
- package/dist/classify.d.ts +58 -0
- package/dist/classify.d.ts.map +1 -0
- package/dist/classify.js +269 -0
- package/dist/classify.js.map +1 -0
- package/dist/client.d.ts +132 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +307 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/model.d.ts +156 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +80 -0
- package/dist/model.js.map +1 -0
- package/dist/simulation.d.ts +57 -0
- package/dist/simulation.d.ts.map +1 -0
- package/dist/simulation.js +23 -0
- package/dist/simulation.js.map +1 -0
- package/dist/transport.d.ts +61 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +151 -0
- package/dist/transport.js.map +1 -0
- package/dist/wire.d.ts +63 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +274 -0
- package/dist/wire.js.map +1 -0
- package/package.json +64 -0
- package/src/cache.test.ts +67 -0
- package/src/cache.ts +87 -0
- package/src/classify.test.ts +294 -0
- package/src/classify.ts +323 -0
- package/src/client.test.ts +224 -0
- package/src/client.ts +420 -0
- package/src/index.ts +7 -0
- package/src/model.ts +237 -0
- package/src/simulation.ts +71 -0
- package/src/transport.test.ts +129 -0
- package/src/transport.ts +203 -0
- package/src/wire.test.ts +172 -0
- package/src/wire.ts +321 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Decentrys Labs
|
|
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,82 @@
|
|
|
1
|
+
# @decentrys/protect
|
|
2
|
+
|
|
3
|
+
Evidence-based on-chain risk assessment for wallets and dapps.
|
|
4
|
+
|
|
5
|
+
> **Lack of evidence is not evidence of malice.**
|
|
6
|
+
>
|
|
7
|
+
> A contract deployed two hours ago by an anonymous wallet with no audit and
|
|
8
|
+
> thin liquidity is *unknown*, not dangerous. Scoring those facts as risk
|
|
9
|
+
> produces a system that protects incumbents and taxes every new project — a
|
|
10
|
+
> gatekeeping product wearing a security product's clothes. Decentrys refuses
|
|
11
|
+
> to do that, and there is no code path by which newness can raise a risk
|
|
12
|
+
> level.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @decentrys/protect
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Use
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { Decentrys } from '@decentrys/protect';
|
|
24
|
+
|
|
25
|
+
const decentrys = new Decentrys({ apiKey: 'dk_pub_live_...' });
|
|
26
|
+
|
|
27
|
+
const { assessment, decision } = await decentrys.assessTransaction({
|
|
28
|
+
chain: 'ethereum',
|
|
29
|
+
from: userAddress,
|
|
30
|
+
to: contractAddress,
|
|
31
|
+
data: calldata,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
assessment.riskLevel // 'CAUTION'
|
|
35
|
+
assessment.explanation // why, in words you can show a user
|
|
36
|
+
assessment.threatSignals // each with its evidence, confidence and hop distance
|
|
37
|
+
assessment.facts // observed, never accusatory
|
|
38
|
+
decision.action // what *your* policy says to do
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Two properties worth knowing
|
|
42
|
+
|
|
43
|
+
**It never throws.** This runs between a user and a signing screen. A security
|
|
44
|
+
service having a bad minute must not cost someone their transaction, so an
|
|
45
|
+
unreachable Decentrys returns an assessment that says exactly that in its
|
|
46
|
+
`unknowns` — never a reassuring result it did not earn.
|
|
47
|
+
|
|
48
|
+
**It never blocks.** Decentrys returns intelligence; your policy decides. The
|
|
49
|
+
default blocks only `KNOWN_MALICIOUS`, which requires analyst-verified
|
|
50
|
+
evidence because it is the one output that accuses a third party.
|
|
51
|
+
|
|
52
|
+
## Risk levels
|
|
53
|
+
|
|
54
|
+
Seven, not safe/scam. `NO_CRITICAL_RISK_DETECTED` · `INFORMATIONAL` ·
|
|
55
|
+
`CAUTION` · `ELEVATED_RISK` · `HIGH_RISK` · `CRITICAL_THREAT` ·
|
|
56
|
+
`KNOWN_MALICIOUS`. Capabilities can reach `CAUTION`; only threat signals with
|
|
57
|
+
evidence go past it.
|
|
58
|
+
|
|
59
|
+
`historyStatus: 'LIMITED'` is the correct, expected state for anything
|
|
60
|
+
recently deployed. It measures *our* coverage, never the subject's danger, and
|
|
61
|
+
must not be rendered as a warning.
|
|
62
|
+
|
|
63
|
+
## Browser
|
|
64
|
+
|
|
65
|
+
Ships an ESM and an IIFE bundle with zero dependencies, for extensions and
|
|
66
|
+
pages with a strict CSP: `@decentrys/protect/browser`, global
|
|
67
|
+
`DecentrysProtect`.
|
|
68
|
+
|
|
69
|
+
## The tests are part of the argument
|
|
70
|
+
|
|
71
|
+
`src/classify.test.ts` encodes the cases that must never regress — including
|
|
72
|
+
that a brand-new unaudited contract with an anonymous deployer is
|
|
73
|
+
`INFORMATIONAL`, not a threat. They ship with the package. Read them.
|
|
74
|
+
|
|
75
|
+
## Licence
|
|
76
|
+
|
|
77
|
+
MIT © Decentrys Labs
|
|
78
|
+
|
|
79
|
+
## Links
|
|
80
|
+
|
|
81
|
+
- [decentrys.com](https://decentrys.com) · [SDK overview](https://decentrys.com/sdk) · [Developer API](https://decentrys.com/developers)
|
|
82
|
+
- Source: [github.com/teamdecentrys-byte/Decentrys](https://github.com/teamdecentrys-byte/Decentrys)
|