import { IdentityApi } from '../api/identity'; import { OntIdAttribute, OntIdDDO } from '../api/types'; import { Rpc } from '../rpc/rpc'; export class IdentityApiImp implements IdentityApi { private rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; } getIdentity() { return this.rpc.call('identity.getIdentity'); } getDDO(args: { identity: string }) { return this.rpc.call('identity.getDDO', args); } addAttributes(args: { attributes: OntIdAttribute[] }) { return this.rpc.call('identity.addAttributes', args); } removeAttribute(args: { key: string }) { return this.rpc.call('identity.removeAttribute', args); } addCredential(args: { tags: string[], credential: string }) { return this.rpc.call('identity.addCredential', args); } getCredentials() { return this.rpc.call>('identity.getCredentials'); } }