Move to OpaqueKey implementations from the external library

[LMS-2757]