mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-18 04:30:34 +02:00
Fix lint
This commit is contained in:
parent
8ec691f3ce
commit
e7d5c99b42
@ -29,6 +29,7 @@ func (err ErrSecretDataInvalid) Error() string {
|
||||
|
||||
var nameRE = regexp.MustCompile("[^a-zA-Z0-9-_.]+")
|
||||
|
||||
// Secret represents a secret
|
||||
type Secret struct {
|
||||
ID int64
|
||||
UserID int64 `xorm:"index"`
|
||||
|
25
models/migrations/v227.go
Normal file
25
models/migrations/v227.go
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func createSecretsTable(x *xorm.Engine) error {
|
||||
type Secret struct {
|
||||
ID int64
|
||||
UserID int64 `xorm:"index"`
|
||||
RepoID int64 `xorm:"index"`
|
||||
Name string
|
||||
Data string
|
||||
PullRequest bool
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
||||
}
|
||||
|
||||
return x.Sync(new(Secret))
|
||||
}
|
@ -9,7 +9,6 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"io"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
@ -79,12 +78,3 @@ func NewMasterKey() ([]byte, error) {
|
||||
|
||||
return secretBytes, nil
|
||||
}
|
||||
|
||||
func randomInt(max *big.Int) (int, error) {
|
||||
rand, err := rand.Int(rand.Reader, max)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return int(rand.Int64()), nil
|
||||
}
|
||||
|
@ -13,8 +13,7 @@ import (
|
||||
"io"
|
||||
)
|
||||
|
||||
type aesEncryptionProvider struct {
|
||||
}
|
||||
type aesEncryptionProvider struct{}
|
||||
|
||||
func NewAesEncryptionProvider() EncryptionProvider {
|
||||
return &aesEncryptionProvider{}
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
package secrets
|
||||
|
||||
type nopMasterKeyProvider struct {
|
||||
}
|
||||
type nopMasterKeyProvider struct{}
|
||||
|
||||
// NewNopMasterKeyProvider returns master key provider that holds no master key and is always unsealed
|
||||
func NewNopMasterKeyProvider() MasterKeyProvider {
|
||||
|
@ -133,7 +133,6 @@ _, err := db.DeleteByBean(ctx, &auth_model.Secret{ID: id})
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
func FindRepoSecrets(ctx context.Context, repoID int64) ([]*auth_model.Secret, error) {
|
||||
var res []*auth_model.Secret
|
||||
return res, db.FindObjects(ctx, builder.Eq{"repo_id": repoID}, nil, &res)
|
||||
|
Loading…
x
Reference in New Issue
Block a user