mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2026-01-10 00:28:10 -05:00
Rename getKey -> getPublicKey (#621)
* rename getKey to getPublicKey * use publicKey directly in gossipsub * update error messages
This commit is contained in:
@@ -602,11 +602,9 @@ proc new*(
|
||||
outgoing: bool = true,
|
||||
commonPrologue: seq[byte] = @[]): T =
|
||||
|
||||
let pkBytes = privateKey
|
||||
.getKey()
|
||||
let pkBytes = privateKey.getPublicKey()
|
||||
.expect("Expected valid Private Key")
|
||||
.getBytes()
|
||||
.expect("Couldn't get Private Key bytes")
|
||||
.getBytes().expect("Couldn't get public Key bytes")
|
||||
|
||||
var noise = Noise(
|
||||
rng: rng,
|
||||
|
||||
@@ -435,16 +435,14 @@ proc new*(
|
||||
T: typedesc[Secio],
|
||||
rng: ref BrHmacDrbgContext,
|
||||
localPrivateKey: PrivateKey): T =
|
||||
let pkRes = localPrivateKey.getKey()
|
||||
let pkRes = localPrivateKey.getPublicKey()
|
||||
if pkRes.isErr:
|
||||
raise newException(Defect, "Can't fetch local private key")
|
||||
raise newException(Defect, "Invalid private key")
|
||||
|
||||
let secio = Secio(
|
||||
rng: rng,
|
||||
localPrivateKey: localPrivateKey,
|
||||
localPublicKey: localPrivateKey
|
||||
.getKey()
|
||||
.expect("Can't fetch local private key"),
|
||||
localPublicKey: pkRes.get(),
|
||||
)
|
||||
secio.init()
|
||||
secio
|
||||
|
||||
Reference in New Issue
Block a user