Skip to content

Instantly share code, notes, and snippets.

View Chenx221's full-sized avatar
🏠
Working from home

Chenx221 Chenx221

🏠
Working from home
View GitHub Profile
@Chenx221
Chenx221 / PublicKeyCredentialSourceRepository.php
Created March 17, 2024 09:22
Yii2, Webauthn Framework (Part 4)
<?php
namespace app\models;
use JsonException;
use Webauthn\PublicKeyCredentialSource;
use Yii;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;
@Chenx221
Chenx221 / WebauthnInfo.php
Created March 17, 2024 09:19
Yii2, Webauthn Framework (Part 3)
<h5>
<i class="fa-solid fa-key"></i>
Webauthn
</h5>
<div class="input-group" id="totp_area">
<input type="text" class="form-control" placeholder="New Name" aria-label="New Name" name="fido_name"
id="fido_name">
<?= Html::button('Add', ['id' => "webauthn_add", 'type' => 'button', 'class' => 'btn btn-primary btn-sm']) ?>
<?= Html::button('Verify', ['id' => "webauthn_verify", 'type' => 'button', 'class' => 'btn btn-primary btn-sm']) ?>
</div>
@Chenx221
Chenx221 / Webauthn.js
Created March 17, 2024 09:15
Yii2, Webauthn Framework (Part 2)
const { startRegistration } = SimpleWebAuthnBrowser;
const elemBegin = document.getElementById('webauthn_add');
const elemSuccess = document.getElementById('webauthn_success');
const elemError = document.getElementById('webauthn_error');
elemBegin.addEventListener('click', async () => {
elemSuccess.innerHTML = '';
elemError.innerHTML = '';
elemSuccess.parentElement.hidden = true;
elemError.parentElement.hidden = true;
@Chenx221
Chenx221 / WebauthnController.php
Created March 17, 2024 09:11
Yii2, Webauthn Framework (Part 1)
public function actionCreateCredentialOptions(): Response
{
$id = Yii::$app->params['domain'];
$user = Yii::$app->user->identity;
$rpEntity = PublicKeyCredentialRpEntity::create(
'NetDisk Application',
$id
);
$userEntity = PublicKeyCredentialUserEntity::create(
$user->username,
@Chenx221
Chenx221 / hosts
Last active September 7, 2023 02:25
Adobe Hosts
127.0.0.1 ij0gdyrfka.adobe.io
127.0.0.1 23ynjitwt5.adobe.io
@Chenx221
Chenx221 / recovery.json, cloudready_recovery.json
Last active October 30, 2023 17:55
Chrome OS recovery images manual download (Flex)
# Chrome OS recovery images manual download
https://dl.google.com/dl/edgedl/chromeos/recovery/recovery2.json
https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.json
# Google Chrome OS Flex images manual download
https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery2.json
https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery.json