Documentation ¶
Index ¶
- Variables
- func EncodeOrder(order *pb.Order2) ([]byte, error)
- func EncodeOrderLimit(limit *pb.OrderLimit2) ([]byte, error)
- func EncodePieceHash(hash *pb.PieceHash) ([]byte, error)
- func SignOrder(uplink Signer, unsigned *pb.Order2) (*pb.Order2, error)
- func SignOrderLimit(satellite Signer, unsigned *pb.OrderLimit2) (*pb.OrderLimit2, error)
- func SignPieceHash(signer Signer, unsigned *pb.PieceHash) (*pb.PieceHash, error)
- func VerifyOrderLimitSignature(satellite Signee, signed *pb.OrderLimit2) error
- func VerifyOrderSignature(uplink Signee, signed *pb.Order2) error
- func VerifyPieceHashSignature(signee Signee, signed *pb.PieceHash) error
- type PrivateKey
- type PublicKey
- type Signee
- type Signer
Constants ¶
This section is empty.
Variables ¶
var Error = errs.Class("signing")
Error is the default error class for signing package.
Functions ¶
func EncodeOrder ¶
EncodeOrder encodes order into bytes for signing.
func EncodeOrderLimit ¶
func EncodeOrderLimit(limit *pb.OrderLimit2) ([]byte, error)
EncodeOrderLimit encodes order limit into bytes for signing.
func EncodePieceHash ¶
EncodePieceHash encodes piece hash into bytes for signing.
func SignOrderLimit ¶
func SignOrderLimit(satellite Signer, unsigned *pb.OrderLimit2) (*pb.OrderLimit2, error)
SignOrderLimit signs the order limit using the specified signer. Signer is a satellite.
func SignPieceHash ¶
SignPieceHash signs the piece hash using the specified signer. Signer is either uplink or storage node.
func VerifyOrderLimitSignature ¶
func VerifyOrderLimitSignature(satellite Signee, signed *pb.OrderLimit2) error
VerifyOrderLimitSignature verifies that the signature inside order limit belongs to the satellite.
func VerifyOrderSignature ¶
VerifyOrderSignature verifies that the signature inside order belongs to the uplink.
Types ¶
type PrivateKey ¶
type PrivateKey struct { Self storj.NodeID Key crypto.PrivateKey }
PrivateKey implements a signer and signee using a crypto.PrivateKey.
func (*PrivateKey) HashAndSign ¶
func (private *PrivateKey) HashAndSign(data []byte) ([]byte, error)
HashAndSign hashes the data and signs with the used key.
func (*PrivateKey) HashAndVerifySignature ¶
func (private *PrivateKey) HashAndVerifySignature(data, signature []byte) error
HashAndVerifySignature hashes the data and verifies that the signature belongs to the PrivateKey.
func (*PrivateKey) ID ¶
func (private *PrivateKey) ID() storj.NodeID
ID returns node id associated with PrivateKey.
type PublicKey ¶
PublicKey implements a signee using crypto.PublicKey.
func (*PublicKey) HashAndVerifySignature ¶
HashAndVerifySignature hashes the data and verifies that the signature belongs to the PublicKey.
type Signee ¶
Signee is able to verify that the data signature belongs to the signee.
func SigneeFromPeerIdentity ¶
func SigneeFromPeerIdentity(identity *identity.PeerIdentity) Signee
SigneeFromPeerIdentity returns signee based on peer identity.
type Signer ¶
type Signer interface { ID() storj.NodeID HashAndSign(data []byte) ([]byte, error) HashAndVerifySignature(data, signature []byte) error }
Signer is able to sign data and verify own signature belongs.
func SignerFromFullIdentity ¶
func SignerFromFullIdentity(identity *identity.FullIdentity) Signer
SignerFromFullIdentity returns signer based on full identity.