When I use mapping to store data, in that case, if I don't know the key (_secretToken), I won't be able to get the data in my dapp.
contract Register {
mapping(bytes => bool) private myHiddenToken;
function register(bytes calldata _secretToken) public {
myHiddenToken[_secretToken] = true;
}
function checkAccess(bytes calldata _secretToken) public returns(bool access) {
access = myHiddenToken[_secretToken];
}
}
If the contract doesn't provide the list of map's object keys, you can't get it.
Is mapping a good way to store hidden data or are there better options?