MCPcopy Create free account
hub / github.com/encodeous/nylon / GenerateKey

Function GenerateKey

state/crypto.go:12–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10type NyPublicKey [device.NoisePublicKeySize]byte
11
12func GenerateKey() NyPrivateKey {
13 key := make([]byte, device.NoisePrivateKeySize)
14
15 if _, err := rand.Read(key); err != nil {
16 panic(err)
17 }
18
19 // Modify random bytes using algorithm described at:
20 // https://cr.yp.to/ecdh.html.
21 key[0] &= 248
22 key[31] &= 127
23 key[31] |= 64
24 return NyPrivateKey(key)
25}
26
27func (k NyPrivateKey) Pubkey() NyPublicKey {
28 val, err := x25519.PrivateKey(k[:]).PublicKey()

Callers 15

NewNodeMethod · 0.92
utils.goFile · 0.92
TestRecoveryExampleFunction · 0.92
TestJSONLoggingFunction · 0.92
TestConnectivityFunction · 0.92
TestPassiveRoamingFunction · 0.92
TestDistributionFunction · 0.92
TestHealthcheckPingFunction · 0.92
TestHealthcheckHTTPFunction · 0.92

Calls 2

NyPrivateKeyTypeAlias · 0.85
ReadMethod · 0.65

Tested by 15

TestRecoveryExampleFunction · 0.74
TestJSONLoggingFunction · 0.74
TestConnectivityFunction · 0.74
TestPassiveRoamingFunction · 0.74
TestDistributionFunction · 0.74
TestHealthcheckPingFunction · 0.74
TestHealthcheckHTTPFunction · 0.74
TestEndpointResolutionFunction · 0.74
TestDynamicResolutionFunction · 0.74