proit365_multikey_auth 1.0.0
proit365_multikey_auth: ^1.0.0 copied to clipboard
MKAP v1 client SDK for Dart and Flutter applications.
Flutter SDK #
proit365_multikey_auth provides an MKAP v1 client for Flutter and server-side
Dart applications. It uses maintained crypto and http packages and has
replaceable secure-storage and HTTP transport interfaces.
import 'package:proit365_multikey_auth/proit365_multikey_auth.dart';
final export = MkapExport.fromJson(await secureStorage.readExport());
final config = MkapClientConfig.validate(
baseUri: 'https://api.example.test',
clientId: 'CLIENT_001',
poolVersion: 1,
identifierLength: 6,
identifierAlphabet: 'abcdefghijklmnopqrstuvwxyz0123456789',
requireHttps: true,
);
final client = MkapClient(
config: config,
export: export,
transport: HttpPackageMkapTransport(requireHttps: true),
);
final response = await client.request(
'POST',
'/api/orders',
Uint8List.fromList(utf8.encode('{"status":"pending"}')),
);
The package never serializes a payload for the application. Pass the exact
Uint8List bytes that the transport sends. Challenge failures throw
MkapChallengeException; malformed or oversized challenge responses throw
MkapChallengeFormatException. API responses, including 401 responses, are
returned as MkapHttpResponse and are not replayed.
Secure storage #
MkapSecureStorage is a replaceable adapter. InMemoryMkapStorage is suitable
only for tests and development. Production Flutter applications should provide
a platform plugin such as flutter_secure_storage:
class FlutterSecureStorageAdapter implements MkapSecureStorage {
// Implement write/read/delete using the platform plugin.
}
The adapter itself does not imply hardware-backed protection. Android Keystore and iOS Keychain behavior depends on platform, device, OS, and configuration. Device compromise or application compromise can expose the complete pool. Do not place browser JavaScript or desktop logs in the secure-store trust boundary.