package pnet

import (
	"io"

	ipnet "github.com/libp2p/go-libp2p-interface-pnet"
)

func NewProtector(input io.Reader) (ipnet.Protector, error) {
	psk, err := decodeV1PSKKey(input)
	if err != nil {
		return nil, err
	}
	return &protector{psk}, nil
}

package pnet

import (
	"bytes"

	ipnet "github.com/libp2p/go-libp2p-interface-pnet"
)

func NewProtector(key []byte) (ipnet.Protector, error) {
	reader := bytes.NewReader(key)

	psk, err := decodeV1PSKKey(reader)
	if err != nil {
		return nil, err
	}
	return &protector{psk}, nil
}

Move from reader base ctor to bytestring based one
Move from reader base ctor to bytestring based one
