{"id":25177468,"url":"https://github.com/borud/nethsm","last_synced_at":"2025-04-04T02:40:33.688Z","repository":{"id":278050686,"uuid":"934270827","full_name":"borud/nethsm","owner":"borud","description":"NetHSM Client library","archived":false,"fork":false,"pushed_at":"2025-02-28T15:45:15.000Z","size":138,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T19:45:39.231Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/borud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-02-17T14:55:56.000Z","updated_at":"2025-02-28T15:45:18.000Z","dependencies_parsed_at":"2025-02-17T18:52:32.452Z","dependency_job_id":null,"html_url":"https://github.com/borud/nethsm","commit_stats":null,"previous_names":["borud/nethsm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fnethsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fnethsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fnethsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fnethsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borud","download_url":"https://codeload.github.com/borud/nethsm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247112739,"owners_count":20885605,"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":["golang","golang-library","nethsm","openapi","rest-api","rest-client"],"created_at":"2025-02-09T14:25:22.303Z","updated_at":"2025-04-04T02:40:33.682Z","avatar_url":"https://github.com/borud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go library for Nitrokey NetHSM\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/borud/nethsm.svg)](https://pkg.go.dev/github.com/borud/nethsm)\n\n\nThis is a Go library for working with the [Nitrokey NetHSM](https://www.nitrokey.com/products/nethsm).  It provides a wrapper around the API types that are generated from the OpenAPI specification to make life a bit easier for those using Nitrokey NetHSM.\n\n## WARNING\n\n**Note that this is a work in progress**. The API **will** have breaking changes  before this reaches release version v1.0.0 so use this at your own risk.\n\n### Generated Types\n\nWhere it makes sense we use the generated types in the API rather than create our own.  This results in less code to maintain, but may break things when new versions of the OpenAPI spec is published.\n\n## Usage example\n\nThis example shows how to get information about the NetHSM instance, create a key, get its public key and then remove it.  Examples can be found in the [examples](examples/) directory.\n\n```go\npackage main\n\nimport (\n    \"log/slog\"\n\n    \"github.com/borud/nethsm\"\n    \"github.com/borud/nethsm/api\"\n)\n\nfunc main() {\n    session := nethsm.Session{\n        Username:      \"admin\",\n        Password:      \"verysecret\",\n        APIURL:        \"https://127.0.0.1:8443/api/v1\",\n        TLSMode:  nethsm.TLSModeSkipVerify,\n    }\n\n    // Get information about vendor and product\n    info, err := session.GetInfo()\n    if err != nil {\n        slog.Error(\"error getting info\", \"err\", err)\n        return\n    }\n    slog.Info(\"Information about NetHSM\", \"product\", info.Product, \"vendor\", info.Vendor)\n\n    // Create an RSA key\n    rsaKeyID := \"myRSAKey\"\n    err = session.GenerateKey(\n        rsaKeyID,\n        api.KEYTYPE_RSA,\n        []api.KeyMechanism{api.KEYMECHANISM_RSA_SIGNATURE_PSS_SHA512},\n        2048)\n    if err != nil {\n        slog.Error(\"error creating key\", \"keyID\", rsaKeyID, \"err\", err)\n        return\n    }\n    slog.Info(\"created key\", \"keyID\", rsaKeyID)\n\n    // Get public key\n    pub, err := session.GetPublicKey(rsaKeyID)\n    if err != nil {\n        slog.Error(\"error fetching public key\", \"keyID\", rsaKeyID, \"err\", err)\n        return\n    }\n    slog.Info(\"fetched public key\", \"keyID\", rsaKeyID, \"publicKey\", pub)\n\n    // Delete key\n    err = session.DeleteKey(rsaKeyID)\n    if err != nil {\n        slog.Error(\"failed to delete key\", \"keyID\", rsaKeyID, \"err\", err)\n    }\n    slog.Info(\"deleted key\", \"keyID\", rsaKeyID)\n}\n```\n\n## Completeness\n\nThis library does not support\n\n- Tags\n- Network configuration\n- Reboot\n- Software update\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Fnethsm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborud%2Fnethsm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Fnethsm/lists"}