blisache 1.0.2 copy "blisache: ^1.0.2" to clipboard
blisache: ^1.0.2 copied to clipboard

Flutter plugin-package for integrating the Blisache passwordless authentication web service

Passkeys authentication for Flutter #

A flutter plugin for integrating the Blisache passwordless authentication web service.

Call flow #

Here is an overview of the passwordless authentication workflow :

Blisache sequence diagram for flutter

Getting started #

This plugin requires :

  • An account on Blisache with a registered domain
  • App association files (assetlinks.json on android, apple-app-site-association on ios/macos) hosted at your domain's website

You can find more on how to integrate this plugin on Blisache reference documentation.

Usage #

Creating an account #

import 'dart:convert';
import 'package:blisache/blisache.dart';
import 'package:http/http.dart' as http;

// Create an instance of the plugin
final yourDomain = 'example.com';
final blisachePlugin = Blisache(domainForAll: yourDomain);

// Call `register()` with user login and name
final registerSignedResponse = await blisachePlugin.register(login: "mylogin", name: "my user name");

// Forward `registerSignedResponse` to your backend's register endpoint for further validations
// See https://github.com/Blisache/blisache/blob/main/flutter%2Bnodejs/server.js
// See https://blisache.com/documentation/guide/integration/server_side_validation.html
final registerResponse = await http.post(
    Uri.https(yourDomain, '/server/register'),
    headers: { "Content-Type": "application/json" },
    body: jsonEncode(registerSignedResponse.toJson())
);

// Assert registration success
assert(registerResponse.statusCode == 200);
print("registered");

Authenticating a user #

import 'dart:convert';
import 'package:blisache/blisache.dart';
import 'package:http/http.dart' as http;

// Create an instance of the plugin
final yourDomain = 'example.com';
final blisachePlugin = Blisache(domainForAll: yourDomain);

// Call `authenticate()` with optional login (null for resident keys)
final authenticateSignedResponse = await blisachePlugin.authenticate(login: "mylogin");

// Forward `authenticateSignedResponse` to your backend's authenticate endpoint for further validations
// See https://github.com/Blisache/blisache/blob/main/flutter%2Bnodejs/server.js
// See https://blisache.com/documentation/guide/integration/server_side_validation.html
final authenticateResponse = await http.post(
    Uri.https(yourDomain, '/server/authenticate'),
    headers: { "Content-Type": "application/json" },
    body: jsonEncode(authenticateSignedResponse.toJson())
);

// Assert authentication success
assert(authenticateResponse.statusCode == 200);
print("authenticated");
0
likes
115
points
148
downloads

Documentation

API reference

Publisher

verified publisherblisache.com

Weekly Downloads

Flutter plugin-package for integrating the Blisache passwordless authentication web service

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_web_plugins, http, json_annotation, plugin_platform_interface, web

More

Packages that depend on blisache

Packages that implement blisache