lazy-loading of tssrp6a
Massimo Melina committed
Jan 5, 2026 at 14:34 UTC
f3e6401761f47cefca8a2dbb214a5b9ef385f5ca
2 files changed
+2
-3
frontend/src/UserPanel.ts
+1
-1
@@ -3,7 +3,6 @@
3
import { state, useSnapState } from './state'
4
import { createElement as h } from 'react'
5
import { alertDialog, newDialog, promptDialog } from './dialog'
6
-import { createVerifierAndSalt, SRPParameters, SRPRoutines } from 'tssrp6a'
6
import { apiCall } from '@hfs/shared/api'
7
import { logout } from './login'
8
import { Btn, CustomCode } from './components'
@@ -54,6 +53,7 @@ export async function changePassword(required=false) {
53
if (!check) return
54
if (check !== pwd)
55
return alertDialog(t('pass2_mismatch', "The second password you entered did not match the first. Procedure aborted."), 'warning')
56
+ const { createVerifierAndSalt, SRPParameters, SRPRoutines } = await import('tssrp6a')
57
const srp6aNimbusRoutines = new SRPRoutines(new SRPParameters())
58
const res = await createVerifierAndSalt(srp6aNimbusRoutines, state.username, pwd)
59
try {
src/srp.ts
+1
-2
@@ -1,7 +1,5 @@
1
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3
-import { SRPClientSession, SRPParameters, SRPRoutines } from 'tssrp6a'
4
-
3
export async function srpClientSequence(username:string, password:string, apiCall: (cmd:string, params:any) => any, extra?: object) {
4
const { pubKey, salt } = await apiCall('loginSrp1', { username })
5
if (!salt) throw Error('salt')
@@ -12,6 +10,7 @@ export async function srpClientSequence(username:string, password:string, apiCal
10
}
11
12
export async function srpClientPart(username: string, password: string, salt: string, pubKey: string) {
13
+ const { SRPClientSession, SRPParameters, SRPRoutines } = await import('tssrp6a')
14
const srp6aNimbusRoutines = new SRPRoutines(new SRPParameters())
15
const srpClient = new SRPClientSession(srp6aNimbusRoutines);
16
const res = await srpClient.step1(username, password)