public void Write(byte[] data) { _logger.LogInformation("Before write to mac keychain"); MacKeyChain.WriteKey(_keyChainServiceName, _keyChainAccountName, data); _logger.LogInformation("After write to mac keychain"); // Change data to 1 byte so we can write it to the cache file to update the last write time using the same write code used for windows. FileIOWithRetries.WriteDataToFile(_cacheFilePath, new byte[] { 1 }, _logger); }
public void Write(byte[] data) { _logger.LogInformation("Before saving to linux keyring"); IntPtr error = IntPtr.Zero; Libsecret.secret_password_store_sync( schema: GetLibsecretSchema(), collection: _keyringCollection, label: _keyringSecretLabel, password: Convert.ToBase64String(data), cancellable: IntPtr.Zero, error: out error, attribute1Type: _attributeKey1, attribute1Value: _attributeValue1, attribute2Type: _attributeKey2, attribute2Value: _attributeValue2, end: IntPtr.Zero); if (error != IntPtr.Zero) { try { GError err = (GError)Marshal.PtrToStructure(error, typeof(GError)); _logger.LogError($"An error was encountered while saving secret to keyring in the {nameof(MsalCacheStorage)} domain:'{err.Domain}' code:'{err.Code}' message:'{err.Message}'"); } catch (Exception e) { _logger.LogError($"An exception was encountered while processing libsecret error information during saving in the {nameof(MsalCacheStorage)} ex:'{e}'"); } } _logger.LogInformation("After saving to linux keyring"); // Change data to 1 byte so we can write it to the cache file to update the last write time using the same write code used for windows. FileIOWithRetries.WriteDataToFile(_cacheFilePath, new byte[] { 1 }, _logger); }
public void Write(byte[] data) { FileIOWithRetries.WriteDataToFile(_cacheFilePath, data, _logger); }