StoreTokenBasic stores a token using basic auth (password)
(did string, pds string, accessToken string, refreshToken string, username string, password string, accessExpiry float64, refreshExpiry float64)
| 206 | |
| 207 | // StoreTokenBasic stores a token using basic auth (password) |
| 208 | func 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 |
| 224 | func 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) { |
no test coverage detected