@egendata/react-native-jose

0.5.0 • Public • Published

react-native-jose

Getting started

$ npm install react-native-jose --save

Manual installation

iOS

  1. Add this to your Podfile inside your target
pod 'react-native-jose', :path => '../node_modules/@egendata/react-native-jose'
  1. Add (if you haven't already or just edit existing post_install settings) in the Podfile
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-jose'
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
      end
    end
  end
end
  1. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.reactlibrary.JosePackage to the imports at the top of the file
  • Add new JosePackage() to the list returned by the getPackages() method

Usage

import * as Jose from '@egendata/react-native-jose'

// TODO: What to do with the module?
console.log(Jose)

sign

import {sign} from '@egendata/react-native-jose'

const payload = {}
const privateKeys = {
	jwk: {},
	pem: '...'
} // private key containing "jwk" and "der" representations
const header = {}
const token = await sign(payload, privateKeys, header)

verify

import {verify} from '@egendata/react-native-jose'

const token = '...'
const jwk = {} // public key
const payload = await verify(token, jwk)

decode

import {decode} from '@egendata/react-native-jose'

const token = '...'
const options = {} // not used currently
const {claimsSet, header, signature} = await decode(token, options)

addRecipient

import {addRecipient} from '@egendata/react-native-jose'

const jwe = {}
const ownerKeys = {
	jwk: {},
	pem: ''
} // private key containing "jwk" and "pem" representations
const recipientKeys = {
	jwk: {},
	pem: ''
} // public key containing "jwk" and "pem" representations
const alg // currently only supports "RSA-OAEP"

const newJwe = await addRecipient(payload, ownerKeys, recipientKeys, alg)

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i @egendata/react-native-jose

    Weekly Downloads

    1

    Version

    0.5.0

    License

    MIT

    Unpacked Size

    3.44 MB

    Total Files

    100

    Last publish

    Collaborators

    • graborg
    • ersti
    • egendata-dev
    • raduachim