JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 152
  • Score
    100M100P100Q85869F
  • License Apache-2.0

Emulates Cisco's node-jose module for the browser

Package Exports

  • node-jose-browserify

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 (node-jose-browserify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

published

node-jose-browserify

Emulates Cisco's node-jose module for the browser. Compatible with node.js and angular

PR https://github.com/cisco/node-jose/pull/264 is raised to merge the changes with the node-jose repo

Refer to https://github.com/cisco/node-jose for documentation.

Install

    npm i node-jose-browserify

Angular Usage

Import and use as any other package. All the methods will be supported in the browser, just as in node.js.

import * as jose from 'node-jose-browserify';

The following changes are required to make few node-modules available in the browser

  • angular compilerOptions for stream

    In tsconfig.json , compilerOptions add

    "paths": {
        "stream": ["../node_modules/stream-browserify/index.js"]
    }

    This is to avoid the below error

    ERROR in ./node_modules/browserify-zlib/lib/index.js. Module not found: Error: Can't resolve 'stream' in '***/node_modules/browserify-zlib/lib'

  • polyfil for global object In polyfills.ts add

    // Polyfill for node-jose
    (window as any)['global'] = window;

    This is to avoid the below error

    Uncaught ReferenceError: global is not defined

Merging node-jose updates

To pull the latest updates from node-jose into node-jose-browserify

$ git pull https://github.com/cisco/node-jose.git master