diff --git a/tests/testlib/wakucore.nim b/tests/testlib/wakucore.nim index 92e470bee..fd05010c2 100644 --- a/tests/testlib/wakucore.nim +++ b/tests/testlib/wakucore.nim @@ -22,17 +22,17 @@ proc ts*(offset = 0, origin = now()): Timestamp = # Switch proc generateEcdsaKey*(): libp2p_keys.PrivateKey = - # libp2p v2.0.0 also exports a `rng` symbol (returns the new `Rng` wrapper), - # so the unqualified `rng[]` here is ambiguous against our local - # `common.rng` template. Qualify explicitly to keep using the - # `ref HmacDrbgContext` that `PrivateKey.random` expects. - libp2p_keys.PrivateKey.random(ECDSA, common.rng()[]).get() + # libp2p v2.0.0's 3-arg `random(T, scheme, rng)` overload now takes the + # `Rng` wrapper instead of `var HmacDrbgContext`. Wrap our existing + # `ref HmacDrbgContext` (from `common.rng`) via `newBearSslRng` to satisfy + # the new signature without re-seeding a fresh PRNG each call. + libp2p_keys.PrivateKey.random(ECDSA, newBearSslRng(common.rng())).get() proc generateEcdsaKeyPair*(): libp2p_keys.KeyPair = - libp2p_keys.KeyPair.random(ECDSA, common.rng()[]).get() + libp2p_keys.KeyPair.random(ECDSA, newBearSslRng(common.rng())).get() proc generateSecp256k1Key*(): libp2p_keys.PrivateKey = - libp2p_keys.PrivateKey.random(Secp256k1, common.rng()[]).get() + libp2p_keys.PrivateKey.random(Secp256k1, newBearSslRng(common.rng())).get() proc ethSecp256k1Key*(hex: string): eth_keys.PrivateKey = eth_keys.PrivateKey.fromHex(hex).get()