{"id":16463765,"url":"https://github.com/bpolaszek/shh","last_synced_at":"2025-10-27T10:31:31.313Z","repository":{"id":48945850,"uuid":"193936316","full_name":"bpolaszek/shh","owner":"bpolaszek","description":"A small package to handle secrets.","archived":false,"fork":false,"pushed_at":"2021-07-04T10:15:45.000Z","size":54,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T23:43:05.550Z","etag":null,"topics":["environment-variables","openssl","secret-management","secrets","secrets-management","symfony"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/bpolaszek.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}},"created_at":"2019-06-26T15:57:54.000Z","updated_at":"2024-01-26T13:49:28.000Z","dependencies_parsed_at":"2022-09-24T00:41:29.429Z","dependency_job_id":null,"html_url":"https://github.com/bpolaszek/shh","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpolaszek%2Fshh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpolaszek%2Fshh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpolaszek%2Fshh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpolaszek%2Fshh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpolaszek","download_url":"https://codeload.github.com/bpolaszek/shh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861471,"owners_count":16555994,"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":["environment-variables","openssl","secret-management","secrets","secrets-management","symfony"],"created_at":"2024-10-11T11:15:29.709Z","updated_at":"2025-10-27T10:31:25.863Z","avatar_url":"https://github.com/bpolaszek.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/bentools/shh/v/stable)](https://packagist.org/packages/bentools/shh)\n[![License](https://poser.pugx.org/bentools/shh/license)](https://packagist.org/packages/bentools/shh)\n[![CI Workflow](https://github.com/bpolaszek/shh/actions/workflows/ci.yml/badge.svg)](https://github.com/bpolaszek/shh/actions/workflows/ci.yml)\n[![Code Coverage](https://codecov.io/gh/bpolaszek/shh/branch/master/graph/badge.svg?token=4E762WVKSA)](https://codecov.io/gh/bpolaszek/shh)[![Quality Score](https://img.shields.io/scrutinizer/g/bpolaszek/shh.svg?style=flat-square)](https://scrutinizer-ci.com/g/bpolaszek/shh)\n[![Total Downloads](https://poser.pugx.org/bentools/shh/downloads)](https://packagist.org/packages/bentools/shh)\n\n# Shh! 🤫\n\nShh! is a simple library to deal with secrets. It helps you generate key pairs, encrypt/decrypt a payload, store secrets in a safe way.\n\nFor the full background behind this, see the [Symfony Bundle documentation](https://github.com/bpolaszek/shh-bundle)\n\n## Installation\n\n```bash\ncomposer require bentools/shh:^1.0\n```\n\n## Usage\n\n### Generate keys\n```php\nuse BenTools\\Shh\\Shh;\n\n[$publicKey, $privateKey] = Shh::generateKeyPair();\n```\n\nBy default `sha512` algorithm is used with a length of 4096 bits.\n\nExample with a passphrase and a different configuration:\n\n```php\nuse BenTools\\Shh\\Shh;\n\n[$publicKey, $privateKey] = Shh::generateKeyPair('Some passphrase', ['private_key_bits' =\u003e 512, 'digest_alg' =\u003e 'sha256']);\n```\n\n### Change passphrase\n\nYou can change the passphrase of an existing key:\n\n```php\nuse BenTools\\Shh\\Shh;\n\n[$publicKey, $privateKey] = Shh::generateKeyPair();\n$privateKey = Shh::changePassphrase($privateKey, null, 'now I have a passphrase');\n```\n\nThis generates a new private key.\n\nThe public key remains unchanged, and existing secrets can still be decoded, with the new passphrase only.\n\n### Encrypt / decrypt secrets\n\nPublic key is required to encrypt secrets, while public **AND** private keys are required to decode them.\n\n```php\nuse BenTools\\Shh\\Shh;\n\n$shh = new Shh($publicKey, $privateKey);\n$encoded = $shh-\u003eencrypt('foo');\n$decoded = $shh-\u003edecrypt($encoded);\n```\n\nPayloads are serialized/deserialized using base64.\n\n### Secret storage\n\nIt allows you to store encrypted secrets. You can safely publish a file containing secrets as soon as the private key is not published.\n\nOnly the owners of the private key (and its associated passphrase, if any) will be able to decrypt the secrets in it.\n\n```php\nuse BenTools\\Shh\\SecretStorage\\JsonFileSecretStorage;\nuse BenTools\\Shh\\Shh;\n[$publicKey, $privateKey] = Shh::generateKeyPair('Some passphrase', ['private_key_bits' =\u003e 512, 'digest_alg' =\u003e 'sha256']);\n\n$shh = new Shh($publicKey, $privateKey);\n$storage = new JsonFileSecretStorage($shh, './secrets.json');\n$storage-\u003estore('some-secret');\n$storage-\u003ehas('some-secret');\n$storage-\u003eget('some-secret'); // Reveal\n$storage-\u003egetKeys(); // List known secrets\n```\n\n## Tests\n\n```bash\n./vendor/bin/phpunit\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpolaszek%2Fshh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpolaszek%2Fshh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpolaszek%2Fshh/lists"}