{"id":20051776,"url":"https://github.com/golangtoolkits/go-secure-sessions","last_synced_at":"2025-07-03T06:04:00.620Z","repository":{"id":75857052,"uuid":"600597862","full_name":"GolangToolKits/go-secure-sessions","owner":"GolangToolKits","description":"A new golang session module works like sessions should work. ","archived":false,"fork":false,"pushed_at":"2023-03-23T23:48:09.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T08:44:45.839Z","etag":null,"topics":["gorilla-mux","gorilla-sessions","session-cookie","session-management","sessions","sessionstorage"],"latest_commit_sha":null,"homepage":"","language":"Go","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/GolangToolKits.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":"2023-02-12T01:13:17.000Z","updated_at":"2023-03-18T07:29:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"165f8700-81eb-4235-8088-cb83dae4171b","html_url":"https://github.com/GolangToolKits/go-secure-sessions","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/GolangToolKits/go-secure-sessions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GolangToolKits%2Fgo-secure-sessions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GolangToolKits%2Fgo-secure-sessions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GolangToolKits%2Fgo-secure-sessions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GolangToolKits%2Fgo-secure-sessions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GolangToolKits","download_url":"https://codeload.github.com/GolangToolKits/go-secure-sessions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GolangToolKits%2Fgo-secure-sessions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263271505,"owners_count":23440396,"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":["gorilla-mux","gorilla-sessions","session-cookie","session-management","sessions","sessionstorage"],"created_at":"2024-11-13T12:05:50.411Z","updated_at":"2025-07-03T06:04:00.611Z","avatar_url":"https://github.com/GolangToolKits.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-secure-sessions\nA new session module to replace gorilla/sessions.\nThis go-secure-sessions is not dependant on any router.\n\nUses AES-128, AES-192, or AES-256 to store sessions as cookies.\n\n\n### Using go-secure-sessions\n\n```go\n\n    import \"github.com/GolangToolKits/go-secure-sessions\"\n\n    // securekey must be at least 16 char long\n    // The key argument should be the AES key,\n    // either 16, 24, or 32 bytes to select\n    // AES-128, AES-192, or AES-256.\n    var secretKey = \"dsdfs6dfs61dssdfsdfdsdsfsdsdllsd\"\n\n    var cf ConfigOptions\n\tcf.maxAge = 3600\n    cf.path= \"/\"\n\tsessionManager, err := NewSessionManager(secretKey, cf)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n    r, _ := http.NewRequest(\"POST\", \"/test/test1\", nil)\n    var w http.ResponseWriter\n\n    // If a session cookie already exists in the request, it is loaded\n    // Otherwise a completely new session is created with the name given\n    session := sessionManager.NewSession(r, \"new_test_sesstion\")\n\n\n    type SomeObject struct{\n        Id int\n        Name string\n    }\n\n    obj := SomeObject{\n        Id: 1,\n        Name: \"test\"\n    }\n    \n    // needed to serialize and deserialize this object\n    gob.Register(SomeObject{})\n\n    //set some session values\n    session.Set(\"test1\", \"some test1 value\")\n    session.Set(\"test2\", \"some test2 value\")\n    session.Set(\"test3\", obj)\n    // save the session before quitting or the values will be lost\n    // session is saved securly as a cookie in the user's browser\n    err:= session.Save(w)\n    if err != nil{\n        log.Println(\"Session not saved\")\n    }\n\n    // Read a value out of the session\n    v1:= session.Get(\"test1\")\n    fmt.Println(v1)\n\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolangtoolkits%2Fgo-secure-sessions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolangtoolkits%2Fgo-secure-sessions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolangtoolkits%2Fgo-secure-sessions/lists"}