How to encrypt data with OTP?

We can generate OTP using HOTP – RFC 4226 and TOTP – RFC 6238.

But the generated OTP normally has a checking function authenticator.check(token, secret);. But this only checks if the OTP is valid.

How to store any data such that it will be encrypted in the storage of the system and can only be accessed after entering the OTP.