get_currentuserinfo();
$username = $current_user->user_login
That should work to get the current user’s username. You can read more about get_currentuserinfo();
here in the codex. It pulls all the base info about a user – username, display name, email, first/last name, and user ID.
This will be handy since you can verify the user based on username, then assign the key in the DB according to UID.