utils

package
v0.1.3-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindQueryParams

func BindQueryParams(context echo.Context, dest interface{}) error

func EnumExpression

func EnumExpression(value string) StringExpression

func GenerateOtp

func GenerateOtp() string

func GenerateUniqueId

func GenerateUniqueId() string

func GenerateUniqueWebhookSecret

func GenerateUniqueWebhookSecret(whatsappBusinessAccountId, organizationId, encryptionKey string) (string, error)

generateUniqueWebhookSecret returns an encrypted token that includes the WhatsAppBusinessAccountId and the organizationId. The token is opaque to external parties, but you can decrypt it internally to recover the data.

func GenerateWebsocketEventId

func GenerateWebsocketEventId() string

func IsValidEmail

func IsValidEmail(email string) bool

func ParsePhoneNumber

func ParsePhoneNumber(phoneNumber string) (*phonenumbers.PhoneNumber, error)

func ParseUlid

func ParseUlid(id string) uint64

Types

type WebhookSecretData

type WebhookSecretData struct {
	WhatsappBusinessAccountId string `json:"whatsapp_business_account_id"`
	OrganizationId            string `json:"organization_id"`
}

func DecryptWebhookSecret

func DecryptWebhookSecret(token, encryptionKey string) (*WebhookSecretData, error)

decryptWebhookSecret does the reverse of generateUniqueWebhookSecret. It takes the token (nonce + ciphertext in base64), decrypts it, and returns the WABA ID and Organization ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL