[lib] Introduce basic permissionsToBitmask and hasPermission
Summary:
These utilities will be used to encode ThreadPermissions as minimally as possible.
Just starting with some utility functions and unit tests.
Test Plan: Naive unit tests pass, will add more.
Reviewers: ashoat, ginsu, tomek, rohan
Reviewed By: ashoat, tomek
Subscribers: wyilio
Differential Revision: https://phab.comm.dev/D9549