Skip to content

Instantly share code, notes, and snippets.

View apottere's full-sized avatar

Andrew Potter apottere

View GitHub Profile
package com.dealer.webplatform.pageservice;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.junit.After;
import org.junit.Before;
#!/usr/bin/env node
const path = require('path');
const fs = require('fs');
const arrow = "➞";
const cwdFile = (name) => {
return path.join(process.cwd(), name);
};
#!/bin/bash
set -euo pipefail
reset=$'\033[0;0m'
cyan=$'\033[0;36m'
bred=$'\033[1;31m'
# Remove no longer existing remote branches.
git fetch --prune
@apottere
apottere / index.ts
Created February 9, 2022 21:51
How to validate credCert public key matches keyId for Apple iOS AppAttest key verification
import cbor from 'cbor';
import jsrsasign from 'jsrsasign';
import { parseAuthenticatorData } from '@simplewebauthn/server/helpers';
import { ParsedAuthenticatorData } from '@simplewebauthn/server/dist/helpers';
// ...
// const inputKeyId = get keyId from the app - this is a base64 of the sha256sum of the public key in uncompressed point format
// const attestation = get attestation from the app
const validateAttestation = async (inputKeyId: string, challenge: string, attestation: string): Promise<boolean> => {