Skip to content

Instantly share code, notes, and snippets.

@abergs
abergs / Android-MAUI.md
Created March 13, 2024 13:22
Passkey client/authenticator on Android

We are encountering an issue where if we try to supply our own Client JSON response, then somewhere between our code and the browser, the clientDataJSON bytes will have been replaced, causing the signature verification performed by the RP to fail.

Our questions are:

  • Is the clientDataJSON override intentional?
  • If we go straight for the authenticator, will the Android OS still implement the necessary Client protections (e.g. checking origin vs rpId)?

We provide our own JSON like this:

var getRequest = PendingIntentHandler.RetrieveProviderGetCredentialRequest(Intent);
@abergs
abergs / ExampleController.cs
Last active November 23, 2020 20:29
Passwordless examples
public async Task<IActionResult> TokenVerify(string token)
{
var httpClient = new HttpClient();
// use the Passwordless extension functions
var result = await httpClient.VerifyPasswordlessToken(new VerifyTokenParameters(Configuration.ApiSecret, token));
if (result.Success)
{
Response.Cookies.Append("User", result.Username);
}
@abergs
abergs / Get data.js
Created November 23, 2015 09:17
Feedrepublic
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
$.getJSON( "http://feedrepublic.azurewebsites.net/api/popular-filters-global/", function( data ) {
// put data into the graph
data= data.slice(0,5);
data.unshift(["filter","number"]);
var dataTable = google.visualization.arrayToDataTable(data);
using AppFunc = System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task>;
public class NewRelicIgnoreTransactionOwinModule
{
private AppFunc _nextAppFunc;
public NewRelicIgnoreTransactionOwinModule(AppFunc nextAppFunc)
{
_nextAppFunc = nextAppFunc;
}
@abergs
abergs / package.json
Created March 24, 2015 07:48
Webpack
{
"name": "env1",
"main": "app/main.jsx",
"version": "0.1.0",
"description": "Whatever",
"dependencies": {
"events": "~1.0.2",
"express": "~4.12.0",
"fastclick": "~1.0.6",
"invariant": "~2.0.0",
var SomeView = React.createClass({
render: function () {
return (
<ColumnLayout expanded={true} somethingElse={this.state.stuff}>
<Column text={this.state.text} onClick={this.props.onClick} focus={this.state.isFocus} />
....
</ColumnLayout>
);
@abergs
abergs / v0 API proposal
Last active August 29, 2015 14:05
TableViewComponent
// version 0.0.1 of TableViewcomponent API
<TableView>
<Columns>
<Column format="%s kg" />
<Column format="%s" />
</Columns>
<Rows>
{Items}
</Rows
</TableView
@abergs
abergs / rdel.ps1
Last active August 23, 2016 20:03
Remove node_modules
# By Anders and Henkan 2014-08-07 v1
# http://ideasof.andersaberg.com
$path = $args[0]
$chars = "abcdefghijklmnopqrstuvwxyz"
function GetFileName($num)
{
$name = ""
while($num -gt 25) {
@abergs
abergs / pswlauc
Created August 6, 2014 22:12
Powershell Launcher
$paths = "$env:APPDATA\Microsoft\Internet Explorer\Quick Launch", "C:\ProgramData\Microsoft\Windows\Start Menu", "$env:APPDATA\Microsoft\Windows\Start Menu"
$searchword =$args[0]
$otherargs = $args[1..100]
Write-Host $otherargs
foreach ($path in $paths) {
$applications = Get-ChildItem $path -recurse -File -Filter $searchword*
$applicationPath = @($applications | ForEach-Object -Process {$_.FullName})
@abergs
abergs / AllowOneConcurrentAttribute.cs
Last active March 21, 2017 17:01
AllowOneConcurrent
using System;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Caching;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
/// <summary>
/// Decorates any Action that needs to have client requests limited by concurrent requests.