3615 / keybase-proof-bundle
Keybase Proof Integration with your website
dev-master
2019-05-31 21:30 UTC
Requires
- php: ^7.2
- symfony/console: ^4.0
- symfony/framework-bundle: ^4.0
- symfony/http-client: ^4.3
- symfony/serializer: ^4.0
- twig/twig: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2
- phpstan/phpstan: ^0.11
- phpstan/phpstan-deprecation-rules: ^0.11
- phpstan/phpstan-doctrine: ^0.11
- phpstan/phpstan-phpunit: ^0.11
- phpstan/phpstan-strict-rules: ^0.11
- symfony/phpunit-bridge: ^4.0
This package is auto-updated.
Last update: 2024-11-29 05:57:00 UTC
README
🗝 KeybaseProofBundle
1️⃣ Setup
composer require 3615/keybase-proof-bundle
Configuration
bin/console config:dump-reference keybase_proof
# For more details: https://keybase.io/docs/proof_integration_guide#1-config
# config/keybase-proof.yaml keybase_proof: version: 1 domain: beeactivists.com display_name: Bee Activists username: re: '^[a-zA-Z0-9_]{2,20}$' min: 2 max: 20 brand_color: '#FFB800' logo: svg_black: https://beeactivists.com/small-black-logo.svg svg_full: https://beeactivists.com/full-color.logo.svg description: Next gen social network using big data & AI in the cloud 🤖☁️. prefill_url: https://beeactivists.com/new-profile-proof?kb_username=%%{kb_username}&username=%%{username}&token=%%{sig_hash}&kb_ua=%%{kb_ua} profile_url: https://beeactivists.com/profile/%%{username} check_url: https://api.beeactivists.com/keybase-proofs.json?username=%%{username} check_path: ["signatures"] avatar_path: ["avatar"] contact: ["admin@beeactivists.com", "sassybedazzle@keybase"] # used for debug when doing `bin/console keybase:proof:publish-config --dry-run` my_username: t_alice
Entity
<?php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use 💻3615\Keybase\ProofBundle\Entity\KeybaseProofInterface; use 💻3615\Keybase\ProofBundle\Entity\KeybaseProofTrait; /** * @ORM\Entity() * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="keybase_proof_idx", columns={ * "keybase_username", * "user_id", * })}) */ class KeybaseProof implements KeybaseProofInterface { use KeybaseProofTrait; /** * @var int|null * * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @var User|null * * @ORM\OneToOne(targetEntity="App\Entity\User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id") */ private $user; public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(User $user): void { $this->user = $user; } public function getUsername(): ?string { if (!$this->user) { return null; } return $this->user->getUsername(); } }
Routes
# config/routes.yaml
keybase_proof:
resource: '@KeybaseProofBundle/Resources/config/routes.php'
type: php
2️⃣ Usage
- Setup everything
- Verify that the configuration is valid
bin/console keybase:proof:validate-config
- Send your configuration for manual validation to be added on keybase
bin/console keybase:proof:publish-config --dry-run # send the message to yourself before
bin/console keybase:proof:publish-config
- Once in production, if you update your config, increase the version number then republish your config (step 3)
Twig extension :
<a href="{{ keybase_proof_url(keybase_proof) }}"> <img alt="Keybase proof status" src="{{ keybase_proof_badge_url(keybase_proof) }}"> </a>