Non-ideal magnetohydrodynamic effects that rule the coupling of the magnetic field to the circumstellar gas during the low-mass star formation process depend heavily on the local physical conditions, such as the ionization fraction of the gas. The purpose of this work is to observationally characterize the level of ionization of the circumstellar gas at small envelope radii and investigate its relation to the efficiency of the coupling between the star-forming gas and the magnetic field in the Class 0 protostar B335. We have obtained molecular line emission maps of B335 with ALMA, which we use to measure the deuteration fraction of the gas, its ionization fraction, and the cosmic-ray ionization rate, at envelope radii < 1000 au. We find large fractions of ionized gas, Chi_e of 1−8 × 10^−6. Our observations also reveal an enhanced ionization that increases at small envelope radii, reaching values up to Xsi_CR of 10^−14 s^−1 at a few hundred au from the central protostellar object. We show that this extreme ionization rate can be attributed to the presence of cosmic rays accelerated close to the protostar. We report the first resolved map of the cosmic-ray ionization rate at scales < 1000 au in a solar-type Class 0 protostar, finding remarkably high values. Our observations suggest that local acceleration of cosmic rays, and not the penetration of interstellar Galactic cosmic rays, may be responsible for the gas ionization in the inner envelope, potentially down to disk forming scales. If confirmed, our findings imply that protostellar disk properties may also be determined by local processes setting the coupling between the gas and the magnetic field, and not only by the amount of angular momentum available at large envelope scales and the magnetic field strength in protostellar cores.