This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Flutter < Formula | |
desc "Google’s UI toolkit for mobile, web, and desktop from a single codebase" | |
homepage "https://flutter.dev" | |
url "https://storage.googleapis.com/flutter_infra/releases/releases_macos.json" | |
version "sdk" | |
require 'json' | |
bottle :unneeded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name" : "Flutter", | |
"clipboardFormat" : { | |
"function" : "concat", | |
"y" : ")", | |
"x" : { | |
"x" : "const Color(0xFF", | |
"function" : "concat", | |
"y" : { | |
"x" : "hex[red]hex[green]hex[blue]", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthCallbacks extends FingerprintManager.AuthenticationCallback { | |
@Override | |
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) { | |
// Called when a fingerprint is recognized. | |
// The AuthenticationResult contains the CryptoObject which | |
// has been passed to the authenticate() method. | |
Cipher cipher = result.getCryptoObject().getCipher(); | |
// Go on and use the 'unlocked' Cipher object... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fingerprintManager = (FingerprintManager) | |
getSystemService(Context.FINGERPRINT_SERVICE); | |
fingerprintManager.authenticate( | |
@Nullable FingerprintManager.CryptoObject cryptoObject, | |
@Nullable CancellationSignal cancelSignal, | |
0 /* optional flags - should be 0 */, | |
FingerprintManager.AuthenticationCallback callback, | |
@Nullable Handler handler); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onActivityResult(int requestCode, | |
int resultCode, Intent data) { | |
if (requestCode == REQUEST_CODE_CREDENTIALS) { | |
// Challenge completed, proceed with using cipher | |
if (resultCode == RESULT_OK) { | |
doSomeDecryptionHere(); | |
} else { | |
// The user canceled or didn’t complete the lock screen | |
// operation. Go to error/cancellation flow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void showAuthenticationScreen() { | |
Intent in = mKeyguardManager.createConfirmDeviceCredentialIntent( | |
"Hey there!", "Please..."); | |
if (in != null) { | |
startActivityForResult(in, REQUEST_CODE_CREDENTIALS); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); | |
keyStore.load(null); | |
SecretKey secretKey = | |
(SecretKey) keyStore.getKey(SecurityConstants.KEY_AES, null); | |
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); | |
// The next line may throw a UserNotAuthenticatedException and | |
// we need to prompt the user to authenticate again |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder | |
.setKeySize(256) | |
.setBlockModes(KeyProperties.BLOCK_MODE_CBC) | |
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7) | |
.setUserAuthenticationRequired(true) | |
.setUserAuthenticationValidityDurationSeconds(30); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Init the Cipher and decrypt the ciphertext | |
cipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(iv)); | |
byte[] decryptedBytes = | |
cipher.doFinal(encryptedBytes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the AndroidKeyStore instance | |
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); | |
// Relict of the JCA API - you have to call load even | |
// if you do not have an input stream you want to load or it'll crash | |
keyStore.load(null); | |
// Get the SecretKey from the KeyStore and instantiate a Cipher | |
SecretKey secretKey = | |
(SecretKey) keyStore.getKey("myAwesomeSecretKey01", null); |
NewerOlder