{"id":34134057,"url":"https://github.com/dwnajdz/swt","last_synced_at":"2026-03-10T09:02:43.588Z","repository":{"id":62865531,"uuid":"544083493","full_name":"dwnajdz/swt","owner":"dwnajdz","description":"encoding data like JWT token","archived":false,"fork":false,"pushed_at":"2023-07-01T21:23:06.000Z","size":302,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-17T12:27:46.949Z","etag":null,"topics":["always-on-top","shitty-code"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dwnajdz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-10-01T15:48:53.000Z","updated_at":"2024-01-24T20:46:43.000Z","dependencies_parsed_at":"2023-01-22T07:19:07.096Z","dependency_job_id":null,"html_url":"https://github.com/dwnajdz/swt","commit_stats":null,"previous_names":["dwnajdz/swt","wspirrat/swt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dwnajdz/swt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwnajdz%2Fswt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwnajdz%2Fswt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwnajdz%2Fswt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwnajdz%2Fswt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dwnajdz","download_url":"https://codeload.github.com/dwnajdz/swt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwnajdz%2Fswt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30328272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["always-on-top","shitty-code"],"created_at":"2025-12-15T01:17:39.166Z","updated_at":"2026-03-10T09:02:43.558Z","avatar_url":"https://github.com/dwnajdz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swt\nSWT (Secure Web Token) is an standard used to share information between two entities, usually a client (like your app's frontend) and a server (your app's backend).\n## Example login application\n![Alt Text](login_example.gif)\n## How to install?\nIn order to install swt follow the instructions:\n```\ngo get github.com/dwnajdz/swt\n```\nAfter that you are ready to use swt library!\n## How it works?\nInside swt.go file is created config which contains private key. Private key is used for aes encoding of SWT struct. Key is created randomly and every time you run the script the value of key is other. EncodeSWT() function creates SWT{} struct which contains payload. SWT struct is then encoded with gob to binary and after that to string encrypted with aes and base64. DecodeSWT() reads the string decrypt it with the key and then read binary. After reading binary it is assigned to SWT{} and then returned to user.\n## How to use?\nSWT have two main function **EncodeSWT(value)** and **DecodeSWT(payload)**. \n- EncodeSWT encode given value of map[string]interface{} to string. In order to use it:\n```go\nimport (\n  \"fmt\"\n  \n  \"github.com/wspirrat/swt/swt\"\n)\n\nfunc main() {\n  m := make(map[string]interface{})\n  // m[key] = value\n  m[\"myStringValue\"] = \"hello :)\"\n  m[\"myint\"] = 1\n  m[\"mybool\"] = true\n  // also you can use any value that you want structs, bytes etc.\n  // we use custom as we are using map\n  encoded := swt.EncodeSWTcustom(m)\n  fmt.Println(encoded)\n  // jLGi0jq98ap77J_UTdYvTdFojbytuotRrj6uPCzk3orKTGf8jyUSykvPWVDRCeQc1zMbdC4bU2BohtMjKGY32\n  // JfTMwYIomeXmwhBDmoFXsfADwOu6ncEo6Yi_PqD1Xn1VJ1SI4X5J\n  // REUYNxOV-fGsONsyLjpMay0TcvvlgoXBGbSSNX8lt8R0G7C6WTZFz7sl0wE7XsRNeBQ7oQBDxv1JHXWelc0fsDgK\n  // Nm6zsLAwpV1xWzSPM_3ELvaQsup0rwA4dp4Embkkhi-utKZk27lJsbIvcGlMi0=\n}\n```\n- DecodeSWT decode the given value and returns SWT token with value given in map. To get some type just write .(type).\n```go\ndecoded := swt.DecodeSWT(encoded)\nfmt.Println(decoded.Payload[\"mybool\"].(bool))\n// true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwnajdz%2Fswt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwnajdz%2Fswt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwnajdz%2Fswt/lists"}