package club.clubk.ktag.apps.mqttbroker;

import android.content.Context;

import java.util.Map;

import io.moquette.broker.security.IAuthenticator;

public class FileAuthenticator implements IAuthenticator {
    private final Context context;

    public FileAuthenticator(Context context) {
        this.context = context.getApplicationContext();
    }

    @Override
    public boolean checkValid(String clientId, String username, byte[] password) {
        Map<String, String> credentials = CredentialManager.loadCredentials(context);
        return CredentialManager.checkCredential(username, password, credentials);
    }
}
