package
0.11.1
Repository: https://github.com/cosmotek/api-commons.git
Documentation: pkg.go.dev

# Functions

ConsumeMagicLink marks a link as "consumed" in the database.
CreateMagicLink creates the database records later used for magic link verification and returns a generated url which may be emailed to a user.
CreateSMSPincode creates a pincode and pincode record, writing the record to the database, and returning the pincode, as well as recordId to the caller (ordered id, pincode, error).
DeleteSMSPincode removes a pincode record from the database.
GenerateAlphaNumericCode generates a alpha-numeric pincode of the provided length for use in Email verification.
GenerateMagicLinkEmailHTML generates an HTML email from template using provided recipient/sender information returning the HTML string.
GenerateNumericPincode generates a numeric pincode of the provided length for use in SMS verification.
SendHTMLEmail generates and sends an email using the provided HTML string, returning the sender email (with formatted name included).
SendSMSPincode sends a pincode verification text using the template string included internally in this package and the provided pincode string.
VerifyMagicLink searches the database for a magic link with the matching requestId, email and verification code.
VerifySMSPincode searches for records in the database with the matching pincode and phoneNumber, checks if the record has expired and returns the requestId or ErrSMSPincodeExpired.

# Variables

ErrMagicLinkConsumed is an error returned when someone attempts to login (verify) with a consumed magic link.
ErrMagicLinkExpired is an error returned when someone attempts to login (verify) with a expired magic link.
ErrSMSPincodeExpires is an error returned by the verify function if a pincode has expired.

# Structs

MagicLinkEmailParams is used to store template data for template execution (required by the template library).