Prevent Autosecret migration if old secret is > 22 chars (fixes #157)

Change-Id: Ib089a0424bf5ce7984a27e99b3cac46e01abdcec
diff --git a/Changes b/Changes
index 9e14293..369ed99 100755
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.44 2022-01-04
+        - Fixed autosecrets migration. (diewald)
+
 0.43 2021-12-14
         - New menu class that has an entry at the very end,
           similar to the input text prefix,
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index b6a5db0..b850be0 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -8,7 +8,7 @@
 use List::Util 'none';
 
 # Minor version - may be patched from package.json
-our $VERSION = '0.43';
+our $VERSION = '0.44';
 
 # Supported version of Backend API
 our $API_VERSION = '1.0';
@@ -46,8 +46,18 @@
 
     # Load file and split lines for multiple secrets
     my $secrets = [b($old_secret->slurp)->split("\n")];
+
     $self->secrets($secrets);
 
+    for (@$secrets) {
+      if (length($secrets) > 22) {
+        $self->log->warn(
+          'Unable to automatically switch to Autosecrets, as secret is too long (> 22 chars)'
+        );
+        goto CONF;
+      };
+    }
+
     eval {
       $secret_file->spurt(encode_json(@$secrets));
       $secret_file->chmod(0600);
@@ -72,6 +82,7 @@
     });
   };
 
+ CONF:
 
   # Configuration framework
   $self->plugin('Config');
diff --git a/package.json b/package.json
index 0191363..37919aa 100755
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "name": "Kalamar",
   "description": "Mojolicious-based Frontend for KorAP",
   "license": "BSD-2-Clause",
-  "version": "0.43.2",
+  "version": "0.44.0",
   "pluginVersion": "0.2.2",
   "engines": {
     "node": ">=6.0.0"