MCPcopy Create free account
hub / github.com/supabase/auth / WriteChallengeToDatabase

Method WriteChallengeToDatabase

internal/models/factor.go:360–373  ·  view source on GitHub ↗
(tx *storage.Connection, challenge *Challenge)

Source from the content-addressed store, hash-verified

358 return challenge
359}
360func (f *Factor) WriteChallengeToDatabase(tx *storage.Connection, challenge *Challenge) error {
361 if challenge.FactorID != f.ID {
362 return errors.New("Can only write challenges that you own")
363 }
364 now := time.Now()
365 f.LastChallengedAt = &now
366 if terr := tx.Create(challenge); terr != nil {
367 return terr
368 }
369 if err := tx.UpdateOnly(f, "last_challenged_at"); err != nil {
370 return err
371 }
372 return nil
373}
374
375func (f *Factor) CreatePhoneChallenge(ipAddress string, otpCode string, encrypt bool, encryptionKeyID, encryptionKey string) (*Challenge, error) {
376 phoneChallenge := f.CreateChallenge(ipAddress)

Callers 3

challengePhoneFactorMethod · 0.80
challengeTOTPFactorMethod · 0.80

Calls 2

NowMethod · 0.80
UpdateOnlyMethod · 0.80

Tested by

no test coverage detected