- Add pure-MoonBit bittorrent package: bencode codec, metainfo/magnet parsing with path traversal checks, peer wire protocol (BEP 10/9), and I2P Kademlia DHT with KRPC and 54-byte compact nodes - Add SHA-1 primitive in crypto for torrent info hashes - Add router torrent API and engine, enabled with --torrent-api (default 127.0.0.1:4445) and --download-dir - Add Firefox WebExtension torrent manager with native messaging host and packed .xpi - Add scripts to build a standalone Firefox + router AppImage and install the native host - Add just targets (proxy, appimage, extension), README docs, and ignore .cache/ and dist/
103 lines
2.6 KiB
Plaintext
103 lines
2.6 KiB
Plaintext
// Generated using `moon info`, DON'T EDIT IT
|
|
package "experiments/moon_i2p/crypto"
|
|
|
|
import {
|
|
"moonbitlang/core/debug",
|
|
}
|
|
|
|
// Values
|
|
pub fn aead_chacha20_poly1305_decrypt(Bytes, Bytes, Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn aead_chacha20_poly1305_encrypt(Bytes, Bytes, Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn aes256_cbc_decrypt(Bytes, Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn aes256_cbc_encrypt(Bytes, Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn aes256_decrypt_block(Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn aes256_encrypt_block(Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn chacha20_block(Bytes, UInt32, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn chacha20_xor(Bytes, UInt32, Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn ct_eq(Bytes, Bytes) -> Bool
|
|
|
|
pub fn ed25519_public_key(Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn ed25519_sign(Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn ed25519_verify(Bytes, Bytes, Bytes) -> Bool
|
|
|
|
pub fn elligator2_decode(Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn elligator2_encode(Bytes, high_bits? : Byte, tweak_sign? : Bool) -> Bytes? raise CryptoError
|
|
|
|
pub fn hkdf(Bytes, Bytes, Bytes, Int32) -> Bytes raise CryptoError
|
|
|
|
pub fn hkdf_expand(Bytes, Bytes, Int32) -> Bytes raise CryptoError
|
|
|
|
pub fn hkdf_extract(Bytes, Bytes) -> Bytes
|
|
|
|
pub fn hmac_sha256(Bytes, Bytes) -> Bytes
|
|
|
|
pub fn poly1305_mac(Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn sha1(Bytes) -> Bytes
|
|
|
|
pub fn sha256(Bytes) -> Bytes
|
|
|
|
pub fn sha512(Bytes) -> Bytes
|
|
|
|
pub fn siphash_2_4(Bytes, Bytes) -> UInt64 raise CryptoError
|
|
|
|
pub fn x25519(Bytes, Bytes) -> Bytes raise CryptoError
|
|
|
|
pub fn x25519_public_key(Bytes) -> Bytes raise CryptoError
|
|
|
|
// Errors
|
|
#derive(Eq, @debug.Debug)
|
|
pub suberror CryptoError {
|
|
InvalidKeyLength(String)
|
|
InvalidNonceLength(String)
|
|
InvalidLength(String)
|
|
AuthenticationFailed
|
|
}
|
|
|
|
// Types and methods
|
|
pub struct Sha1 {
|
|
state : FixedArray[UInt32]
|
|
block : FixedArray[Byte]
|
|
mut block_len : Int32
|
|
mut total_len : UInt64
|
|
}
|
|
pub fn Sha1::finalize(Self) -> Bytes
|
|
pub fn Sha1::new() -> Self
|
|
pub fn Sha1::update(Self, Bytes) -> Unit
|
|
|
|
pub struct Sha256 {
|
|
state : FixedArray[UInt32]
|
|
block : FixedArray[Byte]
|
|
mut block_len : Int32
|
|
mut total_len : UInt64
|
|
}
|
|
pub fn Sha256::finalize(Self) -> Bytes
|
|
pub fn Sha256::new() -> Self
|
|
pub fn Sha256::update(Self, Bytes) -> Unit
|
|
|
|
pub struct Sha512 {
|
|
state : FixedArray[UInt64]
|
|
block : FixedArray[Byte]
|
|
mut block_len : Int32
|
|
mut total_len_lo : UInt64
|
|
mut total_len_hi : UInt64
|
|
}
|
|
pub fn Sha512::finalize(Self) -> Bytes
|
|
pub fn Sha512::new() -> Self
|
|
pub fn Sha512::update(Self, Bytes) -> Unit
|
|
|
|
// Type aliases
|
|
|
|
// Traits
|