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

Method SetupRefreshTokenData

internal/models/refresh_token.go:151–169  ·  view source on GitHub ↗
(dbEncryption conf.DatabaseEncryptionConfiguration)

Source from the content-addressed store, hash-verified

149}
150
151func (s *Session) SetupRefreshTokenData(dbEncryption conf.DatabaseEncryptionConfiguration) error {
152 hmacKey := base64.RawURLEncoding.EncodeToString(crypto.GenerateRefreshTokenHmacKey())
153
154 if dbEncryption.Encrypt {
155 es, err := crypto.NewEncryptedString(s.ID.String(), []byte(hmacKey), dbEncryption.EncryptionKeyID, dbEncryption.EncryptionKey)
156 if err != nil {
157 return err
158 }
159
160 hmacKey = es.String()
161 }
162
163 counter := int64(0)
164
165 s.RefreshTokenHmacKey = &hmacKey
166 s.RefreshTokenCounter = &counter
167
168 return nil
169}
170
171func (s *Session) UpdateRefreshTokenCounterAndHmacKey(tx *storage.Connection) error {
172 return tx.UpdateOnly(s, "refresh_token_hmac_key", "refresh_token_counter")

Callers 2

IssueRefreshTokenMethod · 0.95
RefreshTokenGrantMethod · 0.80

Calls 4

StringMethod · 0.95
NewEncryptedStringFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected