Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5708972d authored by Akhil's avatar Akhil 🙂
Browse files

Merge branch 'dev/fix-jslint' into 'main'

fix: ignore extraneous import warning for libsodium

See merge request !233
parents dc1d0fb4 ab9c6f9b
Loading
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
// eslint-disable-next-line n/no-extraneous-import
import sodium from 'libsodium-wrappers'
import DefaultClassLoader from 'passwords-client/default-class-loader'

@@ -5,6 +6,7 @@ const classLoader = new DefaultClassLoader()
const BasePWDv1Challenge = classLoader._classes['challenge.pwdv1']

export default class PWDv1Challenge extends BasePWDv1Challenge {

	constructor(data = {}) {
		super(data)
	}
@@ -24,7 +26,7 @@ export default class PWDv1Challenge extends BasePWDv1Challenge {
		const genericHash = sodium.crypto_generichash(
			sodium.crypto_generichash_BYTES_MAX,
			new Uint8Array([...sodium.from_string(this._password), ...passwordSalt]),
			genericHashKey
			genericHashKey,
		)

		const passwordHash = sodium.crypto_pwhash(
@@ -33,7 +35,7 @@ export default class PWDv1Challenge extends BasePWDv1Challenge {
			passwordHashSalt,
			sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE,
			sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE,
			sodium.crypto_pwhash_ALG_DEFAULT
			sodium.crypto_pwhash_ALG_DEFAULT,
		)

		return sodium.to_hex(passwordHash)
@@ -47,7 +49,7 @@ export default class PWDv1Challenge extends BasePWDv1Challenge {
		const genericHash = sodium.crypto_generichash(
			sodium.crypto_generichash_BYTES_MAX,
			new Uint8Array([...sodium.from_string(this._password), ...passwordSalt]),
			genericHashKey
			genericHashKey,
		)

		const passwordHashSalt = sodium.randombytes_buf(sodium.crypto_pwhash_SALTBYTES)
@@ -57,7 +59,7 @@ export default class PWDv1Challenge extends BasePWDv1Challenge {
			passwordHashSalt,
			sodium.crypto_pwhash_OPSLIMIT_INTERACTIVE,
			sodium.crypto_pwhash_MEMLIMIT_INTERACTIVE,
			sodium.crypto_pwhash_ALG_DEFAULT
			sodium.crypto_pwhash_ALG_DEFAULT,
		)

		return {
@@ -69,4 +71,5 @@ export default class PWDv1Challenge extends BasePWDv1Challenge {
			secret: sodium.to_hex(passwordHash),
		}
	}

}