mirror of
https://github.com/logos-messaging/nim-chat-poc.git
synced 2026-02-04 14:13:11 +00:00
31 lines
627 B
Nim
31 lines
627 B
Nim
|
|
import crypto
|
|
import utils
|
|
|
|
|
|
type
|
|
Identity* = object
|
|
name: string
|
|
keypair: KeyPair
|
|
|
|
|
|
#################################################
|
|
# Constructors
|
|
#################################################
|
|
|
|
proc createIdentity*(name: string): Identity =
|
|
let keypair = generate_keypair()
|
|
result = Identity(name: name, keypair: keypair)
|
|
|
|
|
|
#################################################
|
|
# Parameter Access
|
|
#################################################
|
|
|
|
proc getAddr*(self: Identity): string =
|
|
result = get_addr(self.keypair.pubkey)
|
|
|
|
|
|
proc getPubkey*(self: Identity): SkPublicKey =
|
|
result = self.keypair.pubkey
|