Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
参考 #284 , 目前使用的 libsodium bindings 在 JVM 平台表现不佳。由于它通过JNA绑定libsodium链库,而库文件储存在 resources 中,这会导致两个问题:
因此,现在分离出一个内部使用的模块
simbot-component-qq-guild-internal-ed25519
并将 ed25519 的实现多平台化:非 JVM 平台中,均使用 libsodium bindings 作为实现。
JVM 平台中,优先尝试检测是否存在以下类:
org.bouncycastle.crypto.params.Ed25519PrivateKeyParameters
org.bouncycastle.crypto.params.Ed25519PublicKeyParameters
org.bouncycastle.crypto.signers.Ed25519Signer
如果存在,则使用这些类进行签名操作,也就是使用 BouncyCastle (编译时使用的是
org.bouncycastle:bcprov-jdk18on:1.80
) 进行密钥的生成或签名/验签。如果 BouncyCastle 的相关类不存在,则使用 ed25519-java 作为实现库。此库默认作为
implementation
加载于 classpath 中。相比于 BouncyCastle (≈8,480 KB ≈8.48 MB),它轻量得多 (≈62 KB)。
resolve #284