MCPcopy Index your code
hub / github.com/Preloading/TwitterAPIBridge / StoreTokenBasic

Function StoreTokenBasic

db_controller/db_controller.go:208–221  ·  view source on GitHub ↗

StoreTokenBasic stores a token using basic auth (password)

(did string, pds string, accessToken string, refreshToken string, username string, password string, accessExpiry float64, refreshExpiry float64)

Source from the content-addressed store, hash-verified

206
207// StoreTokenBasic stores a token using basic auth (password)
208func StoreTokenBasic(did string, pds string, accessToken string, refreshToken string, username string, password string, accessExpiry float64, refreshExpiry float64) (*string, error) {
209 passwordData, err := authcrypt.GeneratePasswordHash(password)
210 if err != nil {
211 return nil, err
212 }
213
214 // generate a new UUID for the token
215 uuid, err := uuid.NewRandom()
216 if err != nil {
217 return nil, err
218 }
219
220 return UpdateTokenBasic(did, pds, accessToken, refreshToken, accessExpiry, refreshExpiry, username, password, passwordData.Hash, passwordData.Salt, uuid.String())
221}
222
223// UpdateTokenBasic updates or creates a token entry using basic auth
224func UpdateTokenBasic(did string, pds string, accessToken string, refreshToken string, accessExpiry float64, refreshExpiry float64, username string, password string, passwordHash string, passwordSalt string, uuid string) (*string, error) {

Callers 1

GetAuthFromReqFunction · 0.92

Calls 1

UpdateTokenBasicFunction · 0.85

Tested by

no test coverage detected