MCPcopy Create free account
hub / github.com/Noumena-Network/code / update

Function update

src/utils/secureStorage/plainTextStorage.ts:78–103  ·  view source on GitHub ↗
(data: SecureStorageData)

Source from the content-addressed store, hash-verified

76 return null
77 },
78 update(data: SecureStorageData): { success: boolean; warning?: string } {
79 // sync IO: called from sync context (SecureStorage interface)
80 try {
81 const { storageDir, storagePath } = getStoragePath()
82 try {
83 getFsImplementation().mkdirSync(storageDir)
84 } catch (e: unknown) {
85 const code = getErrnoCode(e)
86 if (code !== 'EEXIST') {
87 throw e
88 }
89 }
90
91 writeFileSync_DEPRECATED(storagePath, jsonStringify(data), {
92 encoding: 'utf8',
93 flush: false,
94 })
95 chmodSync(storagePath, 0o600)
96 return {
97 success: true,
98 warning: 'Warning: Storing credentials in plaintext.',
99 }
100 } catch {
101 return { success: false }
102 }
103 },
104 delete(): boolean {
105 // sync IO: called from sync context (SecureStorage interface)
106 const { storagePath } = getStoragePath()

Callers

nothing calls this directly

Calls 5

getStoragePathFunction · 0.85
getFsImplementationFunction · 0.85
getErrnoCodeFunction · 0.85
writeFileSync_DEPRECATEDFunction · 0.85
jsonStringifyFunction · 0.85

Tested by

no test coverage detected