{"id":18738018,"url":"https://github.com/ace4896/dbus.services.secrets","last_synced_at":"2025-07-05T11:40:48.750Z","repository":{"id":162009096,"uuid":"617070740","full_name":"Ace4896/DBus.Services.Secrets","owner":"Ace4896","description":"High-level .NET bindings for the D-Bus Secret Service API.","archived":false,"fork":false,"pushed_at":"2024-02-21T20:50:24.000Z","size":74,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-27T05:41:56.188Z","etag":null,"topics":["csharp","d-bus","dotnet"],"latest_commit_sha":null,"homepage":"https://ace4896.github.io/DBus.Services.Secrets/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ace4896.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-21T16:36:01.000Z","updated_at":"2025-04-14T22:01:40.000Z","dependencies_parsed_at":"2024-11-07T15:36:55.256Z","dependency_job_id":"a952a240-710d-4449-8b8b-c2b689a8f14b","html_url":"https://github.com/Ace4896/DBus.Services.Secrets","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Ace4896/DBus.Services.Secrets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ace4896%2FDBus.Services.Secrets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ace4896%2FDBus.Services.Secrets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ace4896%2FDBus.Services.Secrets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ace4896%2FDBus.Services.Secrets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ace4896","download_url":"https://codeload.github.com/Ace4896/DBus.Services.Secrets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ace4896%2FDBus.Services.Secrets/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263735423,"owners_count":23503509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","d-bus","dotnet"],"created_at":"2024-11-07T15:27:52.300Z","updated_at":"2025-07-05T11:40:48.731Z","avatar_url":"https://github.com/Ace4896.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DBus.Services.Secrets\n\nHigh-level .NET bindings for the [D-Bus Secret Service API](https://specifications.freedesktop.org/secret-service/latest/).\n\nThese bindings were made using [Tmds.DBus.Protocol](https://github.com/tmds/Tmds.DBus) and [Tmds.DBus.SourceGenerator](https://github.com/affederaffe/Tmds.DBus.SourceGenerator), making them trimmer and AOT friendly.\n\n## Requirements\n\nThe bindings target .NET 6.0, .NET 7.0 and .NET 8.0.\n\n## Basic Usage\n\nTo get started, add a reference to the [`Ace4896.DBus.Services.Secrets` NuGet package](https://www.nuget.org/packages/Ace4896.DBus.Services.Secrets/).\n\nThe example below shows how to create and retrieve a secret value in the default collection:\n\n```csharp\n// Connect to the D-Bus Secret Service API\n// Sessions can use either plaintext or encrypted transport\nSecretService secretService = await SecretService.ConnectAsync(EncryptionType.Dh);  // DH Key Agreement for Encryption\n\n// Items are stored in within collections\n// Collections can be retrieved using their alias\n// Note that collection retrieval can fail, so this would need to be handled\nCollection? defaultCollection = await secretService.GetDefaultCollectionAsync();\nif (defaultCollection == null)\n{\n    // ... handle case where collection is not found\n}\n\n// Items are created with the following:\n// - Label - The displayed label in e.g. GNOME Keyring, KWallet etc.\n// - Lookup Attributes - These are used to search for the item later\n// - Secret - The secret value as a byte array\n// - Content Type - A content type hint for the secret value\nstring itemLabel = \"MySecretValue\";\nDictionary\u003cstring, string\u003e lookupAttributes = new()\n{\n    { \"my-lookup-attribute\", \"my-lookup-attribute-value\" }\n};\n\nbyte[] secretValue = Encoding.UTF8.GetBytes(\"my secret value\");\nstring contentType = \"text/plain; charset=utf8\";\n\n// Note that item creation can fail, e.g. if the collection could not be unlocked\nItem? createdItem = await defaultCollection.CreateItemAsync(label, lookupAttributes, secretBytes, contentType, true);\nif (createdItem == null)\n{\n    // ... handle case where item creation failed\n}\n\n// Later, if we want to retrieve this secret value, we need to search using the same lookup attributes\n// Note that it's possible for multiple items to match the provided lookup attributes\nItem[] matchedItems = await defaultCollection.SearchItemsAsync(lookupAttributes);\nforeach (Item matchedItem in matchedItems)\n{\n    byte[] matchedSecret = await item.GetSecretAsync();\n    string matchedSecretString = Encoding.UTF8.GetString(secret);   // my secret value\n}\n```\n\n## Documentation\n\nThe API documentation is auto-generated using [docfx](https://dotnet.github.io/docfx/index.html), and can be found [here](https://ace4896.github.io/DBus.Services.Secrets/).\n\nTo preview the generated documentation locally, run `docfx docfx_project/docfx.json --serve`, which will serve the website at http://localhost:8080.\n\n## License\n\nThese bindings are licensed under the [MIT License](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Face4896%2Fdbus.services.secrets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Face4896%2Fdbus.services.secrets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Face4896%2Fdbus.services.secrets/lists"}