# Circuit used to verify a token mint authority.
k = 11;
field = "pallas";

constant "AuthTokenMint_V1" {
    EcFixedPointBase NULLIFIER_K,
}

witness "AuthTokenMint_V1" {
    # TokenAttributes {
    Base token_auth_parent,
    Base token_blind,
    # }

    # Secret key used by the mint authority
    Base mint_secret,
}

circuit "AuthTokenMint_V1" {
    # Derive public key for the mint authority
    mint_public = ec_mul_base(mint_secret, NULLIFIER_K);
    mint_x = ec_get_x(mint_public);
    mint_y = ec_get_y(mint_public);
    constrain_instance(mint_x);
    constrain_instance(mint_y);

    # Derive the token ID
    token_user_data = poseidon_hash(mint_x, mint_y);
    token_id = poseidon_hash(token_auth_parent, token_user_data, token_blind);
    constrain_instance(token_id);
}
