Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestBody ¶
RequestBody represents the body of a request sent to an external validator.
type ResponseBody ¶
type ResponseBody struct {
Verified bool `json:"verified"`
Details string `json:"details"`
Nonce uint64 `json:"nonce"`
}
ResponseBody represents the body of the response from an external validator.
type Signature ¶
type Signature struct {
Sign []byte `json:"sign"`
}
Signature represents a digital signature of a signed message.
type SignedMessage ¶
type SignedMessage struct {
Body json.RawMessage `json:"body"`
Signature *Signature `json:"signature"`
}
SignedMessage represents a message with a digital signature.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is a utility that uses external validator to verify node structure.
For the correct operation, the Validator must be created using the constructor (New). After successful creation, the Validator is immediately ready to work through API.
func New ¶
func New(endpoint string, privateKey *keys.PrivateKey) *Validator
New creates a new instance of the Validator.
The created Validator does not require additional initialization and is completely ready for work.
func (*Validator) Verify ¶
Verify validates with an external validator by sending a request to the specified endpoint with the node information and its corresponding digital signature.
The external validator should be able to verify the node by using the public key from the signature and the node information in the request.
If the verification is successful, the method returns nil. Otherwise, the method returns an error describing the reason.