🎨 改进数据仓库 通过密码生成密钥 Fix #6782 (#6784)

对密钥长度进行判断
This commit is contained in:
颖逸 2022-12-05 13:32:21 +08:00 committed by GitHub
parent d355423cab
commit 4c46d42613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,7 +154,7 @@ func InitRepoKeyFromPassphrase(passphrase string) (err error) {
var key []byte
base64Data, base64Err := base64.StdEncoding.DecodeString(passphrase)
if nil == base64Err {
if nil == base64Err && 32 == len(base64Data) {
// 改进数据仓库 `通过密码生成密钥` https://github.com/siyuan-note/siyuan/issues/6782
logging.LogInfof("passphrase is base64 encoded, use it as key directly")
key = base64Data