verifyIdToken function

Future<FirebaseToken> verifyIdToken(
  1. String idToken
)

Implementation

Future<FirebaseToken> verifyIdToken(String idToken) async {
  final c = Completer<String>();
  final receivePort = _createReceivePort(c);

  try {
    final Pointer<Int8> pIdToken =
        idToken.toNativeUtf8(allocator: malloc).cast<Int8>();
    try {
      nl.verifyToken(receivePort.sendPort.nativePort, pIdToken);
    } finally {
      malloc.free(pIdToken);
    }
    final data = await c.future;
    final token = _jsonToFirebaseToken(data);
    return token;
  } finally {
    receivePort.close();
  }
}