(data: SecureStorageData)
| 42 | } |
| 43 | }, |
| 44 | update(data: SecureStorageData): { success: boolean; warning?: string } { |
| 45 | // sync IO: called from sync context (SecureStorage interface) |
| 46 | try { |
| 47 | const { storageDir, storagePath } = getStoragePath() |
| 48 | try { |
| 49 | getFsImplementation().mkdirSync(storageDir) |
| 50 | } catch (e: unknown) { |
| 51 | const code = getErrnoCode(e) |
| 52 | if (code !== 'EEXIST') { |
| 53 | throw e |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | writeFileSync_DEPRECATED(storagePath, jsonStringify(data), { |
| 58 | encoding: 'utf8', |
| 59 | flush: false, |
| 60 | }) |
| 61 | chmodSync(storagePath, 0o600) |
| 62 | return { |
| 63 | success: true, |
| 64 | warning: 'Warning: Storing credentials in plaintext.', |
| 65 | } |
| 66 | } catch { |
| 67 | return { success: false } |
| 68 | } |
| 69 | }, |
| 70 | delete(): boolean { |
| 71 | // sync IO: called from sync context (SecureStorage interface) |
| 72 | const { storagePath } = getStoragePath() |
nothing calls this directly
no test coverage detected