chico_flutter_sdk 0.1.0
chico_flutter_sdk: ^0.1.0 copied to clipboard
Chico conta a história dos seus clientes por meio das suas transações financeiras.
chico_flutter_sdk #
Flutter Widget to connect you company to Open Banking using Chico SDK.
Usage #
To use this SDK, add chico_flutter_sdk
as a dependency in your pubspec.yaml file.
Example #
Import
import "package:chico_flutter_sdk/chico_flutter_sdk.dart";
Implement
class ChicoOnboarding extends StatefulWidget {
const ChicoOnboarding({Key? key}) : super(key: key);
@override
State<ChicoOnboarding> createState() => _ChicoOnboardingState();
}
class _ChicoOnboardingState extends State<ChicoOnboarding> {
final chicoClient = "demo";
final cpf = "000.111.222-33";
late Future<JWTResponse> chicoToken;
@override
Widget build(BuildContext context) {
// create function to sign your JWT
chicoToken = signCpf(cpf, chicoClient);
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: ChicoConnector(
client: chicoClient,
token: chicoToken,
height: 72,
width: 320,
environment: ChicoEnvironmentType.development,
);));
}
}
class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
appBarTheme: const AppBarTheme(
backgroundColor: Colors.white,
foregroundColor: Colors.black,
shadowColor: Colors.white,
),
),
home: const SizedBox(
height: 64,
width: 256,
child: ChicoOnboarding(),
),
);
}
}
Creating JWTs #
You can use any package to implement the signCpf function, it should return an JWT token containing the user's CPF as chicoToken and your customer id as client. Similar to eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjaGljb1Rva2VuIjoiPENQRj4iLCJjbGllbnQiOiJkZW1vIn0.AZ8bbjN8yDLd1Fv283FxkXACSL6IbkCZilGG6726qz4
We recommend using dart_jsonwebtoken for the simplicity of it:
final jwt = JWT(
// Payload
{
'cpf': "000.111.222-33",
'client': "decom"
},
);
// Sign it (default with HS256 algorithm)
token = jwt.sign(SecretKey('secret passphrase'));
print('Signed token: $token\n');
License #
Proprietary Software
About Chico #
Chico is a financial intelligence API for LatAm. The company leverages alternative consumer financial data so banks and fintechs can properly build, deploy and underwrite financial solutions at scale.