Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #116 from square/mbyczkowski/fix-imports
Browse files Browse the repository at this point in the history
Fix the way WebCryptographer is exported
  • Loading branch information
mbyczkowski committed Aug 8, 2019
2 parents de4a169 + 2705cb1 commit 56135fd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
12 changes: 7 additions & 5 deletions dist/jose.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jose.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/jose.min.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions lib/jose-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Encrypter } from './jose-jwe-encrypt';
import { Decrypter } from './jose-jwe-decrypt';
import { Signer } from './jose-jws-sign';
import { Verifier } from './jose-jws-verify';
import { WebCryptographer } from './jose-jwe-webcryptographer';

export var crypto;
/**
Expand All @@ -28,8 +29,6 @@ export var crypto;

export var Utils = JoseUtils;

export { WebCryptographer } from './jose-jwe-webcryptographer';

/**
* Initializes a JoseJWE object.
*/
Expand All @@ -46,10 +45,10 @@ const JoseJWS = {
Verifier
};

const Jose = { JoseJWS, JoseJWE };
const Jose = { JoseJWS, JoseJWE, WebCryptographer };

export default { Jose };
export { Jose, JoseJWE, JoseJWS };
export default { Jose, WebCryptographer };
export { Jose, JoseJWE, JoseJWS, WebCryptographer };

/**
* Set crypto provider to use (window.crypto, node-webcrypto-ossl, node-webcrypto-pkcs11 etc.).
Expand Down
20 changes: 20 additions & 0 deletions lib/jose-core.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
// eslint-disable-next-line import/no-duplicates
import DefaultJose, { Jose } from './jose-core.js';
// eslint-disable-next-line import/no-duplicates
import * as AsJose from './jose-core.js';

it('ensure imports work', () => {
expect(Jose).not.toBeUndefined();
expect(Jose.JoseJWS).not.toBeUndefined();
expect(Jose.JoseJWE).not.toBeUndefined();
expect(Jose.WebCryptographer).not.toBeUndefined();

console.log(Jose);
expect(DefaultJose).not.toBeUndefined();
expect(DefaultJose.WebCryptographer).not.toBeUndefined();
expect(DefaultJose.Jose).not.toBeUndefined();
expect(DefaultJose.Jose.JoseJWS).not.toBeUndefined();
expect(DefaultJose.Jose.JoseJWE).not.toBeUndefined();
expect(DefaultJose.Jose.WebCryptographer).not.toBeUndefined();

expect(AsJose).not.toBeUndefined();
expect(AsJose.WebCryptographer).not.toBeUndefined();
expect(AsJose.Jose).not.toBeUndefined();
expect(AsJose.Jose.JoseJWS).not.toBeUndefined();
expect(AsJose.Jose.JoseJWE).not.toBeUndefined();
expect(AsJose.Jose.WebCryptographer).not.toBeUndefined();
});

0 comments on commit 56135fd

Please sign in to comment.