use crate::*;
use arcis_compiler::{
    traits::FromLeBytes,
    utils::{
        crypto::key::{X25519PrivateKey, X25519PublicKey},
        field::ScalarField,
    },
};

#[test]
fn base_58_conversion() {
    // Python output of:
    // keystring_base58="2uKu51kQaLseu7FySMAGWU6hpnjNvgGr3PkvUCBVTTPD"
    // hex_bytes = base58.b58decode(keystring_base58)
    // print(hex_bytes)
    assert_eq!(
        base58_to_32_uint8array(b"2uKu51kQaLseu7FySMAGWU6hpnjNvgGr3PkvUCBVTTPD").as_slice(),
        b"\x1cCA\xba\x1e\xc36$s\xab3m%Q\x0b\x9c\x18\x7f $-z\x9cS\x03M\xb4\x1c\x86\x11T\x00"
    );
    assert_eq!(
        // x25519 pubkey corresponding to the below private key
        ArcisX25519Pubkey::from_uint8(&[
            205, 104, 97, 219, 73, 89, 119, 42, 237, 127, 47, 222, 77, 203, 82, 49, 97, 21, 242,
            44, 104, 77, 109, 141, 78, 77, 25, 54, 179, 176, 75, 13,
        ]),
        ArcisX25519Pubkey::new(
            X25519PublicKey::new_from_private_key(X25519PrivateKey::<ScalarField>::from_le_bytes(
                [
                    159, 131, 199, 155, 47, 64, 100, 24, 186, 230, 173, 56, 87, 137, 173, 118, 68,
                    37, 88, 20, 117, 108, 87, 11, 167, 239, 133, 57, 235, 122, 16, 238,
                ]
            ))
            .inner()
        )
    );
}
