feat: 添加 获取国密加密方法

master
jizelin 2021-04-21 21:19:48 +08:00
parent c6db800074
commit 9935eed7bd
4 changed files with 51 additions and 2 deletions

View File

@ -0,0 +1,19 @@
//
// MOP_smsign.h
// mop
//
// Created by beetle_92 on 2021/4/21.
//
#import <Foundation/Foundation.h>
#import "MOPBaseApi.h"
NS_ASSUME_NONNULL_BEGIN
@interface MOP_smsign : MOPBaseApi
@property (nonatomic, copy) NSString *plainText;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,21 @@
//
// MOP_smsign.m
// mop
//
// Created by beetle_92 on 2021/4/21.
//
#import "MOP_smsign.h"
#import <FinApplet/FinApplet.h>
@implementation MOP_smsign
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *,id> * _Nonnull))success failure:(void (^)(id _Nullable))failure cancel:(void (^)(void))cancel
{
NSLog(@"smsign");
NSString *signature = [[FATClient sharedClient] getSM3String:self.plainText];
NSLog(@"signature = %@", signature);
success(@{@"data": signature});
}
@end

View File

@ -17,7 +17,7 @@ A finclip miniprogram flutter sdk.
s.dependency 'Flutter' s.dependency 'Flutter'
s.ios.deployment_target = '9.0' s.ios.deployment_target = '9.0'
s.dependency 'FinApplet' , '2.24.3' s.dependency 'FinApplet' , '2.25.0-alpha20210421v01'
s.dependency 'FinAppletExt' , '2.24.3' s.dependency 'FinAppletExt' , '2.25.0-alpha20210421v01'
end end

View File

@ -195,4 +195,13 @@ class Mop {
_extensionApis[name] = handler; _extensionApis[name] = handler;
_channel.invokeMethod("registerExtensionApi", {"name": name}); _channel.invokeMethod("registerExtensionApi", {"name": name});
} }
///
Future<String> getSMSign(String plainText) async {
var result =
await _channel.invokeMapMethod("smsign", {'plainText': plainText});
var data = result['data']['data'];
print(data);
return data;
}
} }