kms_flutter 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

Pub Package Github Actions CI

Overview #

This is an adapter for the package kms that uses:

  • Keystore in Android
  • Keychain in iOS and Mac OS X
  • BrowserKms in browsers

Currently the package uses the package flutter_secure_storage for storing the keys. We may transition to direct use of the underlying APIs in the future.

Getting started #

1.Add dependency #

dependencies:
  kms: ^0.4.0
  kms_flutter: ^0.1.0

2.Set Android minimum version #

Your android/app/build.gradle should have minimum SDK version 18 or above:

    defaultConfig {
        // ...
        minSdkVersion 18
        // ...
    }

3.Use #

import 'package:kms/kms';
import 'package:kms_flutter/kms_flutter';

final kms = flutterKms();

Future<void> main() async {
  // Create a key pair
  final document = kms.collection('examples').createKeyPair(
    keyExchangeType: null,
    signatureType: SignatureType.ed25519,
  );

  // Sign a document
  final signature = document.sign([1,2,3]);

  print('Signature: ${signature.bytes}');
  print('Public key: ${signature.publicKey.bytes}');
}

0.1.0 #

  • Initial version

example/lib/main.dart

import 'package:kms/kms.dart';
import 'package:kms_flutter/kms_flutter.dart';

Future<void> main() async {
  // In browsers, returns BrowserKms.
  // In other platforms, returns PluginKms.
  final kms = flutterKms();

  // Create a key pair.
  final keyPairDocument = await kms.collection('example').createKeyPair(
        keyExchangeType: null,
        signatureType: SignatureType.ed25519,
        keyDocumentSecurity: KeyDocumentSecurity.highest,
      );

  // Sign a message
  final signature = await keyPairDocument.sign([1, 2, 3]);
  print('Public key: ${signature.publicKey}');
  print('Signature: $signature');

  // ...

  // Delete
  await keyPairDocument.delete();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  kms_flutter: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:kms_flutter/kms_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
32
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:kms_flutter/kms_flutter.dart, package:kms_flutter/src/plugin_kms.dart, package:flutter_secure_storage/flutter_secure_storage.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:kms_flutter/kms_flutter.dart, package:kms_flutter/src/plugin_kms.dart, package:flutter_secure_storage/flutter_secure_storage.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:kms_flutter/kms_flutter.dart, package:kms_flutter/src/plugin_kms.dart, package:flutter_secure_storage/flutter_secure_storage.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:kms_flutter/kms_flutter.dart, package:kms_flutter/src/plugin_kms.dart, package:flutter_secure_storage/flutter_secure_storage.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [kms_flutter] that is in a package requiring null.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (cryptography).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
collection ^1.10.0 1.14.12 1.14.13
cryptography ^0.3.5 0.3.5 1.4.1
flutter 0.0.0
flutter_secure_storage ^3.3.3 3.3.3
kms ^0.4.0 0.4.0 0.4.1
meta ^1.1.0 1.1.8
Transitive dependencies
charcode 1.1.3
convert 2.1.1
crypto 2.1.5
js 0.6.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test
pedantic ^1.8.0
test ^1.6.0