2024-01-02 13:32:11 +00:00
|
|
|
// Copyright (c) 2024 Proton AG
|
2020-04-08 10:59:16 +00:00
|
|
|
//
|
2022-04-05 13:50:21 +00:00
|
|
|
// This file is part of Proton Mail Bridge.
|
2020-04-08 10:59:16 +00:00
|
|
|
//
|
2022-04-05 13:50:21 +00:00
|
|
|
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
2020-04-08 10:59:16 +00:00
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
2022-04-05 13:50:21 +00:00
|
|
|
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
2020-04-08 10:59:16 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2022-04-05 13:50:21 +00:00
|
|
|
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
2020-04-08 10:59:16 +00:00
|
|
|
|
2022-08-26 15:00:21 +00:00
|
|
|
package utils
|
2020-04-08 10:59:16 +00:00
|
|
|
|
|
|
|
import (
|
2021-03-17 09:33:03 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
|
|
|
"github.com/stretchr/testify/require"
|
2020-04-08 10:59:16 +00:00
|
|
|
)
|
|
|
|
|
2021-03-17 09:33:03 +00:00
|
|
|
func MakeKeyRing(t *testing.T) *crypto.KeyRing {
|
|
|
|
key, err := crypto.GenerateKey("name", "email", "rsa", 2048)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
kr, err := crypto.NewKeyRing(key)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
return kr
|
2020-04-08 10:59:16 +00:00
|
|
|
}
|