From a328e7ccc4f94e19cddfe5894636228663f5c7fa Mon Sep 17 00:00:00 2001 From: E99p1ant Date: Sun, 5 Jun 2022 13:34:21 +0800 Subject: access_token: encrypt access token with SHA256 (#7008) * access_token: encrypt access token with SHA256 * revert list access token * fix lint * generate schemadoc * add database migrations * fix tests * fix tests * add test case for access token golden * fix test in postgres * `Sha256` -> `SHA256` * Use GORM for migration * task generate-schemadoc * Use unique * change migration name * allow read * task generate-schemadoc * add changelog * fix lint error * update changelog * remove Debug * add comments Co-authored-by: Joe Chen --- internal/cryptoutil/sha1.go | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 internal/cryptoutil/sha1.go (limited to 'internal/cryptoutil/sha1.go') diff --git a/internal/cryptoutil/sha1.go b/internal/cryptoutil/sha1.go deleted file mode 100644 index 38133960..00000000 --- a/internal/cryptoutil/sha1.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2020 The Gogs 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 cryptoutil - -import ( - "crypto/sha1" - "encoding/hex" -) - -// SHA1 encodes string to hexadecimal of SHA1 checksum. -func SHA1(str string) string { - h := sha1.New() - _, _ = h.Write([]byte(str)) - return hex.EncodeToString(h.Sum(nil)) -} -- cgit v1.2.3