Fix and clean native_crypto api
This commit is contained in:
parent
12b9dc1cb2
commit
e58132124d
@ -5,20 +5,25 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
/// [Sources]
|
||||||
/// Plugin class.
|
/// Plugin class.
|
||||||
/// Contains raw functions.
|
/// Contains raw functions.
|
||||||
///
|
///
|
||||||
/// You can use [symmetrical_crypto] for an **AES Helper**.
|
/// Use [symmetrical_crypto] for an **AES API**.
|
||||||
class NativeCrypto {
|
class NativeCrypto {
|
||||||
|
/// [Private]
|
||||||
|
/// Contains the channel for platform specific code.
|
||||||
static const MethodChannel _channel =
|
static const MethodChannel _channel =
|
||||||
const MethodChannel('native.crypto.helper');
|
const MethodChannel('native.crypto.helper');
|
||||||
|
|
||||||
/// Generates AES key.
|
/// Generates AES key.
|
||||||
///
|
///
|
||||||
/// Size of **256 bits** by design.
|
/// [size] is in bits, 128, 192 or 256.
|
||||||
/// And returns `Uint8List`.
|
/// It returns an `Uint8List`.
|
||||||
Future<Uint8List> symKeygen() async {
|
Future<Uint8List> symKeygen(int size) async {
|
||||||
final Uint8List aesKey = await _channel.invokeMethod('symKeygen');
|
final Uint8List aesKey = await _channel.invokeMethod('symKeygen', <String, dynamic>{
|
||||||
|
'size': size
|
||||||
|
});
|
||||||
return aesKey;
|
return aesKey;
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:native_crypto/native_crypto.dart';
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
const MethodChannel channel = MethodChannel('native_crypto');
|
const MethodChannel channel = MethodChannel('native_crypto');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user