// // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Autogenerated from Pigeon (v10.1.2), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; class NativeUserContextData { NativeUserContextData({ this.deviceName, this.thirdPartyDeviceId, this.deviceFingerprint, this.applicationName, this.applicationVersion, this.deviceLanguage, this.deviceOsReleaseVersion, this.screenHeightPixels, this.screenWidthPixels, }); String? deviceName; String? thirdPartyDeviceId; String? deviceFingerprint; String? applicationName; String? applicationVersion; String? deviceLanguage; String? deviceOsReleaseVersion; int? screenHeightPixels; int? screenWidthPixels; Object encode() { return [ deviceName, thirdPartyDeviceId, deviceFingerprint, applicationName, applicationVersion, deviceLanguage, deviceOsReleaseVersion, screenHeightPixels, screenWidthPixels, ]; } static NativeUserContextData decode(Object result) { result as List; return NativeUserContextData( deviceName: result[0] as String?, thirdPartyDeviceId: result[1] as String?, deviceFingerprint: result[2] as String?, applicationName: result[3] as String?, applicationVersion: result[4] as String?, deviceLanguage: result[5] as String?, deviceOsReleaseVersion: result[6] as String?, screenHeightPixels: result[7] as int?, screenWidthPixels: result[8] as int?, ); } } class LegacyCredentialStoreData { LegacyCredentialStoreData({ this.identityId, this.accessKeyId, this.secretAccessKey, this.sessionToken, this.expirationMsSinceEpoch, this.accessToken, this.refreshToken, this.idToken, }); String? identityId; String? accessKeyId; String? secretAccessKey; String? sessionToken; int? expirationMsSinceEpoch; String? accessToken; String? refreshToken; String? idToken; Object encode() { return [ identityId, accessKeyId, secretAccessKey, sessionToken, expirationMsSinceEpoch, accessToken, refreshToken, idToken, ]; } static LegacyCredentialStoreData decode(Object result) { result as List; return LegacyCredentialStoreData( identityId: result[0] as String?, accessKeyId: result[1] as String?, secretAccessKey: result[2] as String?, sessionToken: result[3] as String?, expirationMsSinceEpoch: result[4] as int?, accessToken: result[5] as String?, refreshToken: result[6] as String?, idToken: result[7] as String?, ); } } abstract class NativeAuthPlugin { static const MessageCodec codec = StandardMessageCodec(); /// Exchanges the route parameters used to launch the app, i.e. if the app /// was closed and a redirect happened to the custom URI scheme (iOS) or an /// intent was launched with the redirect parameters (Android). void exchange(Map params); static void setup(NativeAuthPlugin? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthPlugin.exchange', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.NativeAuthPlugin.exchange was null.'); final List args = (message as List?)!; final Map? arg_params = (args[0] as Map?)?.cast(); assert(arg_params != null, 'Argument for dev.flutter.pigeon.NativeAuthPlugin.exchange was null, expected non-null Map.'); api.exchange(arg_params!); return; }); } } } } class _NativeAuthBridgeCodec extends StandardMessageCodec { const _NativeAuthBridgeCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { if (value is LegacyCredentialStoreData) { buffer.putUint8(128); writeValue(buffer, value.encode()); } else if (value is NativeUserContextData) { buffer.putUint8(129); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } } @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: return LegacyCredentialStoreData.decode(readValue(buffer)!); case 129: return NativeUserContextData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } } } class NativeAuthBridge { /// Constructor for [NativeAuthBridge]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. NativeAuthBridge({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _NativeAuthBridgeCodec(); /// Sign in by presenting [url] and waiting for a response to a URL with /// [callbackUrlScheme]. /// /// If [preferPrivateSession] is `true`, do not persist session cookies. Future> signInWithUrl( String arg_url, String arg_callbackUrlScheme, bool arg_preferPrivateSession, String? arg_browserPackageName) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthBridge.signInWithUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([ arg_url, arg_callbackUrlScheme, arg_preferPrivateSession, arg_browserPackageName ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as Map?)!.cast(); } } /// Sign out by presenting [url] and waiting for a response to a URL with /// [callbackUrlScheme]. Future signOutWithUrl(String arg_url, String arg_callbackUrlScheme, bool arg_preferPrivateSession, String? arg_browserPackageName) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthBridge.signOutWithUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([ arg_url, arg_callbackUrlScheme, arg_preferPrivateSession, arg_browserPackageName ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } /// Retrieves the validation data for the current iOS/Android device. Future> getValidationData() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthBridge.getValidationData', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as Map?)!.cast(); } } /// Retrieves context data as required for advanced security features (ASF). Future getContextData() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthBridge.getContextData', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as NativeUserContextData?)!; } } Future getBundleId() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthBridge.getBundleId', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as String?)!; } } /// Fetch legacy credentials stored by native SDKs. Future getLegacyCredentials( String? arg_identityPoolId, String? arg_appClientId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthBridge.getLegacyCredentials', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel .send([arg_identityPoolId, arg_appClientId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as LegacyCredentialStoreData?)!; } } /// Clears the legacy credential store data. Future clearLegacyCredentials() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.NativeAuthBridge.clearLegacyCredentials', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } }