mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
perf(ssh-key-generators): Added debounce to key pair generators (#249)
Added debounce to the "passphrase" and "comment" fields to prevent the computationally expensive key generator from running on each keystroke. The debounce is added to the RSA, ECDSA and ED25519 key pair generators --------- Co-authored-by: sharevb <sharevb@gmail.com>
This commit is contained in:
1 parent
32a680faf1
commit
c24f94ce4c
4 files changed
+12
-48
No files matched your search
Vendored
-42
@@ -233,17 +233,10 @@ declare module '@vue/runtime-core' {
|
||||
'IconMdi:brushVariant': typeof import('~icons/mdi/brush-variant')['default']
|
||||
'IconMdi:contentCopy': typeof import('~icons/mdi/content-copy')['default']
|
||||
'IconMdi:kettleSteamOutline': typeof import('~icons/mdi/kettle-steam-outline')['default']
|
||||
IconMdiArrowDown: typeof import('~icons/mdi/arrow-down')['default']
|
||||
IconMdiArrowRightBottom: typeof import('~icons/mdi/arrow-right-bottom')['default']
|
||||
IconMdiArrowUp: typeof import('~icons/mdi/arrow-up')['default']
|
||||
IconMdiCamera: typeof import('~icons/mdi/camera')['default']
|
||||
IconMdiCheck: typeof import('~icons/mdi/check')['default']
|
||||
IconMdiChevronDown: typeof import('~icons/mdi/chevron-down')['default']
|
||||
IconMdiChevronRight: typeof import('~icons/mdi/chevron-right')['default']
|
||||
IconMdiClose: typeof import('~icons/mdi/close')['default']
|
||||
IconMdiContentCopy: typeof import('~icons/mdi/content-copy')['default']
|
||||
IconMdiDeleteOutline: typeof import('~icons/mdi/delete-outline')['default']
|
||||
IconMdiDownload: typeof import('~icons/mdi/download')['default']
|
||||
IconMdiEye: typeof import('~icons/mdi/eye')['default']
|
||||
IconMdiEyeOff: typeof import('~icons/mdi/eye-off')['default']
|
||||
IconMdiHeart: typeof import('~icons/mdi/heart')['default']
|
||||
@@ -378,66 +371,31 @@ declare module '@vue/runtime-core' {
|
||||
'NanoMemo.content': typeof import('./src/tools/nano-memo/nano-memo.content.md')['default']
|
||||
NAutoComplete: typeof import('naive-ui')['NAutoComplete']
|
||||
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCard: typeof import('naive-ui')['NCard']
|
||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
||||
NCode: typeof import('naive-ui')['NCode']
|
||||
NCollapse: typeof import('naive-ui')['NCollapse']
|
||||
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
|
||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
|
||||
NDynamicTags: typeof import('naive-ui')['NDynamicTags']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NEmpty: typeof import('naive-ui')['NEmpty']
|
||||
NForm: typeof import('naive-ui')['NForm']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NGi: typeof import('naive-ui')['NGi']
|
||||
NginxFormatter: typeof import('./src/tools/nginx-formatter/nginx-formatter.vue')['default']
|
||||
NginxMemo: typeof import('./src/tools/nginx-memo/nginx-memo.vue')['default']
|
||||
'NginxMemo.content': typeof import('./src/tools/nginx-memo/nginx-memo.content.md')['default']
|
||||
NGrid: typeof import('naive-ui')['NGrid']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH2: typeof import('naive-ui')['NH2']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NicewareBytesToPassphrase: typeof import('./src/tools/niceware-bytes-to-passphrase/niceware-bytes-to-passphrase.vue')['default']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NImage: typeof import('naive-ui')['NImage']
|
||||
NInput: typeof import('naive-ui')['NInput']
|
||||
NInputGroup: typeof import('naive-ui')['NInputGroup']
|
||||
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
NInputNumberI18n: typeof import('./src/ui/n-input-number-i18n/n-input-number-i18n.vue')['default']
|
||||
'NInputNumberI18n.demo': typeof import('./src/ui/n-input-number-i18n/n-input-number-i18n.demo.vue')['default']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NLi: typeof import('naive-ui')['NLi']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NModal: typeof import('naive-ui')['NModal']
|
||||
NP: typeof import('naive-ui')['NP']
|
||||
NProgress: typeof import('naive-ui')['NProgress']
|
||||
NRadio: typeof import('naive-ui')['NRadio']
|
||||
NRadioButton: typeof import('naive-ui')['NRadioButton']
|
||||
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||
NRate: typeof import('naive-ui')['NRate']
|
||||
NResult: typeof import('naive-ui')['NResult']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSelect: typeof import('naive-ui')['NSelect']
|
||||
NSlider: typeof import('naive-ui')['NSlider']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NStatistic: typeof import('naive-ui')['NStatistic']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
NTabPane: typeof import('naive-ui')['NTabPane']
|
||||
NTabs: typeof import('naive-ui')['NTabs']
|
||||
NTag: typeof import('naive-ui')['NTag']
|
||||
NText: typeof import('naive-ui')['NText']
|
||||
NTimePicker: typeof import('naive-ui')['NTimePicker']
|
||||
NTooltip: typeof import('naive-ui')['NTooltip']
|
||||
NTree: typeof import('naive-ui')['NTree']
|
||||
NUl: typeof import('naive-ui')['NUl']
|
||||
|
||||
@@ -11,6 +11,8 @@ const { t } = useI18n();
|
||||
|
||||
const password = ref('');
|
||||
const comment = ref('');
|
||||
const debouncedComment = useDebounce(comment, 250);
|
||||
const debouncedPassword = useDebounce(password, 250);
|
||||
const emptyCerts = { publicKey: '', privateKey: '' };
|
||||
const curve = useITStorage('ecdsa-key-pair-generator:curve', 'nistp256');
|
||||
const curveOptions = [
|
||||
@@ -32,10 +34,10 @@ const supportsPassphrase = computed(() => format.value === 'ssh');
|
||||
const [certs, refreshCerts] = computedRefreshableAsync(
|
||||
() => withDefaultOnErrorAsync(() => generateKeyPair(
|
||||
{
|
||||
password: password.value,
|
||||
password: debouncedPassword.value,
|
||||
format: format.value as sshpk.PrivateKeyFormatType,
|
||||
curve: curve.value as sshpk.CurveType,
|
||||
comment: comment.value,
|
||||
comment: debouncedComment.value,
|
||||
},
|
||||
), emptyCerts),
|
||||
emptyCerts,
|
||||
|
||||
@@ -11,6 +11,8 @@ const { t } = useI18n();
|
||||
|
||||
const password = ref('');
|
||||
const comment = ref('');
|
||||
const debouncedComment = useDebounce(comment, 250);
|
||||
const debouncedPassword = useDebounce(password, 250);
|
||||
const emptyCerts = { publicKey: '', privateKey: '' };
|
||||
|
||||
const format = useITStorage('ed25519-key-pair-generator:format', 'ssh');
|
||||
@@ -27,9 +29,9 @@ const supportsPassphrase = computed(() => format.value === 'ssh');
|
||||
const [certs, refreshCerts] = computedRefreshableAsync(
|
||||
() => withDefaultOnErrorAsync(() => generateKeyPair(
|
||||
{
|
||||
password: password.value,
|
||||
password: debouncedPassword.value,
|
||||
format: format.value as sshpk.PrivateKeyFormatType,
|
||||
comment: comment.value,
|
||||
comment: debouncedComment.value,
|
||||
},
|
||||
), emptyCerts),
|
||||
emptyCerts,
|
||||
|
||||
@@ -13,6 +13,8 @@ const { t } = useI18n();
|
||||
const bits = ref(2048);
|
||||
const comment = ref('');
|
||||
const password = ref('');
|
||||
const debouncedComment = useDebounce(comment, 250);
|
||||
const debouncedPassword = useDebounce(password, 250);
|
||||
const emptyCerts = { publicKey: '', privateKey: '' };
|
||||
|
||||
const format = useITStorage('rsa-key-pair-generator:format', 'ssh');
|
||||
@@ -40,9 +42,9 @@ const { attrs: bitsValidationAttrs } = useValidation({
|
||||
const [certs, refreshCerts] = computedRefreshableAsync(
|
||||
() => withDefaultOnErrorAsync(() => generateKeyPair({
|
||||
bits: bits.value,
|
||||
password: password.value,
|
||||
password: debouncedPassword.value,
|
||||
format: format.value as sshpk.PrivateKeyFormatType,
|
||||
comment: comment.value,
|
||||
comment: debouncedComment.value,
|
||||
}), emptyCerts),
|
||||
emptyCerts,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user