This commit is contained in:
Claude Brisson
2024-02-24 22:46:52 +01:00
parent 6969669e4c
commit 69d4a9c1e6
9 changed files with 45 additions and 119 deletions

View File

@@ -76,6 +76,11 @@
<artifactId>kotlinx-datetime-jvm</artifactId>
<version>0.4.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.1</version>
</dependency>
<!-- servlets and mail APIs -->
<dependency>
<groupId>jakarta.servlet</groupId>

View File

@@ -1,5 +1,6 @@
package org.jeudego.pairgoth.util
import org.apache.commons.codec.binary.Base64
import java.io.Serializable
/**
@@ -26,4 +27,10 @@ interface Cryptograph : Serializable {
* @return decrypted string
*/
fun decrypt(bytes: ByteArray): String
fun webEncrypt(str: String) = Base64.encodeBase64URLSafeString(encrypt(str))
fun webDecrypt(str: String) = decrypt(Base64.decodeBase64(str))
}