Open kfrancis opened 1 year ago
As simple as this?
if (Context.Instance.TryCreateECPrivKey(GenerateScalar(), out privKey))
{
var pubKey = privKey.CreateXOnlyPubKey();
Span<byte> privKeyc = stackalloc byte[65];
privKey.WriteToSpan(privKeyc);
var pubKeyStr = pubKey.ToBytes().ToHex();
var privKeyStr = privKeyc.ToHex()[..64];
}
Seems to work, though I'm having a hard time understanding the private key hex part.
if (Context.Instance.TryCreateECPrivKey(scalar, out privKey))
{
var pubKey = privKey.CreateXOnlyPubKey();
var pubKeyStr = ToHex(pubKey);
Span<byte> privKeyc = stackalloc byte[32];
privKey.WriteToSpan(privKeyc);
string hexString = BitConverter.ToString(privKeyc.ToArray()).Replace("-", "");
}
Based on nostr-NIP01:
What does that look like using this library? I tried using the portion from
test_ecdsa_end_to_end
but that gives me a key that is far too long, when I'm expecting something 64 bytes long.