Skip to content

Commit

Permalink
Merge pull request #32 from VirgilSecurity/v0.4.1
Browse files Browse the repository at this point in the history
v0.4.1
  • Loading branch information
Alexey Smirnov authored May 21, 2019
2 parents 931835e + 15c2128 commit 449e2f1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 68 deletions.
2 changes: 1 addition & 1 deletion example/encryptFile.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>Document</title>
<script src="https://unpkg.com/virgil-crypto/dist/virgil-crypto.browser.umd.min.js"></script>
<script src="https://unpkg.com/virgil-sdk/dist/virgil-sdk.browser.umd.min.js"></script>
<script src="../dist/e3kit.browser.umd.min.js"></script>
<script src="https://unpkg.com/@virgilsecurity/e3kit/dist/e3kit.browser.umd.min.js"></script>
<script src="https://mrdoob.github.io/stats.js/build/stats.min.js"></script>
</head>
<body>
Expand Down
73 changes: 14 additions & 59 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@virgilsecurity/e3kit",
"version": "0.4.0",
"version": "0.4.1",
"description": "End-to-end encryption with multiple device support powered by Virgil Security",
"main": "./dist/e3kit.browser.es.js",
"module": "./dist/e3kit.browser.es.js",
Expand All @@ -23,7 +23,7 @@
"precommit": "lint-staged",
"test": "karma start",
"docs": "typedoc src && npm run build:browser:umd && npm run encryptFileDoc",
"encryptFileDoc": "cpx example/encryptFile.html docs && cpx dist/e3kit.browser.umd.min.js docs"
"encryptFileDoc": "cpx example/encryptFile.html docs"
},
"lint-staged": {
"src/**/*.ts": [
Expand All @@ -33,9 +33,9 @@
},
"dependencies": {
"@virgilsecurity/keyknox": "^0.2.4",
"virgil-crypto": "^3.2.3",
"virgil-crypto": "^3.2.4",
"virgil-pythia": "^0.2.3",
"virgil-sdk": "^5.2.2"
"virgil-sdk": "^5.2.3"
},
"peerDependencies": {},
"devDependencies": {
Expand Down
17 changes: 13 additions & 4 deletions src/EThree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export default class EThree {
/**
* Instance of [VirgilCrypto](https://github.com/virgilsecurity/virgil-crypto-javascript).
*/
virgilCrypto = new VirgilCrypto();
virgilCrypto: VirgilCrypto;
/**
* Instance of VirgilCardCrypto.
*/
cardCrypto = new VirgilCardCrypto(this.virgilCrypto);
cardCrypto: VirgilCardCrypto;
/**
* Instance of VirgilCardVerifier.
*/
Expand Down Expand Up @@ -105,10 +105,19 @@ export default class EThree {
* @param identity - Identity of the current user.
*/
constructor(identity: string, options: EThreeCtorOptions) {
const opts = withDefaults(options, { apiUrl: DEFAULT_API_URL });
const opts = withDefaults(options, {
apiUrl: DEFAULT_API_URL,
storageName: STORAGE_NAME,
useSha256Identifiers: false,
});

this.identity = identity;
this.accessTokenProvider = opts.accessTokenProvider;
this.keyEntryStorage = opts.keyEntryStorage || new KeyEntryStorage(STORAGE_NAME);

this.keyEntryStorage = opts.keyEntryStorage || new KeyEntryStorage(opts.storageName);
this.virgilCrypto = new VirgilCrypto({ useSha256Identifiers: opts.useSha256Identifiers });
this.cardCrypto = new VirgilCardCrypto(this.virgilCrypto);

this.cardVerifier = new VirgilCardVerifier(this.cardCrypto, {
verifySelfSignature: opts.apiUrl === DEFAULT_API_URL,
verifyVirgilSignature: opts.apiUrl === DEFAULT_API_URL,
Expand Down
8 changes: 8 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export interface EThreeInitializeOptions {
* Url of the Card Services. Used for development purposes.
*/
apiUrl?: string;
/**
* Indicates whether to use old algorithm to calculate keypair identifiers.
*/
useSha256Identifiers?: boolean;
/**
* Name of the IndexedDB database. Default `.virgil-local-storage`.
*/
storageName?: string;
}

/**
Expand Down

0 comments on commit 449e2f1

Please sign in to comment.