#!/usr/bin/perl

use strict;
use ABAC;
use Data::Dumper;
$Data::Dumper::Indent = 1;

my $keystore = shift || die "Usage: prover.pl <keystore>\n";

ABAC::libabac_init();

my $ctx = ABAC::Context->new;
$ctx->load_directory($keystore);

my ($success, $credentials) = $ctx->query(
    "3f1aca4c5911b345d81c5f1a77675dce13249d0c.fed_create",
    "5839d714b16bbe108642c5eb586c2173420bed19"
);

if ($success) {
    print "Success\n";
}

foreach my $credential (@$credentials) {
    printf "credential %s <- %s\n",
        $credential->head->string,
        $credential->tail->string;
}

ABAC::libabac_deinit();
