MAGIC MOUSE: You may use the number ‘0000’ like PIN.
APPLE WIRELESS KEYBOARD: You may allow visibility in the computer bluetooth. Then search for the keyboard. It’s not easy to find. Try two or three times at least. Then you may write a password with the wired keyboard and the the same one with the apple wireless computer.
After reboot or after suspend you may connect again the devices, but the are automatically recognized and you wouldn’t need to setup a password.