Package Exports
- react-native-ecc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-ecc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-native-ecc
basic elliptic curve crypto for React Native
this module is used by Tradle
Usage
import * as ec from 'react-native-ecc'
import { Buffer } from 'buffer'
// if you want to be able to find your keys
// next time, make sure to use the same service ID
ec.setServiceID('be.excellent.to.each.other')
// this library allows you to sign 32 byte hashes (e.g. sha256 hashes)
let plaintextHash = new Buffer('c764320a6820c75c82ec43523690bdfd547a077fd6fb805dc3fb9517d23ca527', 'hex')
// check ec.curves for supported curves
let curve = 'p256'
ec.keyPair(curve, function (err, key) {
// key.pub is tested for compatibility with npm library "elliptic"
console.log('pub', key.pub.toString('hex'))
key.sign(plaintextHash, function (err, sig) {
// signatures tested for compatibility with npm library "elliptic"
console.log('sig', sig.toString('hex'))
key.verify(plaintextHash, sig, function (err, verified) {
console.log('verified:', verified)
})
})
})