-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c77b32
commit b6be403
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup lang="ts"> | ||
import { computed } from 'vue'; | ||
const props = defineProps<{ | ||
fingerprint: string | ||
}>(); | ||
// There's nothing particularly special about this format but it's the same as the GPG CLI prints and | ||
// it's what people are used to looking at for GPG keys. Hopefully that means its a little easier to | ||
// 40 characters grouped together. | ||
const fingerprintDisplay = computed(() => { | ||
// It's a 160 bit hash, so 20 bytes, in hex is 40 characters | ||
if (!props.fingerprint || props.fingerprint.length != 40) return ''; | ||
let repr = ''; | ||
for (let i = 0; i < 40; i += 4) { | ||
repr += props.fingerprint.slice(i, i + 4) + ' '; | ||
if (i === 20) repr += ' '; | ||
} | ||
return repr.trim(); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span>{{ fingerprintDisplay }}</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters