trustsdk 0.0.3 copy "trustsdk: ^0.0.3" to clipboard
trustsdk: ^0.0.3 copied to clipboard

Plugin package for having access to TrustSDK features.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';

import 'package:trustsdk/TrustSSO/TrustFIDO2.dart';
import 'package:trustsdk/TrustSSO/TrustValidation.dart';
import 'package:trustsdk/TrustSSO/TrustIDP.dart';
import 'package:trustsdk/TrustSSO/TrustTransaction.dart';
import 'package:trustsdk/TrustAudit/TrustAudit.dart';
import 'package:trustsdk/TrustBioidentify/TrustBioidentify.dart';
import 'package:trustsdk/TrustDeviceInfo/TrustDeviceInfo.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      debugShowCheckedModeBanner: false,
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    final ButtonStyle style = ElevatedButton.styleFrom(
      textStyle: const TextStyle(fontSize: 20),
    );

    return Scaffold(
      appBar: AppBar(
        title: const Text("TrustClientApp"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              style: style,
              onPressed: () {
                TrustIDP.requestAuthorization(
                  "https://",
                  "atenea.trust.lat",
                  "/oauth/authorize",
                  "openid name dni phone_number last_name company_uid email",
                  "12345678",
                  "code",
                  "autoidentify",
                  "com.trust.trustExampleApp://main",
                  "a2c0cc81-0249-4d42-ba25-d8d3dfbc40f7",
                  "66568f22-c40f-4707-beb4-03cdd1daf0b4",
                  "authorization_code",
                );
              },
              child: const Text('Authenticate'),
            ),
            ElevatedButton(
              style: style,
              onPressed: () {
                TrustIDP.tokenExchange("1234").then((response) =>
                    response is ClientCredentials
                        ? print("response is clientCredentials}")
                        : print("response is trustError"));
              },
              child: const Text('Get Token'),
            ),
            ElevatedButton(
              style: style,
              onPressed: () {
                TrustFIDO2.signUpRequest(
                    "ATENEA", "bigmouthstrks", "09931", "1", "");
              },
              child: const Text('FIDO2 SignUp'),
            ),
            ElevatedButton(
              style: style,
              onPressed: () {
                TrustFIDO2.signInRequest("09931", "1", "ATENEA");
              },
              child: const Text('FIDO2 SignIn'),
            ),
            ElevatedButton(
              style: style,
              onPressed: () {
                TrustTransaction.fetchTransactionsByCompany('1').then((value) {
                  print(value);
                });
              },
              child: const Text('Fetch transactions by company'),
            ),
            ElevatedButton(
              style: style,
              onPressed: () {
                TrustTransaction.fetchTransactionsByUser('2032').then((value) {
                  print(value);
                });
              },
              child: const Text('Fetch transactions by company'),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
130
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

Plugin package for having access to TrustSDK features.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on trustsdk

Packages that implement trustsdk