Skip to content

Instantly share code, notes, and snippets.

@dansleboby
Last active March 20, 2023 04:43
Show Gist options
  • Save dansleboby/83712c0c960a63fd2c083c0011e116b6 to your computer and use it in GitHub Desktop.
Save dansleboby/83712c0c960a63fd2c083c0011e116b6 to your computer and use it in GitHub Desktop.
Yubico protocol supported matrix wikipedia generator
<?php
header('Content-Type: text/plain');
$partners = file_get_contents("https://wwyk.yubico.com/api/v2/partnerproducts");
// Decompress gz data
$partners = gzdecode($partners);
$partners = json_decode($partners, true);
$protocols = array_column($partners['protocols'], 'protocol_name', 'protocol_id');
// Make a wikitable of the partners (name and logo) and their protocols
$wikitable = "{| class=\"wikitable sortable\"".PHP_EOL;
$wikitable .= "|+ List of popular services and there supported security procotol".PHP_EOL;
$wikitable .= "|-".PHP_EOL;
$wikitable .= "! Partner !! ".implode(" !! ", $protocols)." !! Notes".PHP_EOL;
foreach ($partners['partnerproducts'] as $partner) {
$wikitable .= "|-".PHP_EOL;
$wikitable .= "| ".$partner['partnerproduct_name']." || ";
foreach ($protocols as $protocol_id => $protocol_name) {
$wikitable .= (in_array($protocol_id, $partner['protocols']) ? "✓" : "X")." || ";
}
// Remove the last " || "
$wikitable = substr($wikitable, 0, -4);
$wikitable .= PHP_EOL;
}
$wikitable .= "|}".PHP_EOL;
echo $wikitable;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment