Documentation ¶
Index ¶
- Variables
- type Ack
- type AckRecord
- type AckRecordList
- type Code
- type IsRequest
- type Link
- type LogRecord
- type LogRecordList
- type Piece
- type Protobufable
- type Query
- type QueryRequest
- type ReadRequest
- type Request
- type Response
- type ResponsePiece
- type SearchResult
- type SearchedPiece
- type SessionStatus
- type SessionStatusRecord
- type Signature
- func (s *Signature) DecodedSigner() ([]byte, error)
- func (s *Signature) DecodedValue() ([]byte, error)
- func (s *Signature) MarshalProto() ([]byte, error)
- func (s *Signature) ToDomain(pbSignature *pb.Signature)
- func (s *Signature) ToProto() *pb.Signature
- func (s *Signature) UnmarshalProto(signatureAsBytes []byte) error
- type SignedPiece
- func (sp *SignedPiece) MarshalProto() ([]byte, error)
- func (sp *SignedPiece) Piece() *Piece
- func (sp *SignedPiece) PieceCid() (string, error)
- func (sp *SignedPiece) PieceSerial() []byte
- func (sp *SignedPiece) SetSignature(sig []byte)
- func (sp *SignedPiece) SigneableCid() (signeable []byte, pieceCid string, err error)
- func (sp *SignedPiece) ToDomain(pbSignedPiece *pb.SignedPiece) error
- func (sp *SignedPiece) ToProto() *pb.SignedPiece
- func (sp *SignedPiece) UnmarshalProto(signedPieceAsBytes []byte) error
- func (sp *SignedPiece) Verify() (string, []byte, error)
- type Tag
- type WriteRequest
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSignature = errors.New("invalid signature")
Functions ¶
This section is empty.
Types ¶
type Ack ¶ added in v0.1.4
type Ack struct { Timestamp *time.Time Gas uint64 PublicKey []byte Nonce []byte RequestId string SessionId []byte Cid string Signature []byte Schema string MultiHashType uint64 Chunks []string }
func (*Ack) MarshalProto ¶ added in v0.1.4
func (*Ack) UnmarshalProto ¶ added in v0.1.4
type AckRecord ¶ added in v0.1.4
func (*AckRecord) MarshalProto ¶ added in v0.1.4
func (*AckRecord) UnmarshalProto ¶ added in v0.1.4
type AckRecordList ¶ added in v0.1.4
type AckRecordList []*AckRecord
func (*AckRecordList) MarshalProto ¶ added in v0.1.4
func (a *AckRecordList) MarshalProto() ([]byte, error)
func (*AckRecordList) ToDomain ¶ added in v0.1.4
func (a *AckRecordList) ToDomain(records *pb.AckRecordList)
func (*AckRecordList) ToProto ¶ added in v0.1.4
func (a *AckRecordList) ToProto() *pb.AckRecordList
func (*AckRecordList) UnmarshalProto ¶ added in v0.1.4
func (a *AckRecordList) UnmarshalProto(bytes []byte) error
type Code ¶ added in v0.1.4
const ( Code_SUCCESS Code = 0 Code_CREATED Code = 1 Code_NOT_FOUND Code = 2 Code_FAILED_READ_BODY Code = 3 Code_FAILED_UNMARSHAL_BODY Code = 4 Code_FAILED_MARSHAL_BODY Code = 5 Code_FAILED_GET_BLOCKCHAIN_DATA Code = 6 Code_BUCKET_RENT_EXPIRED Code = 7 Code_INVALID_PUBLIC_KEY Code = 8 Code_INVALID_SIGNATURE Code = 9 Code_INVALID_PARAMETER Code = 10 Code_BUCKET_NO_ACCESS Code = 11 Code_INTERNAL_ERROR Code = 12 Code_BAD_GATEWAY Code = 13 Code_INVALID_SESSION_ID Code = 14 Code_ACCOUNT_DEPOSIT_REQUIRED Code = 15 Code_GAS_EXPIRED Code = 16 Code_REQUEST_TOO_LARGE Code = 17 )
type IsRequest ¶ added in v0.1.4
type IsRequest interface {
// contains filtered or unexported methods
}
type LogRecord ¶ added in v0.1.4
type LogRecord struct { Request IsRequest Timestamp *time.Time Address string Gas uint32 PublicKey []byte SessionId []byte RequestId string Signature *Signature ResponsePieces []*ResponsePiece }
func (*LogRecord) MarshalProto ¶ added in v0.1.4
func (*LogRecord) UnmarshalProto ¶ added in v0.1.4
type LogRecordList ¶ added in v0.1.4
type LogRecordList []*LogRecord
func (*LogRecordList) MarshalProto ¶ added in v0.1.4
func (l *LogRecordList) MarshalProto() ([]byte, error)
func (*LogRecordList) ToDomain ¶ added in v0.1.4
func (l *LogRecordList) ToDomain(pbLogRecordList *pb.LogRecordList)
func (*LogRecordList) ToProto ¶ added in v0.1.4
func (l *LogRecordList) ToProto() *pb.LogRecordList
func (*LogRecordList) UnmarshalProto ¶ added in v0.1.4
func (l *LogRecordList) UnmarshalProto(logRecordAsBytes []byte) error
type Protobufable ¶
type QueryRequest ¶ added in v0.1.4
type QueryRequest struct {
Query *Query
}
type ReadRequest ¶ added in v0.1.4
type Request ¶ added in v0.1.4
type Request struct { Body []byte PublicKey []byte Signature []byte Scheme string MultiHashType uint64 SessionId []byte }
func (*Request) MarshalProto ¶ added in v0.1.4
func (*Request) UnmarshalProto ¶ added in v0.1.4
type Response ¶ added in v0.1.4
type Response struct { Body []byte PublicKey []byte Signature []byte Scheme string Gas uint32 ResponseCode Code MultiHashType uint64 }
func (*Response) MarshalProto ¶ added in v0.1.4
func (*Response) UnmarshalProto ¶ added in v0.1.4
type ResponsePiece ¶ added in v0.1.6
type SearchResult ¶
type SearchResult struct {
SearchedPieces []*SearchedPiece
}
func (*SearchResult) MarshalProto ¶
func (sr *SearchResult) MarshalProto() ([]byte, error)
func (*SearchResult) ToDomain ¶
func (sr *SearchResult) ToDomain(pbSearchResult *pb.SearchResult) error
func (*SearchResult) ToProto ¶
func (sr *SearchResult) ToProto() *pb.SearchResult
func (*SearchResult) UnmarshalProto ¶
func (sr *SearchResult) UnmarshalProto(searchResultAsBytes []byte) error
type SearchedPiece ¶ added in v0.1.3
type SearchedPiece struct { SignedPiece *SignedPiece Cid string }
func (*SearchedPiece) MarshalProto ¶ added in v0.1.3
func (sp *SearchedPiece) MarshalProto() ([]byte, error)
func (*SearchedPiece) ToDomain ¶ added in v0.1.3
func (sp *SearchedPiece) ToDomain(pbSearchPiece *pb.SearchedPiece) error
func (*SearchedPiece) ToProto ¶ added in v0.1.3
func (sp *SearchedPiece) ToProto() *pb.SearchedPiece
func (*SearchedPiece) UnmarshalProto ¶ added in v0.1.3
func (sp *SearchedPiece) UnmarshalProto(searchedPieceAsBytes []byte) error
type SessionStatus ¶ added in v0.1.4
type SessionStatus struct { PublicKey []byte Gas uint32 SessionId []byte EndOfEpoch uint64 BucketId uint32 }
func (*SessionStatus) MarshalProto ¶ added in v0.1.4
func (s *SessionStatus) MarshalProto() ([]byte, error)
func (*SessionStatus) ToDomain ¶ added in v0.1.4
func (s *SessionStatus) ToDomain(pbSessionStatus *pb.SessionStatus)
func (*SessionStatus) ToProto ¶ added in v0.1.4
func (s *SessionStatus) ToProto() *pb.SessionStatus
func (*SessionStatus) UnmarshalProto ¶ added in v0.1.4
func (s *SessionStatus) UnmarshalProto(bytes []byte) error
type SessionStatusRecord ¶ added in v0.1.4
type SessionStatusRecord struct { SessionStatus *SessionStatus PublicKey []byte Signature []byte Timestamp uint64 }
func (*SessionStatusRecord) MarshalProto ¶ added in v0.1.4
func (s *SessionStatusRecord) MarshalProto() ([]byte, error)
func (*SessionStatusRecord) ToDomain ¶ added in v0.1.4
func (s *SessionStatusRecord) ToDomain(pbSessionStatusRecord *pb.SessionStatusRecord)
func (*SessionStatusRecord) ToProto ¶ added in v0.1.4
func (s *SessionStatusRecord) ToProto() *pb.SessionStatusRecord
func (*SessionStatusRecord) UnmarshalProto ¶ added in v0.1.4
func (s *SessionStatusRecord) UnmarshalProto(bytes []byte) error
type Signature ¶
type Signature struct { Value []byte Signer []byte Scheme string MultiHashType uint64 Timestamp uint64 }
func (*Signature) DecodedSigner ¶ added in v0.1.4
func (*Signature) DecodedValue ¶ added in v0.1.4
func (*Signature) MarshalProto ¶
func (*Signature) UnmarshalProto ¶
type SignedPiece ¶
type SignedPiece struct { Signature *Signature // contains filtered or unexported fields }
## Generation of a SignedPiece:
1. Prepare a `Piece` structure and its ProtoBuf serialization. 2. Prepare a `Signature` structure with its details except `Value`. 3. Pass those to `NewSignedPiece(…)`. 4. Use `SigneableCid()` to generate a signeable message, and a CID of the piece. 5. Generate a signature of the `signeable` message using `crypto.CreateScheme(…)`. 6. Store the signature with `SetSignature()`. 7. Serialize the SignedPiece with `MarshalProto()` for transmission or storage. 8. Use the CID above as a permanent identifier of the piece.
## Verification of a SignedPiece:
1. Deserialize using `UnmarshalProto()`. 2. Call `Verify()`. 3. If the piece is to be forwarded or stored, use the original serialization (do not re-serialize).
func NewSignedPiece ¶ added in v0.1.4
func NewSignedPiece(piece *Piece, pieceSerial []byte, sig *Signature) *SignedPiece
func (*SignedPiece) MarshalProto ¶
func (sp *SignedPiece) MarshalProto() ([]byte, error)
func (*SignedPiece) Piece ¶
func (sp *SignedPiece) Piece() *Piece
func (*SignedPiece) PieceCid ¶ added in v0.1.4
func (sp *SignedPiece) PieceCid() (string, error)
func (*SignedPiece) PieceSerial ¶ added in v0.1.4
func (sp *SignedPiece) PieceSerial() []byte
func (*SignedPiece) SetSignature ¶ added in v0.1.4
func (sp *SignedPiece) SetSignature(sig []byte)
func (*SignedPiece) SigneableCid ¶ added in v0.1.4
func (sp *SignedPiece) SigneableCid() (signeable []byte, pieceCid string, err error)
func (*SignedPiece) ToDomain ¶
func (sp *SignedPiece) ToDomain(pbSignedPiece *pb.SignedPiece) error
func (*SignedPiece) ToProto ¶
func (sp *SignedPiece) ToProto() *pb.SignedPiece
func (*SignedPiece) UnmarshalProto ¶
func (sp *SignedPiece) UnmarshalProto(signedPieceAsBytes []byte) error
type Tag ¶
type Tag struct { Key []byte Value []byte Searchable pb.SearchType }