Remove old access code stuff

This commit is contained in:
Daniel Lugo 2021-12-26 16:13:32 -04:00
parent 7c6696eb88
commit 0d71c14e22

View file

@ -602,7 +602,7 @@ module.exports = async (
try { try {
const health = await checkHealth() const health = await checkHealth()
const walletInitialized = await walletExists() const walletInitialized = await walletExists()
const { alias, password, invite, accessSecret } = req.body const { alias, password } = req.body
const lndUp = health.LNDStatus.success const lndUp = health.LNDStatus.success
const trustedKeysEnabled = const trustedKeysEnabled =
process.env.TRUSTED_KEYS === 'true' || !process.env.TRUSTED_KEYS process.env.TRUSTED_KEYS === 'true' || !process.env.TRUSTED_KEYS
@ -648,17 +648,12 @@ module.exports = async (
if (!walletUnlocked) { if (!walletUnlocked) {
await unlockWallet(password) await unlockWallet(password)
} }
let secretUsed = null
if (accessSecret) {
secretUsed = await Storage.get(
`UnlockedAccessSecrets/${accessSecret}`
)
}
if ( if (
walletUnlocked && walletUnlocked &&
!authorization && !authorization &&
!isKeyTrusted && !isKeyTrusted &&
(!allowUnlockedLND || secretUsed !== false) !allowUnlockedLND
) { ) {
res.status(401).json({ res.status(401).json({
field: 'alias', field: 'alias',
@ -669,11 +664,7 @@ module.exports = async (
return return
} }
if ( if (walletUnlocked && !isKeyTrusted && !allowUnlockedLND) {
walletUnlocked &&
!isKeyTrusted &&
(!allowUnlockedLND || secretUsed !== false)
) {
const validatedToken = await validateToken( const validatedToken = await validateToken(
authorization.replace('Bearer ', '') authorization.replace('Bearer ', '')
) )
@ -689,10 +680,6 @@ module.exports = async (
} }
} }
if (secretUsed === false) {
await Storage.setItem(`UnlockedAccessSecrets/${accessSecret}`, true)
}
if (!isKeyTrusted) { if (!isKeyTrusted) {
await Storage.set('trustedPKs', [...(trustedKeys || []), publicKey]) await Storage.set('trustedPKs', [...(trustedKeys || []), publicKey])
} }