Skip to content

fident/go-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-web

Go SDK for Fident web projects

import gofidentweb "github.com/fident/go-web"

Token Helper

Helper library for decoding data from fident authtokens

gofidentweb.InitTokenHelperWithAESAndRSAPub(AESKey,RSAPemLocation)

// Can then call this method to get the currently logged in user
func VerifyRequestToken(r *http.Request) (UserDetails, error)

URL Helper

Generates fident URLS that you can send users to for actions such as login,logout and registration. Generally these actions will direct back to your domain on completion.

// Init the URL helper, set 'fidentRegistrationSecret' to "" if you don't plan on using pre-registered verified registration URLs
gofidentweb.InitURLHelper(productServiceURL, fidentServiceURL, fidentRegistrationSecret)

// Actions now available such as the method below
func GetLoginURL() string 

Notification endpoint helper

Helper sets up your endpoint for recieving notifications when users change their details in Fident

// Notificationendpoint (registered with fident)
gofidentweb.InitWithRSAPub(pathToFidentPublicKey)
gofidentweb.SetNotificationHandler(fidentNotificationHandler)
server.HandleFunc(NotificationEndpoint, gofidentweb.NotificationEndpoint)

// The following method would be called with a user update notification payload
func fidentNotificationHandler(payload fident.UserUpdatePayload) {