feat: add pure-MoonBit SHA-512, Ed25519, AES-256-CBC, and signed RouterInfo/LeaseSet2
This commit is contained in:
1 parent
c95e9cfc21
commit
dff69dfac6
9 files changed
+1330
-4
No files matched your search
@@ -2,6 +2,7 @@
|
||||
package "experiments/moon_i2p/common"
|
||||
|
||||
import {
|
||||
"experiments/moon_i2p/crypto",
|
||||
"experiments/moon_i2p/encoding",
|
||||
"moonbitlang/core/debug",
|
||||
}
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub suberror CommonError {
|
||||
Encoding(@encoding.EncodingError)
|
||||
Crypto(@crypto.CryptoError)
|
||||
InvalidLength(String)
|
||||
InvalidFormat(String)
|
||||
}
|
||||
@@ -126,6 +128,11 @@ pub(all) struct LeaseSet2 {
|
||||
}
|
||||
pub fn LeaseSet2::decode(@encoding.Reader) -> Self raise CommonError
|
||||
pub fn LeaseSet2::encode(Self, @encoding.Writer) -> Unit raise CommonError
|
||||
pub fn LeaseSet2::sign_ed25519(Self, Bytes) -> Self raise CommonError
|
||||
pub fn LeaseSet2::signing_bytes(Self) -> Bytes raise CommonError
|
||||
pub fn LeaseSet2::to_bytes(Self) -> Bytes raise CommonError
|
||||
pub fn LeaseSet2::unsigned_bytes(Self) -> Bytes raise CommonError
|
||||
pub fn LeaseSet2::verify_signature(Self) -> Bool
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct LeaseSet2EncryptionKey {
|
||||
@@ -181,7 +188,10 @@ pub(all) struct RouterInfo {
|
||||
}
|
||||
pub fn RouterInfo::decode(@encoding.Reader) -> Self raise CommonError
|
||||
pub fn RouterInfo::encode(Self, @encoding.Writer) -> Unit raise CommonError
|
||||
pub fn RouterInfo::sign_ed25519(Self, Bytes) -> Self raise CommonError
|
||||
pub fn RouterInfo::to_bytes(Self) -> Bytes raise CommonError
|
||||
pub fn RouterInfo::unsigned_bytes(Self) -> Bytes raise CommonError
|
||||
pub fn RouterInfo::verify_signature(Self) -> Bool
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub struct SessionKey {
|
||||
|
||||
Reference in new issue
Block a user