3615/keybase-proof-bundle

Keybase Proof Integration with your website

dev-master 2019-05-31 21:30 UTC

This package is auto-updated.

Last update: 2024-03-29 04:04:56 UTC


README

keybase_logo.svg

symfony_logo.svg

🗝 KeybaseProofBundle

Packagist Version Packagist Downloads PHP from Packagist Tests

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

  1. Setup everything
  2. Verify that the configuration is valid
bin/console keybase:proof:validate-config
  1. 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
  1. 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>

Don't hesitate to give us a star: stars

BTC: 1GdgM1edTcSCLvt46Wnx8GfxcKKeECfBGk
ZEC: t1bNdSoehjwFSG43fsYfAhzRtgAeNbyCF1e
XLM: GD7BI57EKKNLIPYSRCZAGSVG4QZX7EYMXIYMOT6ASLCLA5JE255N7TKL