Documentation ¶
Overview ¶
Package vkapps for VK Mini Apps.
See more https://vk.com/dev/vk_apps_docs
Index ¶
Examples ¶
Constants ¶
View Source
const (
ClientOk = "ok"
)
Possible values.
Variables ¶
This section is empty.
Functions ¶
func ParamsVerify ¶
ParamsVerify verifies the signature in link using client secret.
Example ¶
package main import ( "fmt" "github.com/error-ident/vksdk/v2/vkapps" ) func main() { link := "https://example.com/?vk_user_id=494075&vk_app_id=6736218&vk_is_app_user=1&vk_are_notifications_enabled=1&vk_language=ru&vk_access_token_settings=&vk_platform=android&sign=htQFduJpLxz7ribXRZpDFUH-XEUhC9rBPTJkjUFEkRA" v, _ := vkapps.ParamsVerify(link, "wvl68m4dR1UpLrVRli") fmt.Println(v) }
Output: true
Types ¶
type Params ¶
type Params struct { VkUserID int `schema:"vk_user_id"` VkAppID int `schema:"vk_app_id"` VkIsAppUser bool `schema:"vk_is_app_user"` VkAreNotificationsEnabled bool `schema:"vk_are_notifications_enabled"` VkIsFavorite bool `schema:"vk_is_favorite"` VkLanguage string `schema:"vk_language"` VkRef Referral `schema:"vk_ref"` VkAccessTokenSettings string `schema:"vk_access_token_settings"` VkGroupID int `schema:"vk_group_id"` VkViewerGroupRole Role `schema:"vk_viewer_group_role"` VkPlatform Platform `schema:"vk_platform"` VkTs string `schema:"vk_ts"` VkClient Client `schema:"vk_client"` Sign string `schema:"sign"` }
Params service launch parameters.
type ParamsVerification ¶
type ParamsVerification struct {
ClientSecret string
}
ParamsVerification represents verification struct.
Example ¶
package main import ( "fmt" "net/url" "github.com/error-ident/vksdk/v2/vkapps" ) func main() { link := "https://example.com/?vk_user_id=494075&vk_app_id=6736218&vk_is_app_user=1&vk_are_notifications_enabled=1&vk_language=ru&vk_access_token_settings=&vk_platform=android&sign=htQFduJpLxz7ribXRZpDFUH-XEUhC9rBPTJkjUFEkRA" pv := vkapps.NewParamsVerification("wvl68m4dR1UpLrVRli") // Client secret u, _ := url.Parse(link) v, _ := pv.Verify(u) fmt.Println(v) }
Output: true
func NewParamsVerification ¶
func NewParamsVerification(clientSecret string) *ParamsVerification
NewParamsVerification return *ParamsVerification.
func (*ParamsVerification) Sign ¶
func (pv *ParamsVerification) Sign(p []byte) string
Sign return signature in base64.
func (*ParamsVerification) Verify ¶
func (pv *ParamsVerification) Verify(u *url.URL) (bool, error)
Verify verifies the signature in URL.
func (*ParamsVerification) VerifyMiddleware ¶
func (pv *ParamsVerification) VerifyMiddleware(next http.Handler) http.Handler
VerifyMiddleware func.
type Referral ¶
type Referral string
Referral source.
const ( Catalog Referral = "catalog" CatalogRecent Referral = "catalog_recent" CatalogFavourites Referral = "catalog_favourites" CatalogRecommendation Referral = "catalog_recommendation" CatalogTopDau Referral = "catalog_top_dau" CatalogEntertainment Referral = "catalog_entertainment" CatalogCommunication Referral = "catalog_communication" CatalogTools Referral = "catalog_tools" CatalogShopping Referral = "catalog_shopping" CatalogEvents Referral = "catalog_events" CatalogEducation Referral = "catalog_education" CatalogPayments Referral = "catalog_payments" CatalogFinance Referral = "catalog_finance" CatalogFood Referral = "catalog_food" CatalogHealth Referral = "catalog_health" CatalogTravel Referral = "catalog_travel" CatalogTaxi Referral = "catalog_taxi" CatalogJobs Referral = "catalog_jobs" CatalogRealty Referral = "catalog_realty" CatalogBusiness Referral = "catalog_business" CatalogLifestyle Referral = "catalog_lifestyle" CatalogAdmin Referral = "catalog_admin" BoardTopicAll Referral = "board_topic_all" BoardTopicView Referral = "board_topic_view" Feed Referral = "feed" FeedPost Referral = "feed_post" FeedComments Referral = "feed_comments" FeaturingDiscover Referral = "featuring_discover" FeaturingMenu Referral = "featuring_menu" FeaturingNew Referral = "featuring_new" Fave Referral = "fave" FaveLinks Referral = "fave_links" FavePosts Referral = "fave_posts" Group Referral = "group" GroupMenu Referral = "group_menu" GroupMessages Referral = "group_messages" GroupAddresses Referral = "group_addresses" SnippetPost Referral = "snippet_post" SnippetIm Referral = "snippet_im" Clips Referral = "clips" CommentsListClip Referral = "comments_list_clip" Im Referral = "im" ImChat Referral = "im_chat" Notifications Referral = "notifications" NotificationsGrouped Referral = "notifications_grouped" NotificationsAuto Referral = "notifications_auto" SuperApp Referral = "super_app" HomeScreen Referral = "home_screen" Menu Referral = "menu" SnippedPost Referral = "snipped_post" Story Referral = "story" StoryReply Referral = "story_reply" StoryViewer Referral = "story_viewer" Profile Referral = "profile" ArticleRead Referral = "article_read" MusicPlaylist Referral = "music_playlist" VideoCarousel Referral = "video_carousel" PhotoBrowser Referral = "photo_browser" ShoppingCenter Referral = "shopping_center" MarketItem Referral = "market_item" QuickSearch Referral = "quick_search" Widget Referral = "widget" Other Referral = "other" Showcase Referral = "showcase" )
Possible values.
Click to show internal directories.
Click to hide internal directories.