lotus-sdk
Version:
Central repository for several classes of tools for integrating with, and building for, the Lotusia ecosystem
40 lines • 2.27 kB
TypeScript
import { EventEmitter } from 'events';
import { PublicKey } from '../../bitcore/publickey.js';
import { SignerIdentity, BurnProof, IdentityReputation } from './types.js';
export interface IdentityManagerEvents {
'identity:registered': (identityId: string, burnProof: BurnProof) => void;
'identity:verified': (identityId: string, publicKey: string) => void;
'identity:banned': (identityId: string, reason: string) => void;
'key:rotated': (identityId: string, oldKey: string, newKey: string) => void;
'reputation:updated': (identityId: string, oldScore: number, newScore: number) => void;
}
export declare class MuSig2IdentityManager extends EventEmitter {
private burnVerifier;
private identities;
private publicKeyToIdentity;
private bannedIdentities;
private maturationPeriod;
constructor(chronikUrl: string | string[], maturationPeriod?: number);
registerIdentity(txId: string, outputIndex: number, publicKey: PublicKey, signature: Buffer): Promise<string | null>;
rotateKey(identityId: string, oldPublicKey: PublicKey, newPublicKey: PublicKey, oldKeySignature: Buffer, newKeySignature: Buffer, rotationBurnTxId: string, rotationBurnOutputIndex: number): Promise<boolean>;
getIdentity(identityId: string): SignerIdentity | undefined;
getIdentityByPublicKey(publicKey: string): SignerIdentity | undefined;
hasIdentity(identityId: string): boolean;
isBanned(identityId: string): boolean;
isAllowed(identityId: string, minReputation?: number): boolean;
verifyPublicKeyOwnership(identityId: string, publicKey: string): boolean;
recordSuccessfulSigning(identityId: string, responseTimeMs: number): void;
recordFailedSigning(identityId: string, reason: string): void;
getReputation(identityId: string): number;
getReputationData(identityId: string): IdentityReputation | undefined;
banIdentity(identityId: string, reason: string): void;
unbanIdentity(identityId: string): void;
getIdentityCount(): number;
getTotalBurned(): number;
getAllIdentities(): SignerIdentity[];
getIdentitiesWithMinReputation(minReputation: number): SignerIdentity[];
private verifySignature;
cleanup(): void;
shutdown(): void;
}
//# sourceMappingURL=identity-manager.d.ts.map