-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
40 lines (40 loc) · 3.38 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
"name": "asn1.js",
"version": "1.0.3",
"description": "ASN.1 encoder and decoder",
"main": "lib/asn1.js",
"scripts": {
"test": "mocha --reporter spec test/*-test.js rfc/2560/test/*-test.js rfc/3280/test/*-test.js"
},
"repository": {
"type": "git",
"url": "git@github.com:indutny/asn1.js"
},
"keywords": [
"asn.1",
"der"
],
"author": {
"name": "Fedor Indutny"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/indutny/asn1.js/issues"
},
"homepage": "https://github.com/indutny/asn1.js",
"devDependencies": {
"mocha": "^1.14.0"
},
"optionalDependencies": {
"bn.js": "^1.0.0"
},
"dependencies": {
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"bn.js": "^1.0.0"
},
"readme": "# ASN1.js\n\nASN.1 DER Encoder/Decoder and DSL.\n\n## Example\n\nDefine model:\n\n```javascript\nvar asn = require('asn1.js');\n\nvar Human = asn.define('Human', function() {\n this.seq().obj(\n this.key('firstName').octstr(),\n this.key('lastName').octstr(),\n this.key('age').int(),\n this.key('gender').enum({ 0: 'male', 1: 'female' }),\n this.key('bio').seqof(Bio)\n );\n});\n\nvar Bio = asn.define('Bio', function() {\n this.seq().obj(\n this.key('time').gentime(),\n this.key('description').octstr()\n );\n});\n```\n\nEncode data:\n\n```javascript\nvar output = Human.encode({\n firstName: 'Thomas',\n lastName: 'Anderson',\n age: 28,\n gender: 'male',\n bio: [\n {\n time: +new Date('31 March 1999'),\n description: 'freedom of mind'\n }\n ]\n}, 'der');\n```\n\nDecode data:\n\n```javascript\nvar human = Human.decode(output, 'der');\nconsole.log(human);\n/*\n{ firstName: <Buffer 54 68 6f 6d 61 73>,\n lastName: <Buffer 41 6e 64 65 72 73 6f 6e>,\n age: 28,\n gender: 'male',\n bio:\n [ { time: 922820400000,\n description: <Buffer 66 72 65 65 64 6f 6d 20 6f 66 20 6d 69 6e 64> } ] }\n*/\n```\n\n### Partial decode\n\nIts possible to parse data without stopping on first error. In order to do it,\nyou should call:\n\n```javascript\nvar human = Human.decode(output, 'der', { partial: true });\nconsole.log(human);\n/*\n{ result: { ... },\n errors: [ ... ] }\n*/\n```\n\n#### LICENSE\n\nThis software is licensed under the MIT License.\n\nCopyright Fedor Indutny, 2013.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the\nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\nNO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n",
"readmeFilename": "README.md",
"_id": "asn1.js@1.0.3",
"_from": "asn1.js@^1.0.0"
}