Skip to content

Instantly share code, notes, and snippets.

View barryor's full-sized avatar

Barry O'Rourke barryor

View GitHub Profile
@barryor
barryor / okhttp-pin.java
Created February 3, 2018 16:33
Pinning with OkHttp3
CertificatePinner certificatePinner = new CertificatePinner.Builder()
.add("publicobject.com", "sha256/afwiKY3RxoMmLkuRW1l7QsPZTJPwDS2pdDROQjXw8ig=")
.add("bikewise.org", "sha256/x9SZw6TwIqfmvrLZ/kz1o0Ossjmn728BnBKpUFqGNVM=")
.build();
OkHttpClient client = OkHttpClient.Builder()
.certificatePinner(certificatePinner)
.build();
@barryor
barryor / unpinned.java
Created September 4, 2017 15:33
Test for unpinning
/**
* Logs if HttpsURLConnection.setHostnameVerifier() is working or not.
* Also returns boolean to that effect.
*/
static boolean testHostnameVerifier() {
boolean isWorking = false;
HttpsURLConnection connection = null;
try {
URL aUrl = new URL("https://firebase.google.com");
// Get our HTTPS connection object
@barryor
barryor / app.gradle
Created September 4, 2017 14:07
Firebase perf integration
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
dependencies {
compile 'com.google.firebase:firebase-perf:10.2.6'
}