FaceID Authority 提供完整的 REST API 与多语言 SDK,让你在 5 分钟内将链上人脸确权能力集成到任意应用。
npm install @faceid/authority-sdk
import { FaceIDAuthority } from '@faceid/authority-sdk'; const faceid = new FaceIDAuthority({ apiKey: 'fid_live_xxxxxxxxxxxxxxxx', network: 'mainnet', // 'mainnet' | 'testnet' chain: 'ethereum', // 支持 14 条链 });
// 1. 获取认证会话 const session = await faceid.createSession({ userId: 'user_abc123', level: 'standard', // standard | enterprise | sovereign callbackUrl: 'https://your-app.com/webhook', }); // 2. 重定向用户完成扫描 window.location.href = session.authorizeUrl; // 3. Webhook 回调验证结果 app.post('/webhook', async (req, res) => { const event = faceid.verifyWebhook(req.headers, req.body); if (event.type === 'identity.verified') { console.log('已确权:', event.data.did, event.data.nftId); } });
/v3/sessions
创建身份认证会话
需要 API Key
/v3/sessions/:id
查询会话状态
需要 API Key
/v3/identities/:did
查询 DID 身份信息
公开
/v3/nfts/mint
手动触发 NFT 铸造
需要 API Key
/v3/identities/:did/revoke
撤销授权
需要 API Key + 签名
| 计划 | 请求/分钟 | 月配额 | 支持链数 |
|---|---|---|---|
| 免费 | 60 | 1,000 | 2 |
| 专业版 ¥299/月 | 600 | 50,000 | 7 |
| 企业版 ¥2,999/月 | 无限 | 无限 | 14 |