-type OOBState struct {
- c *ycore.Core
- subnet yaddr.Subnet
-}
-
-func (state *OOBState) Handler(fromKey, toKey ed25519.PublicKey, data []byte) {
- if len(data) != 1+ed25519.SignatureSize {
- return
- }
- if data[0] == typeKeyLookup {
- snet := *yaddr.SubnetForKey(toKey)
- sig := data[1:]
- if snet == state.subnet && ed25519.Verify(fromKey, toKey[:], sig) {
- state.c.SendOutOfBand(fromKey, append(
- []byte{typeKeyResponse},
- ed25519.Sign(state.c.PrivateKey(), fromKey[:])...,
- ))
- }
- }
-}
-