-
-
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
9d55218
commit b152914
Showing
4 changed files
with
118 additions
and
10 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,80 @@ | ||
<template> | ||
<div> | ||
|
||
<!-- no key --> | ||
<div v-if="channel.settings.psk == null || channel.settings.psk.length === 0"> | ||
<div class="flex space-x-1 bg-gray-50 rounded-md px-2 py-1 text-xs text-gray-700 border border-gray-700 font-medium"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4"> | ||
<path fill-rule="evenodd" d="M14.5 1A4.5 4.5 0 0 0 10 5.5V9H3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-1.5V5.5a3 3 0 1 1 6 0v2.75a.75.75 0 0 0 1.5 0V5.5A4.5 4.5 0 0 0 14.5 1Z" clip-rule="evenodd" /> | ||
</svg> | ||
</div> | ||
<div>No Key</div> | ||
</div> | ||
</div> | ||
|
||
<!-- default key --> | ||
<div v-else-if="isDefaultPsk(channel.settings.psk)"> | ||
<div class="flex space-x-1 bg-gray-50 rounded-md px-2 py-1 text-xs text-gray-700 border border-gray-700 font-medium"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4"> | ||
<path fill-rule="evenodd" d="M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z" clip-rule="evenodd" /> | ||
</svg> | ||
</div> | ||
<div>Default Key</div> | ||
</div> | ||
</div> | ||
|
||
<!-- 8-bit key --> | ||
<div v-else-if="channel.settings.psk.length === 1"> | ||
<div class="flex space-x-1 bg-yellow-50 rounded-md px-2 py-1 text-xs text-yellow-700 border border-yellow-700 font-medium"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4"> | ||
<path fill-rule="evenodd" d="M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z" clip-rule="evenodd" /> | ||
</svg> | ||
</div> | ||
<div>8-Bit Key</div> | ||
</div> | ||
</div> | ||
|
||
<!-- 128-bit key --> | ||
<div v-else-if="channel.settings.psk.length === 16"> | ||
<div class="flex space-x-1 bg-green-50 rounded-md px-2 py-1 text-xs text-green-700 border border-green-700 font-medium"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4"> | ||
<path fill-rule="evenodd" d="M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z" clip-rule="evenodd" /> | ||
</svg> | ||
</div> | ||
<div>128-Bit Key</div> | ||
</div> | ||
</div> | ||
|
||
<!-- 256-bit key --> | ||
<div v-else-if="channel.settings.psk.length === 32"> | ||
<div class="flex space-x-1 bg-green-50 rounded-md px-2 py-1 text-xs text-green-700 border border-green-700 font-medium"> | ||
<div> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4"> | ||
<path fill-rule="evenodd" d="M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z" clip-rule="evenodd" /> | ||
</svg> | ||
</div> | ||
<div>256-Bit Key</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</template> | ||
|
||
<script> | ||
import SecurityUtils from "../../js/SecurityUtils.js"; | ||
export default { | ||
name: 'ChannelPskBadge', | ||
props: { | ||
channel: Object, | ||
}, | ||
methods: { | ||
isDefaultPsk: (psk) => SecurityUtils.isDefaultPsk(psk), | ||
}, | ||
} | ||
</script> |
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
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
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,10 @@ | ||
class SecurityUtils { | ||
|
||
static isDefaultPsk(pskAsUInt8Array) { | ||
// default psk is 1 byte (8 bits) and is equal to 0x1 and is also known as "AQ==" | ||
return pskAsUInt8Array != null && pskAsUInt8Array.length === 1 && pskAsUInt8Array[0] === 0x1; | ||
} | ||
|
||
} | ||
|
||
export default SecurityUtils; |