react-native-xml-sign
v0.0.1
Published
XML signature using W3C Signature specifications only Android
Downloads
2
Maintainers
Readme
react-native-xml-sign
XML signature using W3C Signature specifications only Android
Install
npm i --save react-native-xml-sign
Linking Native Dependencies
Automatic Linking
react-native link react-native-xml-sign
Manual Linking
Android
In
android/setting.gradle
... include ':react-native-xml-sign' project(':react-native-xml-sign').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-xml-sign/android')
In
android/app/build.gradle
... dependencies { ... compile project(':react-native-xml-sign') }
Register module in
MainApplication.java
import br.com.duobr.xml.sign.XmlSignPackage; // <--- import public class MainApplication extends Application implements ReactApplication { ...... @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new XmlSignPackage() <------- Add this ); } ...... }
Usage (XmlSign)
import XmlSign from 'react-native-xml-sign';
XmlSign.signAsync(fileCertPath, passCert, xml, referenceURI)
.then(signature => console.log(`<root>${xml}${signature}</root>`))
.catch(error => console.error(error));
Params
types
| Name | Type | Require | Description | Example | | -------------- | -------- | ------- | ---------------------------------- | ------------------------- | | fileCertPath | string | true | Certificate used in the signature. | "/path-in-phone/cert.pfx" | | passCert | string | true | Certificate password. | "123456" | | xml | string | true | XML to be signed. | "..." | | referenceURI | string | true | | "http://www.myuri.org/" |