SkierPGP/Skier

View on GitHub
templates/keyinfo.html

Summary

Maintainability
Test Coverage
{% extends "base.html" %}


{% block navbar %}
<div class="container">
    {% with curr = "keyinfo" %}
        {% include "navbar.html" %}
    {% endwith %}
</div>
{% endblock %}

{% block content %}
    {% if found %}
        {% if added is defined %}
        {% if added %}
        <h2>Key {{ key.shortid }} successfully added.</h2>
        {% endif %}
        {% endif %}
        <h2>{{ key.shortid }}</h2>
        <div class="keyinfo">
            <ul>
                <li><strong>pub:</strong> {{ key.get_algo_name()}}-{{ key.get_length() }} / <a href="{{ url_for("user_display_keys.getkey", keyid=key.shortid) }}">0x{{ key.shortid }}</a> ({{ key.fingerprint }}) {% if key.revoked %}<strong style="color: red">[REVOKED]</strong>{% elif key.expired %}<strong style="color: red">[EXPIRED]</strong>{% endif %}
                    <ul>
                        <li>uid:
                            <ul>
                                {% for u in key.uid %}
                                    <li>{{ u }}</li>
                                {% endfor %}
                            </ul>
                        </li>
                        <li>created: {{ key.get_created_ymd() }} expires: {{ key.get_expired_ymd() }}</li>
                        {% if key.oid %}<li>curve: {{ key.oid }}</li>{% endif %}
                    </ul>
                </li>
                {% if key.keybase %}
                    <li>Keybase:<ul>
                    {% set kb = key.keybase[0] %}
                    {% for proof in kb.proofs.values() %}
                        <li><a href="{{ proof["proof_url"] }}">{{ proof["presentation_group"] if proof["presentation_group"] != proof["nametag"] else proof["presentation_tag"] }} / {{ proof["nametag"] }}</a><strong style="color: {% if key.keybase[1] %}green"> ✔{% else %}red"> ✖{% endif %}</strong> ({{ proof["proof_id"] }})</li>
                    {% endfor %}
                    </ul></li>
                {% endif %}
                {% for sub in key.subkeys %}
                    <li><em>sub:</em> 0x{{ sub[-8:] }} ({{ sub }})
                        {# key.signatures[sub[-8:]][0][1]
                        It's horrible looking. What it means is:
                           1) lookup signatures for the specified key ID
                           2) pop the first signature off
                           3) take the first UID if applicable, else the [User ID not found] message
                     #}
                        <ul>
                            <li>{% if sub[-8:] in key.signatures %}subsig: 0x{{ key.signatures[sub[-8:]][0][0] }} ({{ key.signatures[sub[-8:]][0][1][0] if key.signatures[sub[-8:]][0][1][0] != "[" else key.signatures[sub[-8:]][0][1] }}){% else %}<strong style="color: red">UNVERIFIED</strong>{% endif %}</li>
                        </ul>
                    </li>
                {% endfor %}
                <br>
                <li>sigs:</li>
                <ul>
                    {% for sig in key.signatures[key.shortid] %}
                        <li style="white-space: pre;">{{ key.translate(sig) }} <a href="{{ url_for(".getkeyinfo", key=sig[0]) }}">{{ sig[0] }}</a> ({{ sig[1][0] if sig[1][0] != "[" else sig[1] }})</li>
                    {% endfor %}
                </ul>
            </ul>
            Download key:
            <ul>
                <li><a href="{{ url_for("user_display_keys.getkey_dl_ascii", keyid=key.shortid) }}">ASCII</a></li>
                {#<li><a href="{{ url_for("user_display_keys.getkey_dl_raw", keyid=key.shortid) }}">Raw</a></li>#}
            </ul>
            Raw key:
            <pre><code>{{ keydata }}</code></pre>
        </div>
    {% else %}
    <h3>Key not found.</h3>
    Sorry, there is no such key as {{ keyid }} on this server.
    Do you wish to <a href="{{ url_for("frontend.import_key", keyserver="", keyid=keyid) }}">import</a> it?
    {% endif %}
{% endblock %}