https://github.com/peerlibrary/meteor-crypto
Efficient crypto operations in web workers
https://github.com/peerlibrary/meteor-crypto
meteor meteor-package
Last synced: 4 months ago
JSON representation
Efficient crypto operations in web workers
- Host: GitHub
- URL: https://github.com/peerlibrary/meteor-crypto
- Owner: peerlibrary
- License: bsd-3-clause
- Created: 2014-07-17T00:21:55.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-11-22T22:54:04.000Z (over 9 years ago)
- Last Synced: 2025-01-03T10:45:15.868Z (5 months ago)
- Topics: meteor, meteor-package
- Language: CoffeeScript
- Homepage: http://atmospherejs.com/peerlibrary/crypto
- Size: 89.8 KB
- Stars: 3
- Watchers: 29
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Crypto
======Meteor smart package which provides a [web workers](https://en.wikipedia.org/wiki/Web_worker) enhanced
efficient crypto operations. Instead of computing computationally intensive crypto operations in main
thread of user's browser it uses a web worker, if possible.Adding this package to your [Meteor](http://www.meteor.com/) application adds `Crypto` object into the global scope.
Both client and server side. It provides equivalent API on the server side.
Installation
------------```
meteor add peerlibrary:crypto
```API
---`var sha256 = new Crypto.SHA256(params)` creates an object representing a new SHA256 computation. It takes object `params`:
* `onProgress(progress)`: progress callback function, if it returns `false` update prematurely stops, if possible (optional)
* `progress`: float, between 0 and 1 (inclusive), if it can be computed
* `size`: complete file size, if known (optional)`sha256.update(data, callback)` updates the hash content with the given data:
* `data`: chunk of data to be added for hash computation (required)
* `callback(error)`: callback function (optional)
* `error`: error or null if there is no error`sha256.finalize(callback)` updates the hash content with the given data:
* `callback(error, sha256)`: callback function (required on client)
* `error`: error or null if there is no error
* `sha256`: result as a hex stringOn the server side callbacks are not required. Methods are run synchronous
anyway.