import { TSMap } from 'typescript-map' ; import RadixIdentity from './RadixIdentity' ; import RadixSimpleIdentity from './RadixSimpleIdentity' ; import RadixRemoteIdentity from './RadixRemoteIdentity' ; import { RadixAddress } from '../atommodel' ; import { radixHash } from '../common/RadixUtil' ; export default class RadixIdentityManager { public identities : TSMap < string , RadixIdentity > = new TSMap ( ) ; returns public generateSimpleIdentity ( ) { const address = RadixAddress . generateNew ( ) ; const identity = new RadixSimpleIdentity ( address ) ; this . identities . set ( address . getAddress ( ) , identity ) ; return identity ; } param seed returns public generateSimpleIdentityFromSeed ( seed ) { const hash = radixHash ( seed ) ; const address = RadixAddress . fromPrivate ( hash ) ; const identity = new RadixSimpleIdentity ( address ) ; this . identities . set ( address . getAddress ( ) , identity ) ; return identity ; } param address returns public addSimpleIdentity ( address ) { const identity = new RadixSimpleIdentity ( address ) ; this . identities . set ( address . getAddress ( ) , identity ) ; return identity ; } param name param description param host param port returns public async generateRemoteIdentity ( name , description , permissions , host , port ) { try { return await RadixRemoteIdentity . createNew ( name , description , permissions , host , port ) ; } catch ( error ) { throw error ; } } returns public addIdentity ( identity ) { this . identities . set ( identity . account . getAddress ( ) , identity ) ; return identity ; } }