App-Session-Token-0.102/0000755000175000017500000000000012770763730013425 5ustar dougdougApp-Session-Token-0.102/lib/0000755000175000017500000000000012770763730014173 5ustar dougdougApp-Session-Token-0.102/lib/App/0000755000175000017500000000000012770763730014713 5ustar dougdougApp-Session-Token-0.102/lib/App/Session/0000755000175000017500000000000012770763730016336 5ustar dougdougApp-Session-Token-0.102/lib/App/Session/Token.pm0000644000175000017500000000103412770763613017752 0ustar dougdougpackage App::Session::Token; our $VERSION = '0.102'; 1; __END__ =encoding utf-8 =head1 NAME App::Session::Token - Command line interface to Session::Token =head1 DESCRIPTION This interface is described in the L documentation. =head1 SEE ALSO L L =head1 AUTHOR Doug Hoyte, C<< >> =head1 COPYRIGHT & LICENSE Copyright 2014-2016 Doug Hoyte. This module is licensed under the same terms as perl itself. App-Session-Token-0.102/Changes0000644000175000017500000000020012770763605014711 0ustar dougdoug0.102 2016-09-22 * --infinity option 0.101 2016-03-04 * Add --help option 0.100 2014-05-15 * Initial CPAN release App-Session-Token-0.102/README0000664000175000017500000000442112770763730014310 0ustar dougdougNAME session-token - command-line script for generating session tokens USAGE $ session-token ATXOpAxCu57sVZvoBiWgHg $ session-token --entropy 256 hk0No9bjuknBxmpIujW3bZvnFmryTvEbTPNitd8L9kC $ session-token --length 5 --alphabet ACGT --num 3 GAATT ACCAT AATTG ## If you don't know how many tokens you need at the start of the pipeline... $ session-token --infinity | ... | head DESCRIPTION This module came about because I found myself frequently running the following command: $ perl -MSession::Token -E 'say Session::Token->new->get' YwXYXGLMMnudk33MbClseQ Before I wrote Session::Token I used to run the following command: $ openssl rand -base64 16 fjxhL/LmZEUQ+NCldQbHgA== They both perform essentially the same task however "session-token" has various advantages: It is more flexible regarding the alphabet used since it supports any alphabet that Session::Token does via the "--alphabet" switch. Its default alphabet is the (IMO) nice base-62 versus "openssl rand"'s base-64. It can efficiently generate a large number of random tokens with the "--num" switch. Calling "openssl rand" for each token would fork a lot of processes and open and read from "/dev/urandom" in each one. If cross-platform determinism is required, the "--seed" or "--null-seed" switches are available and they don't require seed files or anything. Note that you should only use these switches for benchmarks or simulations and never for applications requiring secure randomness since the generated sequence of tokens will be the same for each run. "openssl rand" does some weirdness with reading from/writing to the "~/.rnd" file in your home directory as a potential entropy source/store. "session-token" will always fail noisily if it can't read from "/dev/urandom". Finally, "session-token" is easier to remember and type don't you think? SEE ALSO App-Session-Token github repo Session::Token AUTHOR Doug Hoyte, "" COPYRIGHT & LICENSE Copyright 2014-2016 Doug Hoyte. This module is licensed under the same terms as perl itself. App-Session-Token-0.102/bin/0000755000175000017500000000000012770763730014175 5ustar dougdougApp-Session-Token-0.102/bin/session-token0000644000175000017500000000604412770763457016733 0ustar dougdoug#!/usr/bin/env perl use strict; use Session::Token; use Getopt::Long; my @opt_spec = ( ## Used by Session::Token constructor 'alphabet=s', 'entropy=i', 'length=i', 'seed=s', ## Special 'num|n=i', 'infinity', 'help|h|?', 'null-seed', ); my $opt = {}; GetOptions($opt, @opt_spec) || die "GetOptions failed"; if ($opt->{help}) { require Pod::Perldoc; @ARGV = ('-F', $0); Pod::Perldoc->run(); } $opt->{seed} = "\x00"x1024 if $opt->{'null-seed'}; my $generator = Session::Token->new(%$opt); if (exists $opt->{num} && exists $opt->{infinity}) { die "can't specify both num and infinity" } elsif (exists $opt->{infinity}) { while(1) { print $generator->get(), "\n"; } } else { my $iters = $opt->{num}; $iters = 1 if !defined $iters; for (1 .. $iters) { print $generator->get(), "\n"; } } __END__ =encoding utf-8 =head1 NAME session-token - command-line script for generating session tokens =head1 USAGE $ session-token ATXOpAxCu57sVZvoBiWgHg $ session-token --entropy 256 hk0No9bjuknBxmpIujW3bZvnFmryTvEbTPNitd8L9kC $ session-token --length 5 --alphabet ACGT --num 3 GAATT ACCAT AATTG ## If you don't know how many tokens you need at the start of the pipeline... $ session-token --infinity | ... | head =head1 DESCRIPTION This module came about because I found myself frequently running the following command: $ perl -MSession::Token -E 'say Session::Token->new->get' YwXYXGLMMnudk33MbClseQ Before I wrote L I used to run the following command: $ openssl rand -base64 16 fjxhL/LmZEUQ+NCldQbHgA== They both perform essentially the same task however C has various advantages: It is more flexible regarding the alphabet used since it supports any alphabet that L does via the C<--alphabet> switch. Its default alphabet is the (IMO) nice base-62 versus C's base-64. It can efficiently generate a large number of random tokens with the C<--num> switch. Calling C for each token would fork a lot of processes and open and read from C in each one. If cross-platform determinism is required, the C<--seed> or C<--null-seed> switches are available and they don't require seed files or anything. Note that you should only use these switches for benchmarks or simulations and never for applications requiring secure randomness since the generated sequence of tokens will be the same for each run. C does some weirdness with reading from/writing to the C<~/.rnd> file in your home directory as a potential entropy source/store. C will always fail noisily if it can't read from C. Finally, C is easier to remember and type don't you think? =head1 SEE ALSO L L =head1 AUTHOR Doug Hoyte, C<< >> =head1 COPYRIGHT & LICENSE Copyright 2014-2016 Doug Hoyte. This module is licensed under the same terms as perl itself. =cut App-Session-Token-0.102/MANIFEST0000644000175000017500000000041012770763730014551 0ustar dougdougbin/session-token Changes lib/App/Session/Token.pm Makefile.PL MANIFEST MANIFEST.SKIP t/basic.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) App-Session-Token-0.102/META.yml0000664000175000017500000000124112770763730014676 0ustar dougdoug--- abstract: unknown author: - unknown build_requires: ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.150005' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: App-Session-Token no_index: directory: - t - inc requires: Getopt::Long: '0' Session::Token: '0' resources: bugtracker: https://github.com/hoytech/App-Session-Token/issues repository: git://github.com/hoytech/App-Session-Token.git version: '0.102' x_serialization_backend: 'CPAN::Meta::YAML version 0.012' App-Session-Token-0.102/Makefile.PL0000644000175000017500000000133412770762366015404 0ustar dougdouguse strict; use ExtUtils::MakeMaker; my %args = ( NAME => 'App::Session::Token', VERSION_FROM => 'lib/App/Session/Token.pm', EXE_FILES => [ 'bin/session-token', ], PREREQ_PM => { 'Session::Token' => 0, 'Getopt::Long' => 0, }, LIBS => [], DEFINE => '', LICENSE => 'perl', dist => { PREOP => 'pod2text bin/session-token > $(DISTVNAME)/README', }, ); my $eummv = eval ($ExtUtils::MakeMaker::VERSION); if ($eummv >= 6.45) { $args{META_MERGE} = { resources => { repository => 'git://github.com/hoytech/App-Session-Token.git', bugtracker => 'https://github.com/hoytech/App-Session-Token/issues', }, }; } WriteMakefile(%args); App-Session-Token-0.102/META.json0000664000175000017500000000220512770763730015047 0ustar dougdoug{ "abstract" : "unknown", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.150005", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "App-Session-Token", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Getopt::Long" : "0", "Session::Token" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/hoytech/App-Session-Token/issues" }, "repository" : { "url" : "git://github.com/hoytech/App-Session-Token.git" } }, "version" : "0.102", "x_serialization_backend" : "JSON::PP version 2.27203" } App-Session-Token-0.102/t/0000755000175000017500000000000012770763730013670 5ustar dougdougApp-Session-Token-0.102/t/basic.t0000644000175000017500000000046112770762366015143 0ustar dougdouguse strict; use Config; use Test::More tests => 2; my $v = `$Config{perlpath} -I lib bin/session-token`; chomp $v; like($v, qr/^[A-Za-z0-9]{22}$/, "simple random token"); $v = `$Config{perlpath} -I lib bin/session-token --null-seed`; chomp $v; is($v, "8AgSJF8AQLroflWRXq3alI", "null-seed output"); App-Session-Token-0.102/MANIFEST.SKIP0000644000175000017500000000016712770762366015333 0ustar dougdougMANIFEST.bak Makefile.old Makefile$ README.pod .gitignore .git/ blib/ pm_to_blib MYMETA.* App-Session-Token.*tar[.]gz$