Skip to content

Commit 21e4377

Browse files
committed
switch to base64
1 parent e74ce10 commit 21e4377

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/utils/settings.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import * as fs from 'fs'
22
import * as os from 'os'
33
import * as path from 'path'
44

5-
// @ts-ignore no types for ascii85
6-
import ascii85 from 'ascii85'
75
import ora from 'ora'
86

97
let dataHome = process.platform === 'win32'
@@ -25,9 +23,9 @@ const settingsPath = path.join(dataHome, 'socket', 'settings')
2523
let settings = {}
2624

2725
if (fs.existsSync(settingsPath)) {
28-
const raw = fs.readFileSync(settingsPath)
26+
const raw = fs.readFileSync(settingsPath, 'utf-8')
2927
try {
30-
settings = JSON.parse(ascii85.decode(raw).toString())
28+
settings = JSON.parse(Buffer.from(raw, 'base64').toString())
3129
} catch (e) {
3230
ora(`Failed to parse settings at ${settingsPath}`).warn()
3331
}
@@ -54,6 +52,6 @@ export function updateSetting (key, value) {
5452
settings[key] = value
5553
fs.writeFileSync(
5654
settingsPath,
57-
ascii85.encode(JSON.stringify(settings))
55+
Buffer.from(JSON.stringify(settings)).toString('base64')
5856
)
5957
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"@apideck/better-ajv-errors": "^0.3.6",
8686
"@socketsecurity/config": "^2.0.0",
8787
"@socketsecurity/sdk": "^0.5.4",
88-
"ascii85": "^1.0.2",
8988
"chalk": "^5.1.2",
9089
"globby": "^13.1.3",
9190
"hpagent": "^1.2.0",

0 commit comments

Comments
 (0)