{"id":36463490,"url":"https://github.com/owlsome-official/cipherpayload","last_synced_at":"2026-02-23T04:24:26.313Z","repository":{"id":256881097,"uuid":"856708327","full_name":"owlsome-official/cipherPayload","owner":"owlsome-official","description":"CipherPayload middleware for Fiber that use AES Algorithm for encrypt and decrypt payload in request and response body.","archived":false,"fork":false,"pushed_at":"2025-09-17T08:16:19.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T01:37:19.497Z","etag":null,"topics":["cipher","encryption","gofiber","golang","golang-library","middleware","payload-encryption","security"],"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/owlsome-official.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-13T03:55:01.000Z","updated_at":"2025-09-17T08:16:23.000Z","dependencies_parsed_at":"2024-09-13T15:59:56.671Z","dependency_job_id":"5b9f59f1-3be9-40eb-a93e-9fd386c29fb1","html_url":"https://github.com/owlsome-official/cipherPayload","commit_stats":null,"previous_names":["owlsome-official/cipherpayload"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/owlsome-official/cipherPayload","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owlsome-official%2FcipherPayload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owlsome-official%2FcipherPayload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owlsome-official%2FcipherPayload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owlsome-official%2FcipherPayload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owlsome-official","download_url":"https://codeload.github.com/owlsome-official/cipherPayload/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owlsome-official%2FcipherPayload/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29737642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T02:24:00.660Z","status":"ssl_error","status_checked_at":"2026-02-23T02:22:56.087Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["cipher","encryption","gofiber","golang","golang-library","middleware","payload-encryption","security"],"created_at":"2026-01-11T23:59:30.948Z","updated_at":"2026-02-23T04:24:26.301Z","avatar_url":"https://github.com/owlsome-official.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CipherPayload\n\n[![made-with-Go](https://img.shields.io/badge/Made%20with-Go-1f425f.svg)](http://golang.org) [![Go Reference](https://pkg.go.dev/badge/github.com/owlsome-official/cipherPayload@v1.0.7.svg)](https://pkg.go.dev/github.com/owlsome-official/cipherPayload@v1.0.7) [![GitHub issues](https://img.shields.io/github/issues/owlsome-official/cipherPayload)](https://github.com/owlsome-official/cipherPayload/issues) [![GitHub forks](https://img.shields.io/github/forks/owlsome-official/cipherPayload)](https://github.com/owlsome-official/cipherPayload/network) [![GitHub stars](https://img.shields.io/github/stars/owlsome-official/cipherPayload)](https://github.com/owlsome-official/cipherPayload/stargazers)\n\nCipherPayload middleware for Fiber that use AES Algorithm for encrypt and decrypt payload in request and response body.\n\n## Table of Contents\n\n- [CipherPayload](#cipherpayload)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n  - [Signatures](#signatures)\n  - [Examples](#examples)\n  - [Config](#config)\n  - [Default Config](#default-config)\n  - [Default Response](#default-response)\n  - [KeyPairs Property](#keypairs-property)\n  - [Payload Template](#payload-template)\n    - [Request](#request)\n    - [Response](#response)\n  - [Example Usage](#example-usage)\n\n## Installation\n\n```bash\n  go get -u github.com/owlsome-official/cipherPayload\n```\n\n## Signatures\n\n```go\nfunc New(config ...Config) fiber.Handler\n```\n\n## Examples\n\nImport the middleware package that is part of the Fiber web framework\n\n```go\nimport (\n  \"github.com/gofiber/fiber/v2\"\n  \"github.com/owlsome-official/cipherPayload\"\n)\n```\n\nAfter you initiate your Fiber app, you can use the following possibilities:\n\n```go\n// Default middleware config\napp.Use(cipherPayload.New(cipherPayload.Config{\n  KeyPairs: cipherPayload.KeyPairs{\n    AESKeyForEncrypt: []byte(\"AES_KEY_FOR_ENCRYPT\"),\n    AESIVForEncrypt:  []byte(\"AES_IV_FOR_ENCRYPT\"),\n    AESKeyForDecrypt: []byte(\"AES_KEY_FOR_DECRYPT\"),\n    AESIVForDecrypt:  []byte(\"AES_IV_FOR_DECRYPT\"),\n  },\n}))\n\n// Or extend your config for customization\napp.Use(cipherPayload.New(cipherPayload.Config{\n  KeyPairs: cipherPayload.KeyPairs{\n    AESKeyForEncrypt: []byte(\"AES_KEY_FOR_ENCRYPT\"),\n    AESIVForEncrypt:  []byte(\"AES_IV_FOR_ENCRYPT\"),\n    AESKeyForDecrypt: []byte(\"AES_KEY_FOR_DECRYPT\"),\n    AESIVForDecrypt:  []byte(\"AES_IV_FOR_DECRYPT\"),\n  },\n  AllowMethod: []string{\"POST\", \"OPTIONS\"},\n  DebugMode: true,\n}))\n```\n\n## Config\n\n```go\n// Config defines the config for middleware.\ntype Config struct {\n  // Next defines a function to skip this middleware when returned true.\n\n  // Optional. Default: nil\n  Next func(c *fiber.Ctx) bool\n\n  // Required. Default: KeyPairs{}\n  KeyPairs KeyPairs\n\n  // Optional. Default: [\"OPTIONS\", \"POST\", \"PUT\", \"DELETE\"]\n  AllowMethod []string\n\n  // Optional. Default: false\n  DebugMode bool\n\n  // Optional. [Default: false]\n  StrictMode bool\n\n  // Optional. Default: true\n  ExcludeHealthAPI bool\n\n  // Optional. Default: BadRequestResponse\n  FailResponse func(c *fiber.Ctx, msg string) error\n\n  // Optional. Default: InternalServerErrorResponse\n  ErrorResponse func(c *fiber.Ctx, msg string) error\n}\n```\n\n## Default Config\n\n```go\nvar ConfigDefault = Config{\n  Next:   nil,\n  KeyPairs: KeyPairs{},\n  AllowMethod: []string{\n    fiber.MethodOptions,\n    fiber.MethodPost,\n    fiber.MethodPut,\n    fiber.MethodDelete,\n  },\n  DebugMode:        false,\n  StrictMode:       false,\n  ExcludeHealthAPI: true,\n  FailResponse:     BadRequestResponse,\n  ErrorResponse:    InternalServerErrorResponse,\n}\n```\n\n## Default Response\n\n```go\nfunc BadRequestResponse(c *fiber.Ctx, msg string) error { // 400\n  if msg == \"\" {\n    msg = \"Bad Request\"\n  }\n  res := fiber.Map{\n    \"status\":  \"bad_request\",\n    \"message\": msg,\n  }\n  return c.Status(fiber.StatusBadRequest).JSON(res)\n}\n\nfunc InternalServerErrorResponse(c *fiber.Ctx, msg string) error { // 500\n  if msg == \"\" {\n    msg = \"Internal Server Error\"\n  }\n  res := fiber.Map{\n    \"status\":  \"internal_server_error\",\n    \"message\": msg,\n  }\n  return c.Status(fiber.StatusInternalServerError).JSON(res)\n}\n```\n\n## KeyPairs Property\n\n```go\ntype KeyPairs struct {\n  AESKeyForEncrypt []byte\n  AESIVForEncrypt  []byte\n  AESKeyForDecrypt []byte\n  AESIVForDecrypt  []byte\n}\n```\n\n## Payload Template\n\nAn example of payload template (see more how to work in [Example](./example))\n\n### Request\n\n```json\n{\n  \"payload\": \"FDp1Dl31zGx5nRXFNKihB+k3ly/L7HI9tlHycbKVRwhaf3RRdyFGviuntEZqst0/\"\n}\n```\n\nwhich can be decrypt to:\n\n```json\n{\n  \"firstname\": \"Chinnawat\",\n  \"lastname\": \"Chimdee\"\n}\n```\n\n### Response\n\n```json\n{\n  \"payload\": \"tpkWPEI6F/nfgUjjtwyKSUf1erxPL6rQt8jG3RitQ1KpvRALfR5YAgQ0CXYkrwLfTid6VdK3SNlffuu/kvI7Hj7br0ur01TUFUWxQ9cl+8U=\"\n}\n```\n\nwhich encrypted from:\n\n```json\n{\n  \"firstname\": \"Chinnawat [Modified]\",\n  \"lastname\": \"Chimdee [Modified]\"\n}\n```\n\nNote: This payload using\n\n- AESKeyForEncrypt (used in encrypting response body): `67890123456789012345678901234567`\n- AESIVForEncrypt (used in encrypting response body): `6789012345678901`\n- AESKeyForDecrypt (used in decrypting request body): `12345678901234567890123456789012`\n- AESIVForDecrypt (used in decrypting request body): `1234567890123456`\n\n## Example Usage\n\nPlease go to [example/README.md](./example/README.md)\n\n## [NEW!] AES Encryption Tools (useful for debugging)\n\n[https://encrypt-tools.vercel.app/](https://encrypt-tools.vercel.app/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowlsome-official%2Fcipherpayload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowlsome-official%2Fcipherpayload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowlsome-official%2Fcipherpayload/lists"}