docs: updated javadoc

This commit is contained in:
zihluwang
2025-01-26 21:07:49 +08:00
parent cd5fee9db6
commit 0b04bf23ed
4 changed files with 10 additions and 8 deletions
@@ -17,11 +17,8 @@
package com.onixbyte.security; package com.onixbyte.security;
import com.onixbyte.security.exception.KeyLoadingException;
import java.security.PrivateKey; import java.security.PrivateKey;
import java.security.PublicKey; import java.security.PublicKey;
import java.security.interfaces.ECPrivateKey;
/** /**
* The {@code KeyLoader} class provides utility methods for loading keys pairs from PEM-formatted * The {@code KeyLoader} class provides utility methods for loading keys pairs from PEM-formatted
@@ -31,7 +28,7 @@ import java.security.interfaces.ECPrivateKey;
* from PEM-formatted strings for cryptographic operations. * from PEM-formatted strings for cryptographic operations.
* *
* @author zihluwang * @author zihluwang
* @version 1.6.0 * @version 2.0.0
* @since 1.6.0 * @since 1.6.0
*/ */
public interface KeyLoader { public interface KeyLoader {
@@ -29,7 +29,8 @@ package com.onixbyte.security.exception;
* <p><b>Example usage:</b></p> * <p><b>Example usage:</b></p>
* <pre>{@code * <pre>{@code
* try { * try {
* ECPrivateKey privateKey = KeyLoader.loadEcdsaPrivateKey(pemPrivateKey); * KeyLoader keyLoader = new EcKeyLoader();
* ECPrivateKey privateKey = keyLoader.loadPrivateKey(pemPrivateKey);
* } catch (KeyLoadingException e) { * } catch (KeyLoadingException e) {
* // Handle the exception * // Handle the exception
* e.printStackTrace(); * e.printStackTrace();
@@ -37,7 +38,7 @@ package com.onixbyte.security.exception;
* }</pre> * }</pre>
* *
* @author zihluwang * @author zihluwang
* @version 1.6.0 * @version 2.0.0
* @since 1.6.0 * @since 1.6.0
*/ */
public class KeyLoadingException extends RuntimeException { public class KeyLoadingException extends RuntimeException {
@@ -48,6 +48,10 @@ import java.util.Base64;
* -----END EC PUBLIC KEY-----"""; * -----END EC PUBLIC KEY-----""";
* ECPublicKey publicKey = KeyLoader.loadPublicKey(pemPublicKey); * ECPublicKey publicKey = KeyLoader.loadPublicKey(pemPublicKey);
* }</pre> * }</pre>
*
* @author zihluwang
* @version 2.0.0
* @since 2.0.0
*/ */
public class EcKeyLoader implements KeyLoader { public class EcKeyLoader implements KeyLoader {
+2 -2
View File
@@ -29,7 +29,7 @@ It is quite simple to install this module by `Maven`. The only thing you need to
<version>${simple-jwt-${any-implementation}.version}</version> <version>${simple-jwt-${any-implementation}.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.org.codecrafters</groupId> <groupId>com.onixbyte</groupId>
<artifactId>simple-jwt-spring-boot-starter</artifactId> <artifactId>simple-jwt-spring-boot-starter</artifactId>
<version>${simple-jwt-spring-boot-starter.version}</version> <version>${simple-jwt-spring-boot-starter.version}</version>
</dependency> </dependency>
@@ -50,7 +50,7 @@ Find `build.gradle` in the needed project, and add the following code to the `de
```groovy ```groovy
implementation '${implementation-builder-group-id}:simple-jwt-${any-implementation}:${simple-jwt-${any-implementation}.version}' implementation '${implementation-builder-group-id}:simple-jwt-${any-implementation}:${simple-jwt-${any-implementation}.version}'
implementation 'cn.org.codecrafters:simple-jwt-spring-boot-starter:${simple-jwt-spring-boot-starter.version}' implementation 'com.onixbyte:simple-jwt-spring-boot-starter:${simple-jwt-spring-boot-starter.version}'
``` ```
### If you are not using `Maven` or `Gradle` ### If you are not using `Maven` or `Gradle`