@exodus/账户-安全
Exodus SDK功能报告活动账户安全警告(GLOBAL_SCAM 编号 : LOST_PERMISSIONS在安全报告.
这些警告已经作为桌面和移动应用程序的模式向用户浮出水面,但安全报告没有记录这些警告. 当一个用户击中一个并伸出援手时,以前无法从报告中分辨出哪个资产触发了警报,或者哪个发出了警告。 这一特点弥补了这一差距.
安装
pnpm add @exodus/account-security
使用量
此特性设计为与 @exodus/headless已经装好了 见 使用 sdk。 。 。 .
捐款a report 节点 名称空格 accountSecurity,因此,每当安全报告通过 exodus.reporting.export()没有 exodus.* API表面,没有原子,没有插件:该特性只在报告时间读取已存在的状态.
报告的内容
报告时,该功能将每个 启用的基础资产,运行该资产 api.securityChecks({ accountState }),并收集任何不可靠的账户.
报告是: null 当没有钱包或钱包被锁定时。 否则它的形状是:
{
summary: {
// The most severe active warning, or null when there are none.
warningType: 'GLOBAL_SCAM' | 'LOST_PERMISSIONS' | null
hasWarnings: boolean
}
// One entry per (wallet account, asset) that failed its security check.
warnings: Array<{
walletAccount: string
assetName: string
type: 'GLOBAL_SCAM' | 'LOST_PERMISSIONS'
reason: string
}>
// One entry per base asset whose securityChecks method threw.
checkFailures: Array<{
walletAccount: string
assetName: string
error: SafeError
}>
}
示例输出 :
{
"summary": { "warningType": "GLOBAL_SCAM", "hasWarnings": true },
"warnings": [
{
"walletAccount": "exodus_0",
"assetName": "tron",
"type": "GLOBAL_SCAM",
"reason": "Account is globally blacklisted."
},
{
"walletAccount": "exodus_1",
"assetName": "ethereum",
"type": "LOST_PERMISSIONS",
"reason": "Account is delegated to a non-whitelisted EIP-7702 address."
}
],
"checkFailures": []
}
绝对优先
GLOBAL_SCAM 排行 LOST_PERMISSIONS 因为它可以在启动时屏蔽应用程序. 当这两种情况都出现在账户中时, summary.warningType 报告 GLOBAL_SCAM时 warnings 仍然列出每一个单独的警告,不管类型.
资产如何选择
此特性不执行任何检测逻辑本身,只执行聚合. 实际检查存在于每个资产的插件中,该插件会显示同步 api.securityChecks 方法 :
asset.api.securityChecks({ accountState }): {
isSecure: boolean
type: 'GLOBAL_SCAM' | 'LOST_PERMISSIONS' | null
reason: string | null
}
账户仅包含在 warnings 何时 isSecure 实值 false为了保持报告的稳健性,对以下内容进行了保守处理:
- 托肯和非基地资产: 只包括基本资产(其中
asset.baseAsset.name === assetName)被选中. - 无资产
securityChecks:不执行该方法的资产被忽略. - 残废资产: 任何未启用的内容
enabledAssetsAtom被跳过. - 掷出支票: 如果单个资产
securityChecks投出时,错误会被捕获到checkFailures作为SafeError带安全提示account-security: report/security-checks. 循环仍在继续,因此一个被破坏的资产无法使报告的其他部分沉没.
依赖关系
报告节点取决于 assetsModule, (中文(简体) ), accountStatesAtom,以及 enabledAssetsAtom这些都是SDK提供的.