Commits

Toby Inkster committed 93512ad Draft

SYNOPSIS sections for the key classes

Comments (0)

Files changed (4)

lib/RDF/Crypt/Decrypter.pm

 
 RDF::Crypt::Decrypter - decrypts encrypted RDF graphs
 
+=head1 SYNOPSIS
+
+ use 5.010;
+ use File::Slurp qw< slurp >;
+ use RDF::Crypt::Decrypter;
+ 
+ my $dec = RDF::Crypt::Decrypter->new_from_file(
+    '/path/to/private-key.pem'
+ );
+ 
+ my $scrambled = slurp '/path/to/secret.rdf-crypt';
+ my $graph     = $dec->decrypt_model($scrambled);
+
 =head1 DESCRIPTION
 
 A Decrypter object is created using an RSA private key.
 
 RDF::Crypt::Decrypter can also also be used to encrypt graphs for yourself,
-using just your private key. See L<RDF::Crypt::Role::DoesEncrypt> for
-details of the encryption methods.
+using just your private key.
 
 =head2 Roles
 

lib/RDF/Crypt/Encrypter.pm

 
 RDF::Crypt::Encrypter - encrypts RDF graphs
 
+=head1 SYNOPSIS
+
+ use 5.010;
+ use RDF::Crypt::Encrypter;
+ use RDF::TrineX::Functions qw< parse >;
+ 
+ my $enc = RDF::Crypt::Encrypter->new_from_webid(
+    'http://www.example.com/people/alice#me'
+ );
+ 
+ my $graph     = parse '/path/to/secret.ttl';
+ my $scrambled = $enc->encrypt_model($graph);
+
 =head1 DESCRIPTION
 
 An Encrypter object is created using an RSA public key. The object can be used

lib/RDF/Crypt/Signer.pm

 
 RDF::Crypt::Signer - signs RDF graphs with RSA
 
+=head1 SYNOPSIS
+
+ use 5.010;
+ use File::Slurp qw< slurp >;
+ use RDF::Crypt::Signer;
+ use RDF::TrineX::Functions qw< parse >;
+ 
+ my $sign = RDF::Crypt::Signer->new_from_file(
+    '/path/to/private-key.pem'
+ );
+ 
+ my $raw    = slurp '/path/to/important.ttl';
+ my $graph  = parse '/path/to/important.ttl';
+ 
+ my $detached_sig                   = $sign->sign_model($graph);
+ my $turtle_with_embedded_signature = $sign->sign_embed_turtle($raw);
+
 =head1 DESCRIPTION
 
 A Signer object is created using an RSA private key. The object can be used

lib/RDF/Crypt/Verifier.pm

 
 RDF::Crypt::Verifier - verifies signed RDF graphs
 
+=head1 SYNOPSIS
+
+ use 5.010;
+ use File::Slurp qw< slurp >;
+ use RDF::Crypt::Verifier;
+ use RDF::TrineX::Functions qw< parse >;
+ 
+ my $verify = RDF::Crypt::Verifier->new_from_file(
+    '/path/to/public-key.pem'
+ );
+ 
+ my $graph      = parse '/path/to/important.ttl';
+ my $signature  = slurp '/path/to/important.ttl.sig';
+ 
+ say "graph is trusted"
+   if $v->verify_model($graph, $signature);
+
 =head1 DESCRIPTION
 
 A Verifier object is created using an RSA public key. The object can be used