must hold lock
()
| 42 | |
| 43 | // must hold lock |
| 44 | func getLinuxStorageBackend() error { |
| 45 | if runtime.GOOS != "linux" { |
| 46 | return nil |
| 47 | } |
| 48 | |
| 49 | rpcClient := wshclient.GetBareRpcClient() |
| 50 | ctx, cancel := context.WithTimeout(context.Background(), EncryptionTimeout*time.Millisecond) |
| 51 | defer cancel() |
| 52 | |
| 53 | encryptData := wshrpc.CommandElectronEncryptData{ |
| 54 | PlainText: "hello", |
| 55 | } |
| 56 | rpcOpts := &wshrpc.RpcOpts{ |
| 57 | Route: wshutil.ElectronRoute, |
| 58 | Timeout: EncryptionTimeout, |
| 59 | } |
| 60 | |
| 61 | result, err := wshclient.ElectronEncryptCommand(rpcClient, encryptData, rpcOpts) |
| 62 | if err != nil { |
| 63 | return fmt.Errorf("failed to get storage backend: %w", err) |
| 64 | } |
| 65 | |
| 66 | if ctx.Err() != nil { |
| 67 | return fmt.Errorf("encryption timeout: %w", ctx.Err()) |
| 68 | } |
| 69 | |
| 70 | if result.StorageBackend != "" { |
| 71 | linuxStorageBackend = result.StorageBackend |
| 72 | } |
| 73 | |
| 74 | return nil |
| 75 | } |
| 76 | |
| 77 | // must hold lock |
| 78 | func readSecretsFromFile() (map[string]string, error) { |
no test coverage detected