Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateAesKey(peerAddr SubAddr, key ed25519.PrivateKey) ([]byte, error)
- func PrivateKeyToCurve25519(curve25519Private *[32]byte, privateKey *[64]byte)
- func PublicKeyToCurve25519(curve25519Public *[32]byte, publicKey *[32]byte) bool
- func SubAddrToPub(a SubAddr) (ed25519.PublicKey, error)
- func VerifyBySub(msg, sig []byte, addr SubAddr) bool
- type SubAddr
- type SubKey
- func (k *SubKey) Addr() string
- func (k *SubKey) Encrypt(auth string) ([]byte, error)
- func (k *SubKey) GetPrivate() []byte
- func (k *SubKey) IDStr() string
- func (k *SubKey) IsOpen() bool
- func (k *SubKey) PriLen() int
- func (k *SubKey) SharedKey(peer string) ([]byte, error)
- func (k *SubKey) SignData(v []byte) []byte
- func (k *SubKey) StoreString(auth string) string
Constants ¶
View Source
const ( SubAddressLen = 32 SubAddrPrefix = "NJ" )
Variables ¶
View Source
var (
ErrInvalidAddr = fmt.Errorf("invalid sub address")
)
Functions ¶
func GenerateAesKey ¶
func GenerateAesKey(peerAddr SubAddr, key ed25519.PrivateKey) ([]byte, error)
func PrivateKeyToCurve25519 ¶
func PublicKeyToCurve25519 ¶
func VerifyBySub ¶
Types ¶
type SubAddr ¶
type SubAddr [SubAddressLen]byte
func HexToSubAddr ¶
func PubKeyToSubAddr ¶
func (*SubAddr) MarshalText ¶
func (*SubAddr) UnmarshalJSON ¶
type SubKey ¶
type SubKey struct { ID uuid.UUID Light bool Address SubAddr // contains filtered or unexported fields }
func LoadSubKeyFromJsonStr ¶
func NewLightSubKey ¶
func (*SubKey) GetPrivate ¶
func (*SubKey) StoreString ¶
Click to show internal directories.
Click to hide internal directories.