I'm doing the same thing when I go to the cinema or when I take the train: I show or give my phone to allow the entitled person to check a PDF or a barcode that proves I am allowed to be here.
When I do that my phone is unlocked.
Police, robbers can steal my unlocked phone when I do that.
Stupid joke but if Julian Assange needs to show a barcode when he goes to the cinema, he needs to present his unlocked phone to a stranger.
I'm not Assange, but today I felt very stupid when a city policeman (not a state policeman) asked me for my document when I was in the street with my wife and kids. I didn't trust him because he was obviously a city security guard and not a policeman, I asked if he had the authorization to perform this check, but in the end I gave him my unlocked phone to allow him to check my document (everything was OK according to the law).
Conclusion: I need an app to share only some selected files from the screen lock.
When I take the train, I need to "share" for some hours my traveling documents to this app, it will allow me to pass the barcode scanners without unlocking my phone.
I think the HN people might consider this coding opportunity.
Alternatively, on iOS, "Guided Access" can be used to lock the phone to a particular app (let's say the browser) and even prevent certain parts of the UI from being tappable.
You can bring up the document, activated Guided Access (it has its own separate passcode to disable) and then hand the phone over. From there they can either remain in the constrained app, or if they restart the device they'll get the standard system passcode before they can proceed further so it's fairly safe to prevent the device from being misused.