(dbEncryption conf.DatabaseEncryptionConfiguration)
| 149 | } |
| 150 | |
| 151 | func (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 | |
| 171 | func (s *Session) UpdateRefreshTokenCounterAndHmacKey(tx *storage.Connection) error { |
| 172 | return tx.UpdateOnly(s, "refresh_token_hmac_key", "refresh_token_counter") |
no test coverage detected