Documentation ¶
Index ¶
- type Postback
- type PostbackValidator
- func (v *PostbackValidator) Check() (bool, error)
- func (v *PostbackValidator) Errors() []ValidationError
- func (v *PostbackValidator) Init(bytes []byte) error
- func (v *PostbackValidator) Validate(bytes []byte) (bool, error)
- func (v *PostbackValidator) ValidateString(s string) (bool, error)
- func (v *PostbackValidator) VersionSupported() (bool, error)
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Postback ¶
type Postback struct {
// contains filtered or unexported fields
}
func NewPostback ¶
NewPostback returns a new postback from given JSON bytes presentation
func NewPostbackFromString ¶
NewPostbackFromString returns a new postback from JSON string presentation
func (Postback) ValidateSchema ¶
func (p Postback) ValidateSchema() (bool, []ValidationError, error)
ValidateSchema checks the postback structure using JSON schema. Returns a slice of validation errors, which is empty if the postback is valid. Returns an error if the validation itself has failed.
func (Postback) VerifySignature ¶
VerifySignature verifies the postback cryptographic signature. Returns an error if the version is not supported or the signature has an invalid format.
type PostbackValidator ¶
type PostbackValidator struct {
// contains filtered or unexported fields
}
func NewPostbackValidator ¶
func NewPostbackValidator() PostbackValidator
NewPostbackValidator returns a new validator for SKAdNetwork postbacks.
func (*PostbackValidator) Check ¶ added in v0.1.2
func (v *PostbackValidator) Check() (bool, error)
Check performs all actual checks: schema validation and signature verification
func (*PostbackValidator) Errors ¶
func (v *PostbackValidator) Errors() []ValidationError
Errors returns all validation errors found by [Validate]. Calling this function does not reset the errors, but they will be reset on a subsequent calls to [Validate].
func (*PostbackValidator) Init ¶ added in v0.1.2
func (v *PostbackValidator) Init(bytes []byte) error
func (*PostbackValidator) Validate ¶
func (v *PostbackValidator) Validate(bytes []byte) (bool, error)
Validate performs all validations for a given postback presented as JSON bytes:
- checks if the postback version is supported by the validator
- runs all checks
Validate returns the validation result and an error. Non-nil error indicates that the validation itself has failed and we are not sure if the postback is valid or not.
func (*PostbackValidator) ValidateString ¶
func (v *PostbackValidator) ValidateString(s string) (bool, error)
ValidateString validates given postback presented as JSON string.
func (*PostbackValidator) VersionSupported ¶ added in v0.1.2
func (v *PostbackValidator) VersionSupported() (bool, error)
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
func NewValidationError ¶ added in v0.1.1
func NewValidationError(msg string) ValidationError
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string