dvAndroidOpenKeyBlob function

({Uint8List nonce, Uint8List sealed})? dvAndroidOpenKeyBlob(
  1. String blob
)

The nonce and sealed key in blob, or null when it is not one.

Implementation

({Uint8List nonce, Uint8List sealed})? dvAndroidOpenKeyBlob(String blob) {
  final String text = blob.trim();
  if (!text.startsWith(_blobPrefix)) return null;
  final Uint8List raw;
  try {
    raw = base64Decode(text.substring(_blobPrefix.length));
  } on FormatException {
    return null;
  }
  if (raw.length != dvAndroidKeystoreNonceBytes + dvAndroidSealedKeyBytes) return null;
  return (
    nonce: Uint8List.fromList(raw.sublist(0, dvAndroidKeystoreNonceBytes)),
    sealed: Uint8List.fromList(raw.sublist(dvAndroidKeystoreNonceBytes)),
  );
}