public static function decrypt_secret($secret)
    {
        global $CFG;
        if ( $secret === null || $secret === false ) return $secret;
        if ( ! startsWith($secret,'AES::') ) return $secret;
        $secret = substr($secret, 5);
        $decr = AesCtr::decrypt($secret, $CFG->cookiesecret, 256) ;
        return $decr;
    }