Example code

Sample WOPI host

The Office Online GitHub repository contains a sample implementation of a WOPI host written in C#. This sample implementation illustrates many of the concepts necessary to implement a WOPI server, including:

Proof key unit tests

Example test cases and data that can be used to validate proof key verification implementations can be found here: https://github.com/Microsoft/Office-Online-Test-Tools-and-Documentation/blob/master/samples/SampleWopiHandler/SampleWopiHandler.UnitTests/ProofKeyTests.cs

While these tests are written in C#, they can be adapted to any language. If you are having difficulties implementing proof keys, these test cases can be a useful tool for troubleshooting. See also the Troubleshooting proof key implementations section.

These same test cases along with a basic proof key validation implementation in Python is available here: https://github.com/Microsoft/Office-Online-Test-Tools-and-Documentation/blob/master/samples/python/proof_keys/tests.py

Note that the Python samples depend on PyCrypto being installed.