UNPKG

atp-sdk

Version:

Official TypeScript SDK for Agent Trust Protocolâ„¢ - Build secure, verifiable, and trustworthy applications with decentralized identity, verifiable credentials, and robust access control

94 lines • 2.54 kB
import { BaseClient } from './base.js'; export class IdentityClient extends BaseClient { constructor(config) { super(config, 'identity'); } /** * Register a new DID with the ATP network */ async registerDID(request) { return this.post('/identity/register', request); } /** * Resolve a DID to get its document */ async resolveDID(did) { return this.get(`/identity/${encodeURIComponent(did)}`); } /** * Get DID document */ async getDIDDocument(did) { return this.get(`/identity/${encodeURIComponent(did)}/document`); } /** * Update trust level for a DID */ async updateTrustLevel(did, request) { return this.put(`/identity/${encodeURIComponent(did)}/trust-level`, request); } /** * Get trust level information for a DID */ async getTrustLevel(did) { return this.get(`/identity/${encodeURIComponent(did)}/trust-info`); } /** * Rotate keys for a DID */ async rotateKeys(did, newPublicKey) { return this.post(`/identity/${encodeURIComponent(did)}/rotate-keys`, { newPublicKey }); } /** * List all identities (admin function) */ async listIdentities(params) { return this.get('/identity', { params }); } // MFA Methods /** * Setup multi-factor authentication */ async setupMFA(did, request) { return this.post('/mfa/setup', { did, ...request }); } /** * Confirm MFA setup with verification token */ async confirmMFA(did, verificationToken) { return this.post('/mfa/confirm', { did, verificationToken }); } /** * Verify MFA during authentication */ async verifyMFA(did, verification) { return this.post('/mfa/verify', { did, ...verification }); } /** * Get MFA status for a DID */ async getMFAStatus(did) { return this.get(`/mfa/status/${encodeURIComponent(did)}`); } /** * Disable MFA for a DID */ async disableMFA(did, verificationToken) { return this.post('/mfa/disable', { did, verificationToken }); } /** * Regenerate backup codes */ async regenerateBackupCodes(did, verificationToken) { return this.post('/mfa/backup-codes/regenerate', { did, verificationToken }); } /** * Check service health */ async getHealth() { return this.get('/health'); } } //# sourceMappingURL=identity.js.map