<script lang="ts">
  import SectionTitle from "./SectionTitle.svelte";
  const ssh: string =
    "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN8CKkq7m/FPTqjAO3yGWhH7y+9flDjyNC9hQFenvbKs toufy";
  const pgp: string = `-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEaXaizxYJKwYBBAHaRw8BAQdARrftn56656s3XyW15b3DBMTcrvCvcRjOs53P
tVsrsGC0EXRvdWZpYyBhciAodG91ZnkpiJAEExYKADgWIQRKDkdYNWjksRtcJVm7
ozAX4p50+wUCaXaizwIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRC7ozAX
4p50+2gTAP9pFdyrNoOsOkdkcaBzIs9CZfkf38ZQsdi8vZsdXtquSAEAyaqVsXCN
tpMn3/ax/034uY0wAVa9WluqWcvGK+jb7we4OARpdqLPEgorBgEEAZdVAQUBAQdA
YQqEaD8/QXfS9rU471nhxbB1bHANd/NAG8TG1mJeLFkDAQgHiHgEGBYKACAWIQRK
DkdYNWjksRtcJVm7ozAX4p50+wUCaXaizwIbDAAKCRC7ozAX4p50+3PEAP0abVGS
7KLZCqJRjsRfhNP0IrveTuKrW5hckVu4GNgkCQEAtXHhO8Kj6l41m6v36AWddSUz
iv6s3F2Wfm3pjizriQc=
=w8/B
-----END PGP PUBLIC KEY BLOCK-----`;
</script>

<SectionTitle title="keys">my public keys</SectionTitle>
<div
  class="flex flex-col w-auto max-w-full bg-base-300 p-4 rounded-md
  self-start"
>
  <h3 class="flex flex-row place-items-center text-xl">
    <span class="font-extrabold text-accent">SSH</span>
    <button
      title="copy"
      id="sshCopyBtn"
      class="font-extrabold text-secondary cursor-pointer
	  active:text-primary"><span class="iconify-[fa7-regular--copy]"></span></button
    >
    <input type="hidden" id="sshKeyValue" value={ssh} />
  </h3>
  <pre class="bg-neutral p-2 my-2 rounded-md overflow-scroll"><code>{ssh}</code
    ></pre>
  <h3 class="flex flex-row place-items-center text-xl">
    <span class="font-extrabold text-accent">PGP</span>
    <button
      title="copy"
      id="pgpCopyBtn"
      class="font-extrabold text-secondary cursor-pointer
	  active:text-primary"><span class="iconify-[fa7-regular--copy]"></span></button
    >
    <input type="hidden" id="pgpKeyValue" value={pgp} />
  </h3>
  <pre class="bg-neutral p-2 my-2 rounded-md overflow-scroll"><code>{pgp}</code
    ></pre>
  <script>
    function copyKey(key) {
      navigator.clipboard.writeText(key);
    }
    document.getElementById("sshCopyBtn").onclick = () =>
      copyKey(document.getElementById("sshKeyValue").value);
    document.getElementById("pgpCopyBtn").onclick = () =>
      copyKey(document.getElementById("pgpKeyValue").value);
  </script>
</div>
