Documentation
¶
Index ¶
- Constants
- func ExtractParams(payload Payload) url.Values
- func VerifyFieldsHash(formData map[string][]string, fields []string, fieldsHash string, ...) (bool, error)
- func VerifySolution(payload interface{}, hmacKey string, checkExpires bool) (bool, error)
- type Algorithm
- type Challenge
- type ChallengeOptions
- type Payload
- type ServerSignaturePayload
- type ServerSignatureVerificationData
- type Solution
Constants ¶
View Source
const ( DefaultMaxNumber int64 = 1e6 DefaultSaltLength int = 12 DefaultAlgorithm = SHA256 )
Variables ¶
This section is empty.
Functions ¶
func ExtractParams ¶
Extracts parameters from the payload
Types ¶
type Challenge ¶
type Challenge struct { Algorithm string `json:"algorithm"` Challenge string `json:"challenge"` MaxNumber int64 `json:"maxNumber"` Salt string `json:"salt"` Signature string `json:"signature"` }
Challenge represents a challenge for the client to solve
func CreateChallenge ¶
func CreateChallenge(options ChallengeOptions) (Challenge, error)
Creates a challenge for the client to solve
type ChallengeOptions ¶
type ChallengeOptions struct { Algorithm Algorithm MaxNumber int64 SaltLength int HMACKey string Salt string Number int64 Expires *time.Time Params url.Values }
ChallengeOptions defines the options for creating a challenge
type Payload ¶ added in v0.1.2
type Payload struct { Algorithm string `json:"algorithm"` Challenge string `json:"challenge"` Number int64 `json:"number"` Salt string `json:"salt"` Signature string `json:"signature"` }
Payload represents a solution to a Challenge
type ServerSignaturePayload ¶
type ServerSignaturePayload struct { Algorithm Algorithm `json:"algorithm"` VerificationData string `json:"verificationData"` Signature string `json:"signature"` Verified bool `json:"verified"` }
ServerSignaturePayload represents the structure of the payload for server signature verification
type ServerSignatureVerificationData ¶
type ServerSignatureVerificationData struct { Classification string `json:"classification"` Country string `json:"country"` DetectedLanguage string `json:"detectedLanguage"` Email string `json:"email"` Expire int64 `json:"expire"` Fields []string `json:"fields"` FieldsHash string `json:"fieldsHash"` IpAddress string `json:"ipAddress"` Reasons []string `json:"reasons"` Score float64 `json:"score"` Time int64 `json:"time"` Verified bool `json:"verified"` }
ServerSignatureVerificationData represents the extracted verification data
func VerifyServerSignature ¶
func VerifyServerSignature(payload interface{}, hmacKey string) (bool, ServerSignatureVerificationData, error)
VerifyServerSignature verifies the server's signature
Click to show internal directories.
Click to hide internal directories.