forked from jmcardon/tsec
-
Notifications
You must be signed in to change notification settings - Fork 3
/
AsymmetricKeyGenAPI.scala
35 lines (26 loc) · 1.01 KB
/
AsymmetricKeyGenAPI.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package tsec.keygen.asymmetric
import cats.Id
trait AsymmetricKeyGenAPI[Alg, PubK[_], PrivK[_], KP[_]] {
final def generateKeyPair[F[_]](
implicit S: AsymmetricKeyGen[F, Alg, PubK, PrivK, KP]
): F[KP[Alg]] = S.generateKeyPair
final def unsafeGenerateKeyPair(
implicit S: AsymmetricKeyGen[Id, Alg, PubK, PrivK, KP]
): KP[Alg] = S.generateKeyPair
final def buildPrivateKey[F[_]](rawPk: Array[Byte])(
implicit S: AsymmetricKeyGen[F, Alg, PubK, PrivK, KP]
): F[PrivK[Alg]] =
S.buildPrivateKey(rawPk)
final def unsafeBuildPrivateKey(rawPk: Array[Byte])(
implicit S: AsymmetricKeyGen[Id, Alg, PubK, PrivK, KP]
): PrivK[Alg] =
S.buildPrivateKey(rawPk)
final def buildPublicKey[F[_]](
rawPk: Array[Byte]
)(implicit S: AsymmetricKeyGen[F, Alg, PubK, PrivK, KP]): F[PubK[Alg]] =
S.buildPublicKey(rawPk)
final def unsafeBuildPublicKey(rawPk: Array[Byte])(
implicit S: AsymmetricKeyGen[Id, Alg, PubK, PrivK, KP]
): Id[PubK[Alg]] =
S.buildPublicKey(rawPk)
}