Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Secret is the secret key used to verify the token. // This is required. Secret string // BackupSecret is the backup secret key used to verify the token. // This is optional. BackupSecret string // Timeout is the timeout for the service. // This is optional. // Default: 10 seconds Timeout time.Duration }
Config is the configuration for the service.
type Service ¶
type Service interface { // Verify is used to verify the token. // It returns true if the token is valid. // It returns false if the token is invalid. // It returns an error if there was an error verifying the token. Verify(ctx context.Context, token string, ip string) (bool, error) // VerifyIdempotent is used to verify the token. // The key parameter is used to ensure idempotency. // You may use the RandomUUID method to generate a random UUID. // It returns true if the token is valid. // It returns false if the token is invalid. // It returns an error if there was an error verifying the token. VerifyIdempotent(ctx context.Context, token string, ip string, key string) (bool, error) // VerifyBackup is used to verify the token. // It returns true if the token is valid. // It returns false if the token is invalid. // It returns an error if there was an error verifying the token. VerifyBackup(ctx context.Context, token string, ip string) (bool, error) // VerifyBackupIdempotent is used to verify the token. // The key parameter is used to ensure idempotency. // You may use the RandomUUID method to generate a random UUID. // It returns true if the token is valid. // It returns false if the token is invalid. // It returns an error if there was an error verifying the token. VerifyBackupIdempotent(ctx context.Context, token string, ip string, key string) (bool, error) // RandomUUID is used to generate a random UUID. // It returns a random UUID. RandomUUID() string }
Service is the interface for the service. It is used to verify the token. It is also used to generate a random UUID.
Click to show internal directories.
Click to hide internal directories.