├── README.md ├── action.yaml ├── index.js ├── node_modules ├── .yarn-integrity ├── @actions │ └── core │ │ ├── README.md │ │ ├── lib │ │ ├── command.d.ts │ │ ├── command.js │ │ ├── command.js.map │ │ ├── core.d.ts │ │ ├── core.js │ │ └── core.js.map │ │ └── package.json ├── base-x │ ├── LICENSE.md │ ├── README.md │ ├── package.json │ └── src │ │ ├── index.d.ts │ │ └── index.js ├── base64-js │ ├── LICENSE │ ├── README.md │ ├── base64js.min.js │ ├── index.js │ └── package.json ├── buffer │ ├── AUTHORS.md │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── index.js │ └── package.json ├── cids │ ├── .flowconfig │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── index.js │ │ ├── index.js.map │ │ ├── index.min.js │ │ ├── index.min.js.LICENSE.txt │ │ └── index.min.js.map │ ├── docs │ │ ├── assets │ │ │ ├── anchor.js │ │ │ ├── bass-addons.css │ │ │ ├── bass.css │ │ │ ├── fonts │ │ │ │ ├── EOT │ │ │ │ │ ├── SourceCodePro-Bold.eot │ │ │ │ │ └── SourceCodePro-Regular.eot │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── OTF │ │ │ │ │ ├── SourceCodePro-Bold.otf │ │ │ │ │ └── SourceCodePro-Regular.otf │ │ │ │ ├── TTF │ │ │ │ │ ├── SourceCodePro-Bold.ttf │ │ │ │ │ └── SourceCodePro-Regular.ttf │ │ │ │ ├── WOFF │ │ │ │ │ ├── OTF │ │ │ │ │ │ ├── SourceCodePro-Bold.otf.woff │ │ │ │ │ │ └── SourceCodePro-Regular.otf.woff │ │ │ │ │ └── TTF │ │ │ │ │ │ ├── SourceCodePro-Bold.ttf.woff │ │ │ │ │ │ └── SourceCodePro-Regular.ttf.woff │ │ │ │ ├── WOFF2 │ │ │ │ │ ├── OTF │ │ │ │ │ │ ├── SourceCodePro-Bold.otf.woff2 │ │ │ │ │ │ └── SourceCodePro-Regular.otf.woff2 │ │ │ │ │ └── TTF │ │ │ │ │ │ ├── SourceCodePro-Bold.ttf.woff2 │ │ │ │ │ │ └── SourceCodePro-Regular.ttf.woff2 │ │ │ │ └── source-code-pro.css │ │ │ ├── github.css │ │ │ ├── site.js │ │ │ ├── split.css │ │ │ ├── split.js │ │ │ └── style.css │ │ └── index.html │ ├── examples │ │ └── cidv0-to-cidv1.js │ ├── package.json │ └── src │ │ ├── cid-util.js │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.js.flow ├── class-is │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.json │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ ├── es5.test.js │ │ ├── es6.test.js │ │ └── fixtures │ │ ├── es5 │ │ ├── Algae.js │ │ ├── Animal.js │ │ ├── ExplicitWithoutNew.js │ │ ├── ImplicitExplicitWithoutNew.js │ │ ├── ImplicitWithoutNew.js │ │ ├── Mammal.js │ │ ├── Plant.js │ │ └── index.js │ │ └── es6 │ │ ├── Algae.js │ │ ├── Animal.js │ │ ├── Mammal.js │ │ ├── Plant.js │ │ └── index.js ├── ieee754 │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── multibase │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── index.js │ │ ├── index.js.map │ │ ├── index.min.js │ │ ├── index.min.js.LICENSE.txt │ │ └── index.min.js.map │ ├── package.json │ └── src │ │ ├── base.js │ │ ├── base16.js │ │ ├── base32.js │ │ ├── base64.js │ │ ├── constants.js │ │ └── index.js ├── multicodec │ ├── .travis.yml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── index.js │ │ ├── index.js.map │ │ ├── index.min.js │ │ ├── index.min.js.LICENSE.txt │ │ └── index.min.js.map │ ├── example.js │ ├── package.json │ ├── src │ │ ├── base-table.json │ │ ├── constants.js │ │ ├── index.js │ │ ├── int-table.js │ │ ├── print.js │ │ ├── util.js │ │ └── varint-table.js │ └── tools │ │ └── update-table.js ├── multihashes │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── dist │ │ ├── index.js │ │ ├── index.js.map │ │ ├── index.min.js │ │ ├── index.min.js.LICENSE.txt │ │ └── index.min.js.map │ ├── package.json │ └── src │ │ ├── constants.js │ │ └── index.js ├── safe-buffer │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── index.js │ └── package.json └── varint │ ├── README.md │ ├── bench.js │ ├── decode.js │ ├── encode.js │ ├── index.js │ ├── length.js │ ├── package.json │ └── test.js ├── package.json └── yarn.lock /README.md: -------------------------------------------------------------------------------- 1 | # convert-cidv0-cidv1 2 | 3 | A GitHub action for converting a CIDv0 value to CIDv1. 4 | 5 | Takes the following required arguments: 6 | 7 | - cidv0: the v0 IPFS CID 8 | 9 | Outputs the following values: 10 | 11 | - cidv1: the v1 version of the input CIDV0 12 | 13 | Example usage: 14 | 15 | ```yaml 16 | - name: Convert CIDV0 17 | id: convert_cidv0 18 | uses: uniswap/convert-cidv0-cidv1@v1.0.0 19 | with: 20 | cidv0: Qm... 21 | 22 | - name: Use CIDv1 23 | run: echo ${{ steps.convert_cidv0.outputs.cidv1 }} 24 | ``` 25 | -------------------------------------------------------------------------------- /action.yaml: -------------------------------------------------------------------------------- 1 | name: Convert CIDv0 to CIDv1 2 | description: Converts CIDv0 to CIDv1 3 | inputs: 4 | cidv0: 5 | description: CIDv0 e.g. Qm... 6 | required: true 7 | outputs: 8 | cidv1: 9 | description: v1 version of v0 CID 10 | runs: 11 | using: node12 12 | main: index.js 13 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const core = require('@actions/core') 2 | const CID = require('cids') 3 | 4 | try { 5 | const cidv0 = core.getInput('cidv0') 6 | const cid = new CID(cidv0) 7 | core.setOutput('cidv1', cid.toV1().toString()) 8 | } catch (error) { 9 | core.setFailed(error) 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/.yarn-integrity: -------------------------------------------------------------------------------- 1 | { 2 | "systemParams": "darwin-x64-72", 3 | "modulesFolders": [ 4 | "node_modules" 5 | ], 6 | "flags": [], 7 | "linkedModules": [ 8 | "@uniswap/sdk", 9 | "@uniswap/v2-core" 10 | ], 11 | "topLevelPatterns": [ 12 | "@actions/core@^1.2.4", 13 | "cids@^0.8.1" 14 | ], 15 | "lockfileEntries": { 16 | "@actions/core@^1.2.4": "https://registry.yarnpkg.com/@actions/core/-/core-1.2.4.tgz#96179dbf9f8d951dd74b40a0dbd5c22555d186ab", 17 | "base-x@^3.0.8": "https://registry.yarnpkg.com/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d", 18 | "base64-js@^1.0.2": "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1", 19 | "buffer@^5.5.0": "https://registry.yarnpkg.com/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786", 20 | "cids@^0.8.1": "https://registry.yarnpkg.com/cids/-/cids-0.8.1.tgz#24a6e1c78ba27d1b80bd7e99e7d450a74a987014", 21 | "class-is@^1.1.0": "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825", 22 | "ieee754@^1.1.4": "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84", 23 | "multibase@^0.7.0": "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b", 24 | "multibase@~0.7.0": "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b", 25 | "multicodec@^1.0.1": "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.1.tgz#4e2812d726b9f7c7d615d3ebc5787d36a08680f9", 26 | "multihashes@~0.4.17": "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.19.tgz#d7493cf028e48747122f350908ea13d12d204813", 27 | "safe-buffer@^5.0.1": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6", 28 | "varint@^5.0.0": "https://registry.yarnpkg.com/varint/-/varint-5.0.0.tgz#d826b89f7490732fabc0c0ed693ed475dcb29ebf" 29 | }, 30 | "files": [], 31 | "artifacts": {} 32 | } -------------------------------------------------------------------------------- /node_modules/@actions/core/README.md: -------------------------------------------------------------------------------- 1 | # `@actions/core` 2 | 3 | > Core functions for setting results, logging, registering secrets and exporting variables across actions 4 | 5 | ## Usage 6 | 7 | ### Import the package 8 | 9 | ```js 10 | // javascript 11 | const core = require('@actions/core'); 12 | 13 | // typescript 14 | import * as core from '@actions/core'; 15 | ``` 16 | 17 | #### Inputs/Outputs 18 | 19 | Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled. 20 | 21 | ```js 22 | const myInput = core.getInput('inputName', { required: true }); 23 | 24 | core.setOutput('outputKey', 'outputVal'); 25 | ``` 26 | 27 | #### Exporting variables 28 | 29 | Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks. 30 | 31 | ```js 32 | core.exportVariable('envVar', 'Val'); 33 | ``` 34 | 35 | #### Setting a secret 36 | 37 | Setting a secret registers the secret with the runner to ensure it is masked in logs. 38 | 39 | ```js 40 | core.setSecret('myPassword'); 41 | ``` 42 | 43 | #### PATH Manipulation 44 | 45 | To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH. 46 | 47 | ```js 48 | core.addPath('/path/to/mytool'); 49 | ``` 50 | 51 | #### Exit codes 52 | 53 | You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success. 54 | 55 | ```js 56 | const core = require('@actions/core'); 57 | 58 | try { 59 | // Do stuff 60 | } 61 | catch (err) { 62 | // setFailed logs the message and sets a failing exit code 63 | core.setFailed(`Action failed with error ${err}`); 64 | } 65 | 66 | Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned. 67 | 68 | ``` 69 | 70 | #### Logging 71 | 72 | Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs). 73 | 74 | ```js 75 | const core = require('@actions/core'); 76 | 77 | const myInput = core.getInput('input'); 78 | try { 79 | core.debug('Inside try block'); 80 | 81 | if (!myInput) { 82 | core.warning('myInput was not set'); 83 | } 84 | 85 | if (core.isDebug()) { 86 | // curl -v https://github.com 87 | } else { 88 | // curl https://github.com 89 | } 90 | 91 | // Do stuff 92 | } 93 | catch (err) { 94 | core.error(`Error ${err}, action may still succeed though`); 95 | } 96 | ``` 97 | 98 | This library can also wrap chunks of output in foldable groups. 99 | 100 | ```js 101 | const core = require('@actions/core') 102 | 103 | // Manually wrap output 104 | core.startGroup('Do some function') 105 | doSomeFunction() 106 | core.endGroup() 107 | 108 | // Wrap an asynchronous function call 109 | const result = await core.group('Do something async', async () => { 110 | const response = await doSomeHTTPRequest() 111 | return response 112 | }) 113 | ``` 114 | 115 | #### Action state 116 | 117 | You can use this library to save state and get state for sharing information between a given wrapper action: 118 | 119 | **action.yml** 120 | ```yaml 121 | name: 'Wrapper action sample' 122 | inputs: 123 | name: 124 | default: 'GitHub' 125 | runs: 126 | using: 'node12' 127 | main: 'main.js' 128 | post: 'cleanup.js' 129 | ``` 130 | 131 | In action's `main.js`: 132 | 133 | ```js 134 | const core = require('@actions/core'); 135 | 136 | core.saveState("pidToKill", 12345); 137 | ``` 138 | 139 | In action's `cleanup.js`: 140 | ```js 141 | const core = require('@actions/core'); 142 | 143 | var pid = core.getState("pidToKill"); 144 | 145 | process.kill(pid); 146 | ``` -------------------------------------------------------------------------------- /node_modules/@actions/core/lib/command.d.ts: -------------------------------------------------------------------------------- 1 | interface CommandProperties { 2 | [key: string]: any; 3 | } 4 | /** 5 | * Commands 6 | * 7 | * Command Format: 8 | * ::name key=value,key=value::message 9 | * 10 | * Examples: 11 | * ::warning::This is the message 12 | * ::set-env name=MY_VAR::some value 13 | */ 14 | export declare function issueCommand(command: string, properties: CommandProperties, message: any): void; 15 | export declare function issue(name: string, message?: string): void; 16 | /** 17 | * Sanitizes an input into a string so it can be passed into issueCommand safely 18 | * @param input input to sanitize into a string 19 | */ 20 | export declare function toCommandValue(input: any): string; 21 | export {}; 22 | -------------------------------------------------------------------------------- /node_modules/@actions/core/lib/command.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importStar = (this && this.__importStar) || function (mod) { 3 | if (mod && mod.__esModule) return mod; 4 | var result = {}; 5 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 6 | result["default"] = mod; 7 | return result; 8 | }; 9 | Object.defineProperty(exports, "__esModule", { value: true }); 10 | const os = __importStar(require("os")); 11 | /** 12 | * Commands 13 | * 14 | * Command Format: 15 | * ::name key=value,key=value::message 16 | * 17 | * Examples: 18 | * ::warning::This is the message 19 | * ::set-env name=MY_VAR::some value 20 | */ 21 | function issueCommand(command, properties, message) { 22 | const cmd = new Command(command, properties, message); 23 | process.stdout.write(cmd.toString() + os.EOL); 24 | } 25 | exports.issueCommand = issueCommand; 26 | function issue(name, message = '') { 27 | issueCommand(name, {}, message); 28 | } 29 | exports.issue = issue; 30 | const CMD_STRING = '::'; 31 | class Command { 32 | constructor(command, properties, message) { 33 | if (!command) { 34 | command = 'missing.command'; 35 | } 36 | this.command = command; 37 | this.properties = properties; 38 | this.message = message; 39 | } 40 | toString() { 41 | let cmdStr = CMD_STRING + this.command; 42 | if (this.properties && Object.keys(this.properties).length > 0) { 43 | cmdStr += ' '; 44 | let first = true; 45 | for (const key in this.properties) { 46 | if (this.properties.hasOwnProperty(key)) { 47 | const val = this.properties[key]; 48 | if (val) { 49 | if (first) { 50 | first = false; 51 | } 52 | else { 53 | cmdStr += ','; 54 | } 55 | cmdStr += `${key}=${escapeProperty(val)}`; 56 | } 57 | } 58 | } 59 | } 60 | cmdStr += `${CMD_STRING}${escapeData(this.message)}`; 61 | return cmdStr; 62 | } 63 | } 64 | /** 65 | * Sanitizes an input into a string so it can be passed into issueCommand safely 66 | * @param input input to sanitize into a string 67 | */ 68 | function toCommandValue(input) { 69 | if (input === null || input === undefined) { 70 | return ''; 71 | } 72 | else if (typeof input === 'string' || input instanceof String) { 73 | return input; 74 | } 75 | return JSON.stringify(input); 76 | } 77 | exports.toCommandValue = toCommandValue; 78 | function escapeData(s) { 79 | return toCommandValue(s) 80 | .replace(/%/g, '%25') 81 | .replace(/\r/g, '%0D') 82 | .replace(/\n/g, '%0A'); 83 | } 84 | function escapeProperty(s) { 85 | return toCommandValue(s) 86 | .replace(/%/g, '%25') 87 | .replace(/\r/g, '%0D') 88 | .replace(/\n/g, '%0A') 89 | .replace(/:/g, '%3A') 90 | .replace(/,/g, '%2C'); 91 | } 92 | //# sourceMappingURL=command.js.map -------------------------------------------------------------------------------- /node_modules/@actions/core/lib/command.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAWxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,cAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} -------------------------------------------------------------------------------- /node_modules/@actions/core/lib/core.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Interface for getInput options 3 | */ 4 | export interface InputOptions { 5 | /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */ 6 | required?: boolean; 7 | } 8 | /** 9 | * The code to exit an action 10 | */ 11 | export declare enum ExitCode { 12 | /** 13 | * A code indicating that the action was successful 14 | */ 15 | Success = 0, 16 | /** 17 | * A code indicating that the action was a failure 18 | */ 19 | Failure = 1 20 | } 21 | /** 22 | * Sets env variable for this action and future actions in the job 23 | * @param name the name of the variable to set 24 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 25 | */ 26 | export declare function exportVariable(name: string, val: any): void; 27 | /** 28 | * Registers a secret which will get masked from logs 29 | * @param secret value of the secret 30 | */ 31 | export declare function setSecret(secret: string): void; 32 | /** 33 | * Prepends inputPath to the PATH (for this action and future actions) 34 | * @param inputPath 35 | */ 36 | export declare function addPath(inputPath: string): void; 37 | /** 38 | * Gets the value of an input. The value is also trimmed. 39 | * 40 | * @param name name of the input to get 41 | * @param options optional. See InputOptions. 42 | * @returns string 43 | */ 44 | export declare function getInput(name: string, options?: InputOptions): string; 45 | /** 46 | * Sets the value of an output. 47 | * 48 | * @param name name of the output to set 49 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 50 | */ 51 | export declare function setOutput(name: string, value: any): void; 52 | /** 53 | * Enables or disables the echoing of commands into stdout for the rest of the step. 54 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 55 | * 56 | */ 57 | export declare function setCommandEcho(enabled: boolean): void; 58 | /** 59 | * Sets the action status to failed. 60 | * When the action exits it will be with an exit code of 1 61 | * @param message add error issue message 62 | */ 63 | export declare function setFailed(message: string | Error): void; 64 | /** 65 | * Gets whether Actions Step Debug is on or not 66 | */ 67 | export declare function isDebug(): boolean; 68 | /** 69 | * Writes debug message to user log 70 | * @param message debug message 71 | */ 72 | export declare function debug(message: string): void; 73 | /** 74 | * Adds an error issue 75 | * @param message error issue message. Errors will be converted to string via toString() 76 | */ 77 | export declare function error(message: string | Error): void; 78 | /** 79 | * Adds an warning issue 80 | * @param message warning issue message. Errors will be converted to string via toString() 81 | */ 82 | export declare function warning(message: string | Error): void; 83 | /** 84 | * Writes info to log with console.log. 85 | * @param message info message 86 | */ 87 | export declare function info(message: string): void; 88 | /** 89 | * Begin an output group. 90 | * 91 | * Output until the next `groupEnd` will be foldable in this group 92 | * 93 | * @param name The name of the output group 94 | */ 95 | export declare function startGroup(name: string): void; 96 | /** 97 | * End an output group. 98 | */ 99 | export declare function endGroup(): void; 100 | /** 101 | * Wrap an asynchronous function call in a group. 102 | * 103 | * Returns the same type as the function itself. 104 | * 105 | * @param name The name of the group 106 | * @param fn The function to wrap in the group 107 | */ 108 | export declare function group(name: string, fn: () => Promise): Promise; 109 | /** 110 | * Saves state for current action, the state can only be retrieved by this action's post job execution. 111 | * 112 | * @param name name of the state to store 113 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 114 | */ 115 | export declare function saveState(name: string, value: any): void; 116 | /** 117 | * Gets the value of an state set by this action's main execution. 118 | * 119 | * @param name name of the state to get 120 | * @returns string 121 | */ 122 | export declare function getState(name: string): string; 123 | -------------------------------------------------------------------------------- /node_modules/@actions/core/lib/core.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 | return new (P || (P = Promise))(function (resolve, reject) { 5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 | }); 10 | }; 11 | var __importStar = (this && this.__importStar) || function (mod) { 12 | if (mod && mod.__esModule) return mod; 13 | var result = {}; 14 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; 15 | result["default"] = mod; 16 | return result; 17 | }; 18 | Object.defineProperty(exports, "__esModule", { value: true }); 19 | const command_1 = require("./command"); 20 | const os = __importStar(require("os")); 21 | const path = __importStar(require("path")); 22 | /** 23 | * The code to exit an action 24 | */ 25 | var ExitCode; 26 | (function (ExitCode) { 27 | /** 28 | * A code indicating that the action was successful 29 | */ 30 | ExitCode[ExitCode["Success"] = 0] = "Success"; 31 | /** 32 | * A code indicating that the action was a failure 33 | */ 34 | ExitCode[ExitCode["Failure"] = 1] = "Failure"; 35 | })(ExitCode = exports.ExitCode || (exports.ExitCode = {})); 36 | //----------------------------------------------------------------------- 37 | // Variables 38 | //----------------------------------------------------------------------- 39 | /** 40 | * Sets env variable for this action and future actions in the job 41 | * @param name the name of the variable to set 42 | * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify 43 | */ 44 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 45 | function exportVariable(name, val) { 46 | const convertedVal = command_1.toCommandValue(val); 47 | process.env[name] = convertedVal; 48 | command_1.issueCommand('set-env', { name }, convertedVal); 49 | } 50 | exports.exportVariable = exportVariable; 51 | /** 52 | * Registers a secret which will get masked from logs 53 | * @param secret value of the secret 54 | */ 55 | function setSecret(secret) { 56 | command_1.issueCommand('add-mask', {}, secret); 57 | } 58 | exports.setSecret = setSecret; 59 | /** 60 | * Prepends inputPath to the PATH (for this action and future actions) 61 | * @param inputPath 62 | */ 63 | function addPath(inputPath) { 64 | command_1.issueCommand('add-path', {}, inputPath); 65 | process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; 66 | } 67 | exports.addPath = addPath; 68 | /** 69 | * Gets the value of an input. The value is also trimmed. 70 | * 71 | * @param name name of the input to get 72 | * @param options optional. See InputOptions. 73 | * @returns string 74 | */ 75 | function getInput(name, options) { 76 | const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; 77 | if (options && options.required && !val) { 78 | throw new Error(`Input required and not supplied: ${name}`); 79 | } 80 | return val.trim(); 81 | } 82 | exports.getInput = getInput; 83 | /** 84 | * Sets the value of an output. 85 | * 86 | * @param name name of the output to set 87 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 88 | */ 89 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 90 | function setOutput(name, value) { 91 | command_1.issueCommand('set-output', { name }, value); 92 | } 93 | exports.setOutput = setOutput; 94 | /** 95 | * Enables or disables the echoing of commands into stdout for the rest of the step. 96 | * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. 97 | * 98 | */ 99 | function setCommandEcho(enabled) { 100 | command_1.issue('echo', enabled ? 'on' : 'off'); 101 | } 102 | exports.setCommandEcho = setCommandEcho; 103 | //----------------------------------------------------------------------- 104 | // Results 105 | //----------------------------------------------------------------------- 106 | /** 107 | * Sets the action status to failed. 108 | * When the action exits it will be with an exit code of 1 109 | * @param message add error issue message 110 | */ 111 | function setFailed(message) { 112 | process.exitCode = ExitCode.Failure; 113 | error(message); 114 | } 115 | exports.setFailed = setFailed; 116 | //----------------------------------------------------------------------- 117 | // Logging Commands 118 | //----------------------------------------------------------------------- 119 | /** 120 | * Gets whether Actions Step Debug is on or not 121 | */ 122 | function isDebug() { 123 | return process.env['RUNNER_DEBUG'] === '1'; 124 | } 125 | exports.isDebug = isDebug; 126 | /** 127 | * Writes debug message to user log 128 | * @param message debug message 129 | */ 130 | function debug(message) { 131 | command_1.issueCommand('debug', {}, message); 132 | } 133 | exports.debug = debug; 134 | /** 135 | * Adds an error issue 136 | * @param message error issue message. Errors will be converted to string via toString() 137 | */ 138 | function error(message) { 139 | command_1.issue('error', message instanceof Error ? message.toString() : message); 140 | } 141 | exports.error = error; 142 | /** 143 | * Adds an warning issue 144 | * @param message warning issue message. Errors will be converted to string via toString() 145 | */ 146 | function warning(message) { 147 | command_1.issue('warning', message instanceof Error ? message.toString() : message); 148 | } 149 | exports.warning = warning; 150 | /** 151 | * Writes info to log with console.log. 152 | * @param message info message 153 | */ 154 | function info(message) { 155 | process.stdout.write(message + os.EOL); 156 | } 157 | exports.info = info; 158 | /** 159 | * Begin an output group. 160 | * 161 | * Output until the next `groupEnd` will be foldable in this group 162 | * 163 | * @param name The name of the output group 164 | */ 165 | function startGroup(name) { 166 | command_1.issue('group', name); 167 | } 168 | exports.startGroup = startGroup; 169 | /** 170 | * End an output group. 171 | */ 172 | function endGroup() { 173 | command_1.issue('endgroup'); 174 | } 175 | exports.endGroup = endGroup; 176 | /** 177 | * Wrap an asynchronous function call in a group. 178 | * 179 | * Returns the same type as the function itself. 180 | * 181 | * @param name The name of the group 182 | * @param fn The function to wrap in the group 183 | */ 184 | function group(name, fn) { 185 | return __awaiter(this, void 0, void 0, function* () { 186 | startGroup(name); 187 | let result; 188 | try { 189 | result = yield fn(); 190 | } 191 | finally { 192 | endGroup(); 193 | } 194 | return result; 195 | }); 196 | } 197 | exports.group = group; 198 | //----------------------------------------------------------------------- 199 | // Wrapper action state 200 | //----------------------------------------------------------------------- 201 | /** 202 | * Saves state for current action, the state can only be retrieved by this action's post job execution. 203 | * 204 | * @param name name of the state to store 205 | * @param value value to store. Non-string values will be converted to a string via JSON.stringify 206 | */ 207 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 208 | function saveState(name, value) { 209 | command_1.issueCommand('save-state', { name }, value); 210 | } 211 | exports.saveState = saveState; 212 | /** 213 | * Gets the value of an state set by this action's main execution. 214 | * 215 | * @param name name of the state to get 216 | * @returns string 217 | */ 218 | function getState(name) { 219 | return process.env[`STATE_${name}`] || ''; 220 | } 221 | exports.getState = getState; 222 | //# sourceMappingURL=core.js.map -------------------------------------------------------------------------------- /node_modules/@actions/core/lib/core.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6D;AAE7D,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,wBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAChC,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;AAC/C,CAAC;AAJD,wCAIC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAuB;IAC3C,eAAK,CAAC,OAAO,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC7C,eAAK,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"} -------------------------------------------------------------------------------- /node_modules/@actions/core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@actions/core", 3 | "version": "1.2.4", 4 | "description": "Actions core lib", 5 | "keywords": [ 6 | "github", 7 | "actions", 8 | "core" 9 | ], 10 | "homepage": "https://github.com/actions/toolkit/tree/master/packages/core", 11 | "license": "MIT", 12 | "main": "lib/core.js", 13 | "types": "lib/core.d.ts", 14 | "directories": { 15 | "lib": "lib", 16 | "test": "__tests__" 17 | }, 18 | "files": [ 19 | "lib" 20 | ], 21 | "publishConfig": { 22 | "access": "public" 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/actions/toolkit.git", 27 | "directory": "packages/core" 28 | }, 29 | "scripts": { 30 | "audit-moderate": "npm install && npm audit --audit-level=moderate", 31 | "test": "echo \"Error: run tests from root\" && exit 1", 32 | "tsc": "tsc" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/actions/toolkit/issues" 36 | }, 37 | "devDependencies": { 38 | "@types/node": "^12.0.2" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /node_modules/base-x/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 base-x contributors 4 | Copyright (c) 2014-2018 The Bitcoin Core developers 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /node_modules/base-x/README.md: -------------------------------------------------------------------------------- 1 | # base-x 2 | 3 | [![NPM Package](https://img.shields.io/npm/v/base-x.svg?style=flat-square)](https://www.npmjs.org/package/base-x) 4 | [![Build Status](https://img.shields.io/travis/cryptocoinjs/base-x.svg?branch=master&style=flat-square)](https://travis-ci.org/cryptocoinjs/base-x) 5 | 6 | [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) 7 | 8 | Fast base encoding / decoding of any given alphabet using bitcoin style leading 9 | zero compression. 10 | 11 | **WARNING:** This module is **NOT RFC3548** compliant, it cannot be used for base16 (hex), base32, or base64 encoding in a standards compliant manner. 12 | 13 | ## Example 14 | 15 | Base58 16 | 17 | ``` javascript 18 | var BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' 19 | var bs58 = require('base-x')(BASE58) 20 | 21 | var decoded = bs58.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr') 22 | 23 | console.log(decoded) 24 | // => 25 | 26 | console.log(bs58.encode(decoded)) 27 | // => 5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr 28 | ``` 29 | 30 | ### Alphabets 31 | 32 | See below for a list of commonly recognized alphabets, and their respective base. 33 | 34 | Base | Alphabet 35 | ------------- | ------------- 36 | 2 | `01` 37 | 8 | `01234567` 38 | 11 | `0123456789a` 39 | 16 | `0123456789abcdef` 40 | 32 | `0123456789ABCDEFGHJKMNPQRSTVWXYZ` 41 | 32 | `ybndrfg8ejkmcpqxot1uwisza345h769` (z-base-32) 42 | 36 | `0123456789abcdefghijklmnopqrstuvwxyz` 43 | 58 | `123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz` 44 | 62 | `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` 45 | 64 | `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/` 46 | 66 | `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~` 47 | 48 | 49 | ## How it works 50 | 51 | It encodes octet arrays by doing long divisions on all significant digits in the 52 | array, creating a representation of that number in the new base. Then for every 53 | leading zero in the input (not significant as a number) it will encode as a 54 | single leader character. This is the first in the alphabet and will decode as 8 55 | bits. The other characters depend upon the base. For example, a base58 alphabet 56 | packs roughly 5.858 bits per character. 57 | 58 | This means the encoded string 000f (using a base16, 0-f alphabet) will actually decode 59 | to 4 bytes unlike a canonical hex encoding which uniformly packs 4 bits into each 60 | character. 61 | 62 | While unusual, this does mean that no padding is required and it works for bases 63 | like 43. 64 | 65 | 66 | ## LICENSE [MIT](LICENSE) 67 | A direct derivation of the base58 implementation from [`bitcoin/bitcoin`](https://github.com/bitcoin/bitcoin/blob/f1e2f2a85962c1664e4e55471061af0eaa798d40/src/base58.cpp), generalized for variable length alphabets. 68 | -------------------------------------------------------------------------------- /node_modules/base-x/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base-x", 3 | "version": "3.0.8", 4 | "description": "Fast base encoding / decoding of any given alphabet", 5 | "keywords": [ 6 | "base-x", 7 | "base58", 8 | "base62", 9 | "base64", 10 | "crypto", 11 | "crytography", 12 | "decode", 13 | "decoding", 14 | "encode", 15 | "encoding" 16 | ], 17 | "homepage": "https://github.com/cryptocoinjs/base-x", 18 | "bugs": { 19 | "url": "https://github.com/cryptocoinjs/base-x/issues" 20 | }, 21 | "license": "MIT", 22 | "author": "Daniel Cousens", 23 | "files": [ 24 | "src" 25 | ], 26 | "main": "src/index.js", 27 | "types": "src/index.d.ts", 28 | "repository": { 29 | "type": "git", 30 | "url": "https://github.com/cryptocoinjs/base-x.git" 31 | }, 32 | "scripts": { 33 | "build": "tsc -p ./tsconfig.json ; standard --fix", 34 | "gitdiff": "npm run build && git diff --exit-code", 35 | "prepublish": "npm run gitdiff", 36 | "standard": "standard", 37 | "test": "npm run unit && npm run standard", 38 | "unit": "tape test/*.js" 39 | }, 40 | "devDependencies": { 41 | "@types/node": "12.0.10", 42 | "standard": "^10.0.3", 43 | "tape": "^4.5.1", 44 | "typescript": "3.5.2" 45 | }, 46 | "dependencies": { 47 | "safe-buffer": "^5.0.1" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /node_modules/base-x/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | declare function base(ALPHABET: string): base.BaseConverter; 3 | export = base; 4 | declare namespace base { 5 | interface BaseConverter { 6 | encode(buffer: Buffer | number[] | Uint8Array): string; 7 | decodeUnsafe(string: string): Buffer | undefined; 8 | decode(string: string): Buffer; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/base-x/src/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // base-x encoding / decoding 3 | // Copyright (c) 2018 base-x contributors 4 | // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) 5 | // Distributed under the MIT software license, see the accompanying 6 | // file LICENSE or http://www.opensource.org/licenses/mit-license.php. 7 | // @ts-ignore 8 | var _Buffer = require('safe-buffer').Buffer 9 | function base (ALPHABET) { 10 | if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') } 11 | var BASE_MAP = new Uint8Array(256) 12 | for (var j = 0; j < BASE_MAP.length; j++) { 13 | BASE_MAP[j] = 255 14 | } 15 | for (var i = 0; i < ALPHABET.length; i++) { 16 | var x = ALPHABET.charAt(i) 17 | var xc = x.charCodeAt(0) 18 | if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') } 19 | BASE_MAP[xc] = i 20 | } 21 | var BASE = ALPHABET.length 22 | var LEADER = ALPHABET.charAt(0) 23 | var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up 24 | var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up 25 | function encode (source) { 26 | if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source) } 27 | if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') } 28 | if (source.length === 0) { return '' } 29 | // Skip & count leading zeroes. 30 | var zeroes = 0 31 | var length = 0 32 | var pbegin = 0 33 | var pend = source.length 34 | while (pbegin !== pend && source[pbegin] === 0) { 35 | pbegin++ 36 | zeroes++ 37 | } 38 | // Allocate enough space in big-endian base58 representation. 39 | var size = ((pend - pbegin) * iFACTOR + 1) >>> 0 40 | var b58 = new Uint8Array(size) 41 | // Process the bytes. 42 | while (pbegin !== pend) { 43 | var carry = source[pbegin] 44 | // Apply "b58 = b58 * 256 + ch". 45 | var i = 0 46 | for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { 47 | carry += (256 * b58[it1]) >>> 0 48 | b58[it1] = (carry % BASE) >>> 0 49 | carry = (carry / BASE) >>> 0 50 | } 51 | if (carry !== 0) { throw new Error('Non-zero carry') } 52 | length = i 53 | pbegin++ 54 | } 55 | // Skip leading zeroes in base58 result. 56 | var it2 = size - length 57 | while (it2 !== size && b58[it2] === 0) { 58 | it2++ 59 | } 60 | // Translate the result into a string. 61 | var str = LEADER.repeat(zeroes) 62 | for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) } 63 | return str 64 | } 65 | function decodeUnsafe (source) { 66 | if (typeof source !== 'string') { throw new TypeError('Expected String') } 67 | if (source.length === 0) { return _Buffer.alloc(0) } 68 | var psz = 0 69 | // Skip leading spaces. 70 | if (source[psz] === ' ') { return } 71 | // Skip and count leading '1's. 72 | var zeroes = 0 73 | var length = 0 74 | while (source[psz] === LEADER) { 75 | zeroes++ 76 | psz++ 77 | } 78 | // Allocate enough space in big-endian base256 representation. 79 | var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. 80 | var b256 = new Uint8Array(size) 81 | // Process the characters. 82 | while (source[psz]) { 83 | // Decode character 84 | var carry = BASE_MAP[source.charCodeAt(psz)] 85 | // Invalid character 86 | if (carry === 255) { return } 87 | var i = 0 88 | for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { 89 | carry += (BASE * b256[it3]) >>> 0 90 | b256[it3] = (carry % 256) >>> 0 91 | carry = (carry / 256) >>> 0 92 | } 93 | if (carry !== 0) { throw new Error('Non-zero carry') } 94 | length = i 95 | psz++ 96 | } 97 | // Skip trailing spaces. 98 | if (source[psz] === ' ') { return } 99 | // Skip leading zeroes in b256. 100 | var it4 = size - length 101 | while (it4 !== size && b256[it4] === 0) { 102 | it4++ 103 | } 104 | var vch = _Buffer.allocUnsafe(zeroes + (size - it4)) 105 | vch.fill(0x00, 0, zeroes) 106 | var j = zeroes 107 | while (it4 !== size) { 108 | vch[j++] = b256[it4++] 109 | } 110 | return vch 111 | } 112 | function decode (string) { 113 | var buffer = decodeUnsafe(string) 114 | if (buffer) { return buffer } 115 | throw new Error('Non-base' + BASE + ' character') 116 | } 117 | return { 118 | encode: encode, 119 | decodeUnsafe: decodeUnsafe, 120 | decode: decode 121 | } 122 | } 123 | module.exports = base 124 | -------------------------------------------------------------------------------- /node_modules/base64-js/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Jameson Little 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/base64-js/README.md: -------------------------------------------------------------------------------- 1 | base64-js 2 | ========= 3 | 4 | `base64-js` does basic base64 encoding/decoding in pure JS. 5 | 6 | [![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js) 7 | 8 | Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data. 9 | 10 | Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does. 11 | 12 | ## install 13 | 14 | With [npm](https://npmjs.org) do: 15 | 16 | `npm install base64-js` and `var base64js = require('base64-js')` 17 | 18 | For use in web browsers do: 19 | 20 | `` 21 | 22 | ## methods 23 | 24 | `base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument. 25 | 26 | * `byteLength` - Takes a base64 string and returns length of byte array 27 | * `toByteArray` - Takes a base64 string and returns a byte array 28 | * `fromByteArray` - Takes a byte array and returns a base64 string 29 | 30 | ## license 31 | 32 | MIT 33 | -------------------------------------------------------------------------------- /node_modules/base64-js/base64js.min.js: -------------------------------------------------------------------------------- 1 | (function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function d(a,f,i){function u(n,r){if(!f[n]){if(!a[n]){var e="function"==typeof require&&require;if(!r&&e)return e(n,!0);if(v)return v(n,!0);var t=new Error("Cannot find module '"+n+"'");throw t.code="MODULE_NOT_FOUND",t}var o=f[n]={exports:{}};a[n][0].call(o.exports,function(r){var e=a[n][1][r];return u(e||r)},o,o.exports,d,a,f,i)}return f[n].exports}for(var v="function"==typeof require&&require,r=0;r0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function f(r){var e=c(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function h(r,e,n){return(e+n)*3/4-n}function i(r){var e;var n=c(r);var t=n[0];var o=n[1];var a=new d(h(r,t,o));var f=0;var i=o>0?t-4:t;var u;for(u=0;u>16&255;a[f++]=e>>8&255;a[f++]=e&255}if(o===2){e=v[r.charCodeAt(u)]<<2|v[r.charCodeAt(u+1)]>>4;a[f++]=e&255}if(o===1){e=v[r.charCodeAt(u)]<<10|v[r.charCodeAt(u+1)]<<4|v[r.charCodeAt(u+2)]>>2;a[f++]=e>>8&255;a[f++]=e&255}return a}function s(r){return u[r>>18&63]+u[r>>12&63]+u[r>>6&63]+u[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;ai?i:f+a))}if(t===1){e=r[n-1];o.push(u[e>>2]+u[e<<4&63]+"==")}else if(t===2){e=(r[n-2]<<8)+r[n-1];o.push(u[e>>10]+u[e>>4&63]+u[e<<2&63]+"=")}return o.join("")}},{}]},{},[])("/")}); 2 | -------------------------------------------------------------------------------- /node_modules/base64-js/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | exports.byteLength = byteLength 4 | exports.toByteArray = toByteArray 5 | exports.fromByteArray = fromByteArray 6 | 7 | var lookup = [] 8 | var revLookup = [] 9 | var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array 10 | 11 | var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' 12 | for (var i = 0, len = code.length; i < len; ++i) { 13 | lookup[i] = code[i] 14 | revLookup[code.charCodeAt(i)] = i 15 | } 16 | 17 | // Support decoding URL-safe base64 strings, as Node.js does. 18 | // See: https://en.wikipedia.org/wiki/Base64#URL_applications 19 | revLookup['-'.charCodeAt(0)] = 62 20 | revLookup['_'.charCodeAt(0)] = 63 21 | 22 | function getLens (b64) { 23 | var len = b64.length 24 | 25 | if (len % 4 > 0) { 26 | throw new Error('Invalid string. Length must be a multiple of 4') 27 | } 28 | 29 | // Trim off extra bytes after placeholder bytes are found 30 | // See: https://github.com/beatgammit/base64-js/issues/42 31 | var validLen = b64.indexOf('=') 32 | if (validLen === -1) validLen = len 33 | 34 | var placeHoldersLen = validLen === len 35 | ? 0 36 | : 4 - (validLen % 4) 37 | 38 | return [validLen, placeHoldersLen] 39 | } 40 | 41 | // base64 is 4/3 + up to two characters of the original data 42 | function byteLength (b64) { 43 | var lens = getLens(b64) 44 | var validLen = lens[0] 45 | var placeHoldersLen = lens[1] 46 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 47 | } 48 | 49 | function _byteLength (b64, validLen, placeHoldersLen) { 50 | return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen 51 | } 52 | 53 | function toByteArray (b64) { 54 | var tmp 55 | var lens = getLens(b64) 56 | var validLen = lens[0] 57 | var placeHoldersLen = lens[1] 58 | 59 | var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) 60 | 61 | var curByte = 0 62 | 63 | // if there are placeholders, only get up to the last complete 4 chars 64 | var len = placeHoldersLen > 0 65 | ? validLen - 4 66 | : validLen 67 | 68 | var i 69 | for (i = 0; i < len; i += 4) { 70 | tmp = 71 | (revLookup[b64.charCodeAt(i)] << 18) | 72 | (revLookup[b64.charCodeAt(i + 1)] << 12) | 73 | (revLookup[b64.charCodeAt(i + 2)] << 6) | 74 | revLookup[b64.charCodeAt(i + 3)] 75 | arr[curByte++] = (tmp >> 16) & 0xFF 76 | arr[curByte++] = (tmp >> 8) & 0xFF 77 | arr[curByte++] = tmp & 0xFF 78 | } 79 | 80 | if (placeHoldersLen === 2) { 81 | tmp = 82 | (revLookup[b64.charCodeAt(i)] << 2) | 83 | (revLookup[b64.charCodeAt(i + 1)] >> 4) 84 | arr[curByte++] = tmp & 0xFF 85 | } 86 | 87 | if (placeHoldersLen === 1) { 88 | tmp = 89 | (revLookup[b64.charCodeAt(i)] << 10) | 90 | (revLookup[b64.charCodeAt(i + 1)] << 4) | 91 | (revLookup[b64.charCodeAt(i + 2)] >> 2) 92 | arr[curByte++] = (tmp >> 8) & 0xFF 93 | arr[curByte++] = tmp & 0xFF 94 | } 95 | 96 | return arr 97 | } 98 | 99 | function tripletToBase64 (num) { 100 | return lookup[num >> 18 & 0x3F] + 101 | lookup[num >> 12 & 0x3F] + 102 | lookup[num >> 6 & 0x3F] + 103 | lookup[num & 0x3F] 104 | } 105 | 106 | function encodeChunk (uint8, start, end) { 107 | var tmp 108 | var output = [] 109 | for (var i = start; i < end; i += 3) { 110 | tmp = 111 | ((uint8[i] << 16) & 0xFF0000) + 112 | ((uint8[i + 1] << 8) & 0xFF00) + 113 | (uint8[i + 2] & 0xFF) 114 | output.push(tripletToBase64(tmp)) 115 | } 116 | return output.join('') 117 | } 118 | 119 | function fromByteArray (uint8) { 120 | var tmp 121 | var len = uint8.length 122 | var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes 123 | var parts = [] 124 | var maxChunkLength = 16383 // must be multiple of 3 125 | 126 | // go through the array every three bytes, we'll deal with trailing stuff later 127 | for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { 128 | parts.push(encodeChunk( 129 | uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) 130 | )) 131 | } 132 | 133 | // pad the end with zeros, but make sure to not forget the extra bytes 134 | if (extraBytes === 1) { 135 | tmp = uint8[len - 1] 136 | parts.push( 137 | lookup[tmp >> 2] + 138 | lookup[(tmp << 4) & 0x3F] + 139 | '==' 140 | ) 141 | } else if (extraBytes === 2) { 142 | tmp = (uint8[len - 2] << 8) + uint8[len - 1] 143 | parts.push( 144 | lookup[tmp >> 10] + 145 | lookup[(tmp >> 4) & 0x3F] + 146 | lookup[(tmp << 2) & 0x3F] + 147 | '=' 148 | ) 149 | } 150 | 151 | return parts.join('') 152 | } 153 | -------------------------------------------------------------------------------- /node_modules/base64-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base64-js", 3 | "description": "Base64 encoding/decoding in pure JS", 4 | "version": "1.3.1", 5 | "author": "T. Jameson Little ", 6 | "bugs": { 7 | "url": "https://github.com/beatgammit/base64-js/issues" 8 | }, 9 | "devDependencies": { 10 | "benchmark": "^2.1.4", 11 | "browserify": "^16.3.0", 12 | "standard": "*", 13 | "tape": "4.x", 14 | "uglify-js": "^3.6.0" 15 | }, 16 | "homepage": "https://github.com/beatgammit/base64-js", 17 | "keywords": [ 18 | "base64" 19 | ], 20 | "license": "MIT", 21 | "main": "index.js", 22 | "repository": { 23 | "type": "git", 24 | "url": "git://github.com/beatgammit/base64-js.git" 25 | }, 26 | "scripts": { 27 | "build": "browserify -s base64js -r ./ | uglifyjs -m > base64js.min.js", 28 | "lint": "standard", 29 | "test": "npm run lint && npm run unit", 30 | "unit": "tape test/*.js" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /node_modules/buffer/AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Authors 2 | 3 | #### Ordered by first contribution. 4 | 5 | - Romain Beauxis (toots@rastageeks.org) 6 | - Tobias Koppers (tobias.koppers@googlemail.com) 7 | - Janus (ysangkok@gmail.com) 8 | - Rainer Dreyer (rdrey1@gmail.com) 9 | - Tõnis Tiigi (tonistiigi@gmail.com) 10 | - James Halliday (mail@substack.net) 11 | - Michael Williamson (mike@zwobble.org) 12 | - elliottcable (github@elliottcable.name) 13 | - rafael (rvalle@livelens.net) 14 | - Andrew Kelley (superjoe30@gmail.com) 15 | - Andreas Madsen (amwebdk@gmail.com) 16 | - Mike Brevoort (mike.brevoort@pearson.com) 17 | - Brian White (mscdex@mscdex.net) 18 | - Feross Aboukhadijeh (feross@feross.org) 19 | - Ruben Verborgh (ruben@verborgh.org) 20 | - eliang (eliang.cs@gmail.com) 21 | - Jesse Tane (jesse.tane@gmail.com) 22 | - Alfonso Boza (alfonso@cloud.com) 23 | - Mathias Buus (mathiasbuus@gmail.com) 24 | - Devon Govett (devongovett@gmail.com) 25 | - Daniel Cousens (github@dcousens.com) 26 | - Joseph Dykstra (josephdykstra@gmail.com) 27 | - Parsha Pourkhomami (parshap+git@gmail.com) 28 | - Damjan Košir (damjan.kosir@gmail.com) 29 | - daverayment (dave.rayment@gmail.com) 30 | - kawanet (u-suke@kawa.net) 31 | - Linus Unnebäck (linus@folkdatorn.se) 32 | - Nolan Lawson (nolan.lawson@gmail.com) 33 | - Calvin Metcalf (calvin.metcalf@gmail.com) 34 | - Koki Takahashi (hakatasiloving@gmail.com) 35 | - Guy Bedford (guybedford@gmail.com) 36 | - Jan Schär (jscissr@gmail.com) 37 | - RaulTsc (tomescu.raul@gmail.com) 38 | - Matthieu Monsch (monsch@alum.mit.edu) 39 | - Dan Ehrenberg (littledan@chromium.org) 40 | - Kirill Fomichev (fanatid@ya.ru) 41 | - Yusuke Kawasaki (u-suke@kawa.net) 42 | - DC (dcposch@dcpos.ch) 43 | - John-David Dalton (john.david.dalton@gmail.com) 44 | - adventure-yunfei (adventure030@gmail.com) 45 | - Emil Bay (github@tixz.dk) 46 | - Sam Sudar (sudar.sam@gmail.com) 47 | - Volker Mische (volker.mische@gmail.com) 48 | - David Walton (support@geekstocks.com) 49 | - Сковорода Никита Андреевич (chalkerx@gmail.com) 50 | - greenkeeper[bot] (greenkeeper[bot]@users.noreply.github.com) 51 | - ukstv (sergey.ukustov@machinomy.com) 52 | - Renée Kooi (renee@kooi.me) 53 | - ranbochen (ranbochen@qq.com) 54 | - Vladimir Borovik (bobahbdb@gmail.com) 55 | - greenkeeper[bot] (23040076+greenkeeper[bot]@users.noreply.github.com) 56 | - kumavis (aaron@kumavis.me) 57 | - Sergey Ukustov (sergey.ukustov@machinomy.com) 58 | - Fei Liu (liu.feiwood@gmail.com) 59 | - Blaine Bublitz (blaine.bublitz@gmail.com) 60 | - Niklas Mischkulnig (mischnic@users.noreply.github.com) 61 | 62 | #### Generated by bin/update-authors.sh. 63 | -------------------------------------------------------------------------------- /node_modules/buffer/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Feross Aboukhadijeh, and other contributors. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/buffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buffer", 3 | "description": "Node.js Buffer API, for the browser", 4 | "version": "5.6.0", 5 | "author": { 6 | "name": "Feross Aboukhadijeh", 7 | "email": "feross@feross.org", 8 | "url": "http://feross.org" 9 | }, 10 | "bugs": { 11 | "url": "https://github.com/feross/buffer/issues" 12 | }, 13 | "contributors": [ 14 | "Romain Beauxis ", 15 | "James Halliday " 16 | ], 17 | "dependencies": { 18 | "base64-js": "^1.0.2", 19 | "ieee754": "^1.1.4" 20 | }, 21 | "devDependencies": { 22 | "airtap": "^3.0.0", 23 | "benchmark": "^2.0.0", 24 | "browserify": "^16.1.0", 25 | "concat-stream": "^2.0.0", 26 | "hyperquest": "^2.0.0", 27 | "is-buffer": "^2.0.0", 28 | "is-nan": "^1.0.1", 29 | "split": "^1.0.0", 30 | "standard": "*", 31 | "tape": "^4.0.0", 32 | "through2": "^3.0.1", 33 | "uglify-js": "^3.4.5" 34 | }, 35 | "homepage": "https://github.com/feross/buffer", 36 | "jspm": { 37 | "map": { 38 | "./index.js": { 39 | "node": "@node/buffer" 40 | } 41 | } 42 | }, 43 | "keywords": [ 44 | "arraybuffer", 45 | "browser", 46 | "browserify", 47 | "buffer", 48 | "compatible", 49 | "dataview", 50 | "uint8array" 51 | ], 52 | "license": "MIT", 53 | "main": "index.js", 54 | "types": "index.d.ts", 55 | "repository": { 56 | "type": "git", 57 | "url": "git://github.com/feross/buffer.git" 58 | }, 59 | "scripts": { 60 | "perf": "browserify --debug perf/bracket-notation.js > perf/bundle.js && open perf/index.html", 61 | "perf-node": "node perf/bracket-notation.js && node perf/concat.js && node perf/copy-big.js && node perf/copy.js && node perf/new-big.js && node perf/new.js && node perf/readDoubleBE.js && node perf/readFloatBE.js && node perf/readUInt32LE.js && node perf/slice.js && node perf/writeFloatBE.js", 62 | "size": "browserify -r ./ | uglifyjs -c -m | gzip | wc -c", 63 | "test": "standard && node ./bin/test.js", 64 | "test-browser-es5": "airtap -- test/*.js", 65 | "test-browser-es5-local": "airtap --local -- test/*.js", 66 | "test-browser-es6": "airtap -- test/*.js test/node/*.js", 67 | "test-browser-es6-local": "airtap --local -- test/*.js test/node/*.js", 68 | "test-node": "tape test/*.js test/node/*.js", 69 | "update-authors": "./bin/update-authors.sh" 70 | }, 71 | "standard": { 72 | "ignore": [ 73 | "test/node/**/*.js", 74 | "test/common.js", 75 | "test/_polyfill.js", 76 | "perf/**/*.js" 77 | ], 78 | "globals": [ 79 | "SharedArrayBuffer" 80 | ] 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /node_modules/cids/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [lints] 8 | 9 | [options] 10 | 11 | [strict] 12 | -------------------------------------------------------------------------------- /node_modules/cids/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: npm 3 | stages: 4 | - check 5 | - test 6 | - cov 7 | 8 | node_js: 9 | - '10' 10 | 11 | os: 12 | - linux 13 | - osx 14 | - windows 15 | 16 | script: npx nyc -s npm run test:node -- --bail 17 | after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov 18 | 19 | jobs: 20 | include: 21 | - stage: check 22 | script: 23 | - npx aegir commitlint --travis 24 | - npx aegir dep-check 25 | - npm run lint 26 | 27 | - stage: test 28 | name: chrome 29 | addons: 30 | chrome: stable 31 | script: npx aegir test -t browser -t webworker 32 | 33 | - stage: test 34 | name: firefox 35 | addons: 36 | firefox: latest 37 | script: npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless 38 | 39 | notifications: 40 | email: false 41 | -------------------------------------------------------------------------------- /node_modules/cids/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Friedel Ziegelmayer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/cids/README.md: -------------------------------------------------------------------------------- 1 | # js-cid 2 | 3 | [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai/) 4 | [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) 5 | [![Travis CI](https://flat.badgen.net/travis/multiformats/js-cid)](https://travis-ci.com/multiformats/js-cid) 6 | [![Coverage Status](https://coveralls.io/repos/github/multiformats/js-cid/badge.svg?branch=master)](https://coveralls.io/github/multiformats/js-cid?branch=master) 7 | [![Dependency Status](https://david-dm.org/multiformats/js-cid.svg?style=flat-square)](https://david-dm.org/multiformats/js-cid) 8 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) 9 | [![Greenkeeper badge](https://badges.greenkeeper.io/multiformats/js-cid.svg)](https://greenkeeper.io/) 10 | 11 | > [CID](https://github.com/multiformats/cid) implementation in JavaScript. 12 | 13 | ## Lead Maintainer 14 | 15 | [Volker Mische](https://github.com/vmx) 16 | 17 | ## Table of Contents 18 | 19 | - [Install](#install) 20 | - [Usage](#usage) 21 | - [API](#api) 22 | - [Contribute](#contribute) 23 | - [License](#license) 24 | 25 | ## Install 26 | 27 | ### In Node.js through npm 28 | 29 | ```bash 30 | $ npm install --save cids 31 | ``` 32 | 33 | ### Browser: Browserify, Webpack, other bundlers 34 | 35 | The code published to npm that gets loaded on require is in fact an ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process. 36 | 37 | ```js 38 | const CID = require('cids') 39 | ``` 40 | 41 | ### In the Browser through ` 47 | 48 | 49 | ``` 50 | 51 | #### Gotchas 52 | 53 | You will need to use Node.js `Buffer` API compatible, if you are running inside the browser, you can access it by `multihash.Buffer` or you can install Feross's [Buffer](https://github.com/feross/buffer). 54 | 55 | ## Usage 56 | 57 | You can create an instance from a CID string or CID Buffer 58 | 59 | ```js 60 | const CID = require('cids') 61 | 62 | const cid = new CID('bafybeig6xv5nwphfmvcnektpnojts33jqcuam7bmye2pb54adnrtccjlsu') 63 | 64 | cid.version // 1 65 | cid.codec // 'dag-pb' 66 | cid.multibaseName // 'base32' 67 | cid.toString() 68 | // 'bafybeig6xv5nwphfmvcnektpnojts33jqcuam7bmye2pb54adnrtccjlsu' 69 | ``` 70 | 71 | or by specifying the [cid version](https://github.com/multiformats/cid#versions), [multicodec name](https://github.com/multiformats/multicodec/blob/master/table.csv) and [multihash](https://github.com/multiformats/multihash): 72 | 73 | ```js 74 | const CID = require('cids') 75 | const multihashing = require('multihashing-async') 76 | 77 | const hash = await multihashing(Buffer.from('OMG!'), 'sha2-256') 78 | const cid = new CID(1, 'dag-pb', hash) 79 | console.log(cid.toString()) 80 | // bafybeig6xv5nwphfmvcnektpnojts33jqcuam7bmye2pb54adnrtccjlsu 81 | ``` 82 | 83 | The string form of v1 CIDs defaults to `base32` encoding (v0 CIDs are always `base58btc` encoded). When creating a new instance you can optionally specify the default multibase to use when calling `toBaseEncodedString()` or `toString()` 84 | 85 | 86 | ```js 87 | const cid = new CID(1, 'raw', hash, 'base64') 88 | console.log(cid.toString()) 89 | // mAXASIN69ets85WVE0ipva5M5b2mAqAZ8LME08PeAG2MxCSuV 90 | ``` 91 | 92 | If you construct an instance from a valid CID string, the base you provided will be preserved as the default. 93 | 94 | ```js 95 | // e.g. a base64url encoded CID 96 | const cid = new CID('uAXASIHJSUj5lkfuP5VPWf_VahvhARLRqPkF24QxY-lKaSqvV') 97 | cid.toString() 98 | // uAXASIHJSUj5lkfuP5VPWf_VahvhARLRqPkF24QxY-lKaSqvV 99 | ``` 100 | 101 | 102 | ## API 103 | 104 | ### CID.isCID(cid) 105 | 106 | Returns true if object is a valid CID instance, false if not valid. 107 | 108 | It's important to use this method rather than `instanceof` checks in 109 | order to handle CID objects from different versions of this module. 110 | 111 | ### CID.validateCID(cid) 112 | 113 | Validates the different components (version, codec, multihash, multibaseName) of the CID 114 | instance. Throws an `Error` if not valid. 115 | 116 | ### new CID(version, codec, multihash, [multibaseName]) 117 | 118 | `version` must be [either 0 or 1](https://github.com/multiformats/cid#versions). 119 | 120 | `codec` must be a string of a valid [registered codec](https://github.com/multiformats/multicodec/blob/master/table.csv). 121 | 122 | `multihash` must be a `Buffer` instance of a valid [multihash](https://github.com/multiformats/multihash). 123 | 124 | `multibaseName` optional string. Must be a valid [multibase](https://github.com/multiformats/multibase/blob/master/multibase.csv) name. Default is `base58btc` for v0 CIDs or `base32` for v1 CIDs. 125 | 126 | ### new CID(baseEncodedString) 127 | 128 | Additionally, you can instantiate an instance from a base encoded 129 | string. 130 | 131 | ### new CID(Buffer) 132 | 133 | Additionally, you can instantiate an instance from a buffer. 134 | 135 | #### cid.codec 136 | 137 | Property containing the codec string. 138 | 139 | #### cid.version 140 | 141 | Property containing the CID version integer. 142 | 143 | #### cid.multihash 144 | 145 | Property containing the multihash buffer. 146 | 147 | #### cid.multibaseName 148 | 149 | Property containing the default base to use when calling `.toString` 150 | 151 | #### cid.buffer 152 | 153 | Property containing the full CID encoded as a `Buffer`. 154 | 155 | #### cid.prefix 156 | 157 | Proprety containing a buffer of the CID version, codec, and the prefix 158 | section of the multihash. 159 | 160 | #### cid.toV0() 161 | 162 | Returns the CID encoded in version 0. Only works for `dag-pb` codecs. 163 | 164 | Throws if codec is not `dag-pb`. 165 | 166 | #### cid.toV1() 167 | 168 | Returns the CID encoded in version 1. 169 | 170 | #### cid.toBaseEncodedString(base=this.multibaseName) 171 | 172 | Returns a base encoded string of the CID. Defaults to the base encoding in `this.multibaseName`. 173 | 174 | The value of `this.multibaseName` depends on how the instance was constructed: 175 | 176 | 1. If the CID was constructed from an object that already had a multibase (a string or an existing CID) then it retains that base. 177 | 2. If the CID was constructed from an object that _did not_ have a multibase (a buffer, or by passing only version + codec + multihash to the constructor), then `multibaseName` will be `base58btc` for a v0 CID or `base32` for a v1 CID. 178 | 179 | #### cid.toString(base=this.multibaseName) 180 | 181 | Shorthand for `cid.toBaseEncodedString` described above. 182 | 183 | #### cid.equals(cid) 184 | 185 | Compare cid instance. Returns true if CID's are identical, false if 186 | otherwise. 187 | 188 | ## Contribute 189 | 190 | [![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) 191 | 192 | Contributions welcome. Please check out [the issues](https://github.com/multiformats/js-cid/issues). 193 | 194 | Check out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). 195 | 196 | Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. 197 | 198 | ## License 199 | 200 | MIT 201 | -------------------------------------------------------------------------------- /node_modules/cids/dist/index.min.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * The buffer module from node.js, for the browser. 3 | * 4 | * @author Feross Aboukhadijeh 5 | * @license MIT 6 | */ 7 | -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/bass-addons.css: -------------------------------------------------------------------------------- 1 | .input { 2 | font-family: inherit; 3 | display: block; 4 | width: 100%; 5 | height: 2rem; 6 | padding: .5rem; 7 | margin-bottom: 1rem; 8 | border: 1px solid #ccc; 9 | font-size: .875rem; 10 | border-radius: 3px; 11 | box-sizing: border-box; 12 | } 13 | -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/EOT/SourceCodePro-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/EOT/SourceCodePro-Bold.eot -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/EOT/SourceCodePro-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/EOT/SourceCodePro-Regular.eot -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | 5 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/OTF/SourceCodePro-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/OTF/SourceCodePro-Bold.otf -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/OTF/SourceCodePro-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/OTF/SourceCodePro-Regular.otf -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Uniswap/convert-cidv0-cidv1/c53a468c3602a85dd979c02ec4ddd9102849395e/node_modules/cids/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/fonts/source-code-pro.css: -------------------------------------------------------------------------------- 1 | @font-face{ 2 | font-family: 'Source Code Pro'; 3 | font-weight: 400; 4 | font-style: normal; 5 | font-stretch: normal; 6 | src: url('EOT/SourceCodePro-Regular.eot') format('embedded-opentype'), 7 | url('WOFF2/TTF/SourceCodePro-Regular.ttf.woff2') format('woff2'), 8 | url('WOFF/OTF/SourceCodePro-Regular.otf.woff') format('woff'), 9 | url('OTF/SourceCodePro-Regular.otf') format('opentype'), 10 | url('TTF/SourceCodePro-Regular.ttf') format('truetype'); 11 | } 12 | 13 | @font-face{ 14 | font-family: 'Source Code Pro'; 15 | font-weight: 700; 16 | font-style: normal; 17 | font-stretch: normal; 18 | src: url('EOT/SourceCodePro-Bold.eot') format('embedded-opentype'), 19 | url('WOFF2/TTF/SourceCodePro-Bold.ttf.woff2') format('woff2'), 20 | url('WOFF/OTF/SourceCodePro-Bold.otf.woff') format('woff'), 21 | url('OTF/SourceCodePro-Bold.otf') format('opentype'), 22 | url('TTF/SourceCodePro-Bold.ttf') format('truetype'); 23 | } 24 | -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | color: #333; 12 | background: #f8f8f8; 13 | -webkit-text-size-adjust: none; 14 | } 15 | 16 | .hljs-comment, 17 | .diff .hljs-header, 18 | .hljs-javadoc { 19 | color: #998; 20 | font-style: italic; 21 | } 22 | 23 | .hljs-keyword, 24 | .css .rule .hljs-keyword, 25 | .hljs-winutils, 26 | .nginx .hljs-title, 27 | .hljs-subst, 28 | .hljs-request, 29 | .hljs-status { 30 | color: #1184CE; 31 | } 32 | 33 | .hljs-number, 34 | .hljs-hexcolor, 35 | .ruby .hljs-constant { 36 | color: #ed225d; 37 | } 38 | 39 | .hljs-string, 40 | .hljs-tag .hljs-value, 41 | .hljs-phpdoc, 42 | .hljs-dartdoc, 43 | .tex .hljs-formula { 44 | color: #ed225d; 45 | } 46 | 47 | .hljs-title, 48 | .hljs-id, 49 | .scss .hljs-preprocessor { 50 | color: #900; 51 | font-weight: bold; 52 | } 53 | 54 | .hljs-list .hljs-keyword, 55 | .hljs-subst { 56 | font-weight: normal; 57 | } 58 | 59 | .hljs-class .hljs-title, 60 | .hljs-type, 61 | .vhdl .hljs-literal, 62 | .tex .hljs-command { 63 | color: #458; 64 | font-weight: bold; 65 | } 66 | 67 | .hljs-tag, 68 | .hljs-tag .hljs-title, 69 | .hljs-rules .hljs-property, 70 | .django .hljs-tag .hljs-keyword { 71 | color: #000080; 72 | font-weight: normal; 73 | } 74 | 75 | .hljs-attribute, 76 | .hljs-variable, 77 | .lisp .hljs-body { 78 | color: #008080; 79 | } 80 | 81 | .hljs-regexp { 82 | color: #009926; 83 | } 84 | 85 | .hljs-symbol, 86 | .ruby .hljs-symbol .hljs-string, 87 | .lisp .hljs-keyword, 88 | .clojure .hljs-keyword, 89 | .scheme .hljs-keyword, 90 | .tex .hljs-special, 91 | .hljs-prompt { 92 | color: #990073; 93 | } 94 | 95 | .hljs-built_in { 96 | color: #0086b3; 97 | } 98 | 99 | .hljs-preprocessor, 100 | .hljs-pragma, 101 | .hljs-pi, 102 | .hljs-doctype, 103 | .hljs-shebang, 104 | .hljs-cdata { 105 | color: #999; 106 | font-weight: bold; 107 | } 108 | 109 | .hljs-deletion { 110 | background: #fdd; 111 | } 112 | 113 | .hljs-addition { 114 | background: #dfd; 115 | } 116 | 117 | .diff .hljs-change { 118 | background: #0086b3; 119 | } 120 | 121 | .hljs-chunk { 122 | color: #aaa; 123 | } 124 | -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/site.js: -------------------------------------------------------------------------------- 1 | /* global anchors */ 2 | 3 | // add anchor links to headers 4 | anchors.options.placement = 'left'; 5 | anchors.add('h3'); 6 | 7 | // Filter UI 8 | var tocElements = document.getElementById('toc').getElementsByTagName('li'); 9 | 10 | document.getElementById('filter-input').addEventListener('keyup', function(e) { 11 | var i, element, children; 12 | 13 | // enter key 14 | if (e.keyCode === 13) { 15 | // go to the first displayed item in the toc 16 | for (i = 0; i < tocElements.length; i++) { 17 | element = tocElements[i]; 18 | if (!element.classList.contains('display-none')) { 19 | location.replace(element.firstChild.href); 20 | return e.preventDefault(); 21 | } 22 | } 23 | } 24 | 25 | var match = function() { 26 | return true; 27 | }; 28 | 29 | var value = this.value.toLowerCase(); 30 | 31 | if (!value.match(/^\s*$/)) { 32 | match = function(element) { 33 | var html = element.firstChild.innerHTML; 34 | return html && html.toLowerCase().indexOf(value) !== -1; 35 | }; 36 | } 37 | 38 | for (i = 0; i < tocElements.length; i++) { 39 | element = tocElements[i]; 40 | children = Array.from(element.getElementsByTagName('li')); 41 | if (match(element) || children.some(match)) { 42 | element.classList.remove('display-none'); 43 | } else { 44 | element.classList.add('display-none'); 45 | } 46 | } 47 | }); 48 | 49 | var items = document.getElementsByClassName('toggle-sibling'); 50 | for (var j = 0; j < items.length; j++) { 51 | items[j].addEventListener('click', toggleSibling); 52 | } 53 | 54 | function toggleSibling() { 55 | var stepSibling = this.parentNode.getElementsByClassName('toggle-target')[0]; 56 | var icon = this.getElementsByClassName('icon')[0]; 57 | var klass = 'display-none'; 58 | if (stepSibling.classList.contains(klass)) { 59 | stepSibling.classList.remove(klass); 60 | icon.innerHTML = '▾'; 61 | } else { 62 | stepSibling.classList.add(klass); 63 | icon.innerHTML = '▸'; 64 | } 65 | } 66 | 67 | function showHashTarget(targetId) { 68 | if (targetId) { 69 | var hashTarget = document.getElementById(targetId); 70 | // new target is hidden 71 | if ( 72 | hashTarget && 73 | hashTarget.offsetHeight === 0 && 74 | hashTarget.parentNode.parentNode.classList.contains('display-none') 75 | ) { 76 | hashTarget.parentNode.parentNode.classList.remove('display-none'); 77 | } 78 | } 79 | } 80 | 81 | function scrollIntoView(targetId) { 82 | // Only scroll to element if we don't have a stored scroll position. 83 | if (targetId && !history.state) { 84 | var hashTarget = document.getElementById(targetId); 85 | if (hashTarget) { 86 | hashTarget.scrollIntoView(); 87 | } 88 | } 89 | } 90 | 91 | function gotoCurrentTarget() { 92 | showHashTarget(location.hash.substring(1)); 93 | scrollIntoView(location.hash.substring(1)); 94 | } 95 | 96 | window.addEventListener('hashchange', gotoCurrentTarget); 97 | gotoCurrentTarget(); 98 | 99 | var toclinks = document.getElementsByClassName('pre-open'); 100 | for (var k = 0; k < toclinks.length; k++) { 101 | toclinks[k].addEventListener('mousedown', preOpen, false); 102 | } 103 | 104 | function preOpen() { 105 | showHashTarget(this.hash.substring(1)); 106 | } 107 | 108 | var split_left = document.querySelector('#split-left'); 109 | var split_right = document.querySelector('#split-right'); 110 | var split_parent = split_left.parentNode; 111 | var cw_with_sb = split_left.clientWidth; 112 | split_left.style.overflow = 'hidden'; 113 | var cw_without_sb = split_left.clientWidth; 114 | split_left.style.overflow = ''; 115 | 116 | Split(['#split-left', '#split-right'], { 117 | elementStyle: function(dimension, size, gutterSize) { 118 | return { 119 | 'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)' 120 | }; 121 | }, 122 | gutterStyle: function(dimension, gutterSize) { 123 | return { 124 | 'flex-basis': gutterSize + 'px' 125 | }; 126 | }, 127 | gutterSize: 20, 128 | sizes: [33, 67] 129 | }); 130 | 131 | // Chrome doesn't remember scroll position properly so do it ourselves. 132 | // Also works on Firefox and Edge. 133 | 134 | function updateState() { 135 | history.replaceState( 136 | { 137 | left_top: split_left.scrollTop, 138 | right_top: split_right.scrollTop 139 | }, 140 | document.title 141 | ); 142 | } 143 | 144 | function loadState(ev) { 145 | if (ev) { 146 | // Edge doesn't replace change history.state on popstate. 147 | history.replaceState(ev.state, document.title); 148 | } 149 | if (history.state) { 150 | split_left.scrollTop = history.state.left_top; 151 | split_right.scrollTop = history.state.right_top; 152 | } 153 | } 154 | 155 | window.addEventListener('load', function() { 156 | // Restore after Firefox scrolls to hash. 157 | setTimeout(function() { 158 | loadState(); 159 | // Update with initial scroll position. 160 | updateState(); 161 | // Update scroll positions only after we've loaded because Firefox 162 | // emits an initial scroll event with 0. 163 | split_left.addEventListener('scroll', updateState); 164 | split_right.addEventListener('scroll', updateState); 165 | }, 1); 166 | }); 167 | 168 | window.addEventListener('popstate', loadState); 169 | -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/split.css: -------------------------------------------------------------------------------- 1 | .gutter { 2 | background-color: #f5f5f5; 3 | background-repeat: no-repeat; 4 | background-position: 50%; 5 | } 6 | 7 | .gutter.gutter-vertical { 8 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII='); 9 | cursor: ns-resize; 10 | } 11 | 12 | .gutter.gutter-horizontal { 13 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg=='); 14 | cursor: ew-resize; 15 | } 16 | -------------------------------------------------------------------------------- /node_modules/cids/docs/assets/style.css: -------------------------------------------------------------------------------- 1 | .documentation { 2 | font-family: Helvetica, sans-serif; 3 | color: #666; 4 | line-height: 1.5; 5 | background: #f5f5f5; 6 | } 7 | 8 | .black { 9 | color: #666; 10 | } 11 | 12 | .bg-white { 13 | background-color: #fff; 14 | } 15 | 16 | h4 { 17 | margin: 20px 0 10px 0; 18 | } 19 | 20 | .documentation h3 { 21 | color: #000; 22 | } 23 | 24 | .border-bottom { 25 | border-color: #ddd; 26 | } 27 | 28 | a { 29 | color: #1184ce; 30 | text-decoration: none; 31 | } 32 | 33 | .documentation a[href]:hover { 34 | text-decoration: underline; 35 | } 36 | 37 | a:hover { 38 | cursor: pointer; 39 | } 40 | 41 | .py1-ul li { 42 | padding: 5px 0; 43 | } 44 | 45 | .max-height-100 { 46 | max-height: 100%; 47 | } 48 | 49 | .height-viewport-100 { 50 | height: 100vh; 51 | } 52 | 53 | section:target h3 { 54 | font-weight: 700; 55 | } 56 | 57 | .documentation td, 58 | .documentation th { 59 | padding: 0.25rem 0.25rem; 60 | } 61 | 62 | h1:hover .anchorjs-link, 63 | h2:hover .anchorjs-link, 64 | h3:hover .anchorjs-link, 65 | h4:hover .anchorjs-link { 66 | opacity: 1; 67 | } 68 | 69 | .fix-3 { 70 | width: 25%; 71 | max-width: 244px; 72 | } 73 | 74 | .fix-3 { 75 | width: 25%; 76 | max-width: 244px; 77 | } 78 | 79 | @media (min-width: 52em) { 80 | .fix-margin-3 { 81 | margin-left: 25%; 82 | } 83 | } 84 | 85 | .pre, 86 | pre, 87 | code, 88 | .code { 89 | font-family: Source Code Pro, Menlo, Consolas, Liberation Mono, monospace; 90 | font-size: 14px; 91 | } 92 | 93 | .fill-light { 94 | background: #f9f9f9; 95 | } 96 | 97 | .width2 { 98 | width: 1rem; 99 | } 100 | 101 | .input { 102 | font-family: inherit; 103 | display: block; 104 | width: 100%; 105 | height: 2rem; 106 | padding: 0.5rem; 107 | margin-bottom: 1rem; 108 | border: 1px solid #ccc; 109 | font-size: 0.875rem; 110 | border-radius: 3px; 111 | box-sizing: border-box; 112 | } 113 | 114 | table { 115 | border-collapse: collapse; 116 | } 117 | 118 | .prose table th, 119 | .prose table td { 120 | text-align: left; 121 | padding: 8px; 122 | border: 1px solid #ddd; 123 | } 124 | 125 | .prose table th:nth-child(1) { 126 | border-right: none; 127 | } 128 | .prose table th:nth-child(2) { 129 | border-left: none; 130 | } 131 | 132 | .prose table { 133 | border: 1px solid #ddd; 134 | } 135 | 136 | .prose-big { 137 | font-size: 18px; 138 | line-height: 30px; 139 | } 140 | 141 | .quiet { 142 | opacity: 0.7; 143 | } 144 | 145 | .minishadow { 146 | box-shadow: 2px 2px 10px #f3f3f3; 147 | } 148 | -------------------------------------------------------------------------------- /node_modules/cids/examples/cidv0-to-cidv1.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const CID = require('../src') 4 | const multihashStr = 'QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB' 5 | 6 | const cidv0 = new CID(multihashStr) 7 | 8 | console.log(cidv0.toBaseEncodedString()) 9 | 10 | const cidv1 = cidv0.toV1() 11 | 12 | console.log(cidv1.toBaseEncodedString()) 13 | -------------------------------------------------------------------------------- /node_modules/cids/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cids", 3 | "version": "0.8.1", 4 | "description": "CID Implementation in JavaScript", 5 | "leadMaintainer": "Volker Mische ", 6 | "main": "src/index.js", 7 | "types": "src/index.d.ts", 8 | "scripts": { 9 | "lint": "aegir lint", 10 | "test": "aegir test", 11 | "test:node": "aegir test --target node", 12 | "test:browser": "aegir test --target browser", 13 | "build": "aegir build", 14 | "release": "aegir release --docs", 15 | "release-minor": "aegir release --type minor --docs", 16 | "release-major": "aegir release --type major --docs", 17 | "coverage": "aegir coverage", 18 | "docs": "aegir docs" 19 | }, 20 | "pre-push": [ 21 | "lint", 22 | "test" 23 | ], 24 | "repository": { 25 | "type": "git", 26 | "url": "git://github.com/multiformats/js-cid.git" 27 | }, 28 | "keywords": [ 29 | "multihash", 30 | "cid", 31 | "ipld" 32 | ], 33 | "license": "MIT", 34 | "bugs": { 35 | "url": "https://github.com/multiformats/js-cid/issues" 36 | }, 37 | "dependencies": { 38 | "buffer": "^5.5.0", 39 | "class-is": "^1.1.0", 40 | "multibase": "~0.7.0", 41 | "multicodec": "^1.0.1", 42 | "multihashes": "~0.4.17" 43 | }, 44 | "devDependencies": { 45 | "aegir": "^21.4.4", 46 | "chai": "^4.2.0", 47 | "dirty-chai": "^2.0.1", 48 | "multihashing": "~0.3.3", 49 | "multihashing-async": "~0.8.1" 50 | }, 51 | "engines": { 52 | "node": ">=4.0.0", 53 | "npm": ">=3.0.0" 54 | }, 55 | "contributors": [ 56 | "David Dias ", 57 | "Volker Mische ", 58 | "Friedel Ziegelmayer ", 59 | "Alan Shaw ", 60 | "Mikeal Rogers ", 61 | "Carson Farmer ", 62 | "Enrico Marino ", 63 | "Oli Evans ", 64 | "Irakli Gozalishvili ", 65 | "Hugo Dias ", 66 | "Real Harry ", 67 | "bluelovers ", 68 | "Victor Bjelkholm ", 69 | "Henrique Dias ", 70 | "Marcin Rataj ", 71 | "Mitar ", 72 | "Richard Littauer ", 73 | "Rod Vagg " 74 | ] 75 | } 76 | -------------------------------------------------------------------------------- /node_modules/cids/src/cid-util.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const mh = require('multihashes') 4 | const { Buffer } = require('buffer') 5 | var CIDUtil = { 6 | /** 7 | * Test if the given input is a valid CID object. 8 | * Returns an error message if it is not. 9 | * Returns undefined if it is a valid CID. 10 | * 11 | * @param {any} other 12 | * @returns {string} 13 | */ 14 | checkCIDComponents: function (other) { 15 | if (other == null) { 16 | return 'null values are not valid CIDs' 17 | } 18 | 19 | if (!(other.version === 0 || other.version === 1)) { 20 | return 'Invalid version, must be a number equal to 1 or 0' 21 | } 22 | 23 | if (typeof other.codec !== 'string') { 24 | return 'codec must be string' 25 | } 26 | 27 | if (other.version === 0) { 28 | if (other.codec !== 'dag-pb') { 29 | return "codec must be 'dag-pb' for CIDv0" 30 | } 31 | if (other.multibaseName !== 'base58btc') { 32 | return "multibaseName must be 'base58btc' for CIDv0" 33 | } 34 | } 35 | 36 | if (!Buffer.isBuffer(other.multihash)) { 37 | return 'multihash must be a Buffer' 38 | } 39 | 40 | try { 41 | mh.validate(other.multihash) 42 | } catch (err) { 43 | let errorMsg = err.message 44 | if (!errorMsg) { // Just in case mh.validate() throws an error with empty error message 45 | errorMsg = 'Multihash validation failed' 46 | } 47 | return errorMsg 48 | } 49 | } 50 | } 51 | 52 | module.exports = CIDUtil 53 | -------------------------------------------------------------------------------- /node_modules/cids/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Class representing a CID `` 3 | * , as defined in [ipld/cid](https://github.com/multiformats/cid). 4 | */ 5 | declare class CID { 6 | /** 7 | * Create a new CID. 8 | * 9 | * The algorithm for argument input is roughly: 10 | * ``` 11 | * if (cid) 12 | * -> create a copy 13 | * else if (str) 14 | * if (1st char is on multibase table) -> CID String 15 | * else -> bs58 encoded multihash 16 | * else if (Buffer) 17 | * if (1st byte is 0 or 1) -> CID 18 | * else -> multihash 19 | * else if (Number) 20 | * -> construct CID by parts 21 | * ``` 22 | * 23 | * @example 24 | * new CID(, , , ) 25 | * new CID() 26 | * new CID() 27 | * new CID() 28 | * new CID() 29 | * new CID() 30 | */ 31 | constructor( 32 | version: 0 | 1, 33 | codec: string, 34 | multhash: Buffer, 35 | multibaseName?: string 36 | ); 37 | constructor(cid: CID); 38 | constructor(str: string); 39 | constructor(buf: Buffer); 40 | 41 | /** 42 | * The version of the CID. 43 | */ 44 | version: number; 45 | 46 | /** 47 | * The codec of the CID. 48 | */ 49 | codec: string; 50 | 51 | /** 52 | * The multihash of the CID. 53 | */ 54 | multihash: Buffer; 55 | 56 | /** 57 | * Multibase name as string. 58 | */ 59 | multibaseName: string; 60 | 61 | /** 62 | * The CID as a `Buffer` 63 | */ 64 | readonly buffer: Buffer; 65 | 66 | /** 67 | * The prefix of the CID. 68 | */ 69 | readonly prefix: Buffer; 70 | 71 | /** 72 | * Convert to a CID of version `0`. 73 | */ 74 | toV0(): CID; 75 | 76 | /** 77 | * Convert to a CID of version `1`. 78 | */ 79 | toV1(): CID; 80 | 81 | /** 82 | * Encode the CID into a string. 83 | * 84 | * @param base Base encoding to use. 85 | */ 86 | toBaseEncodedString(base?: string): string; 87 | 88 | /** 89 | * Encode the CID into a string. 90 | */ 91 | toString(base?: string): string; 92 | 93 | /** 94 | * Serialize to a plain object. 95 | */ 96 | toJSON(): { codec: string; version: 0 | 1; hash: Buffer }; 97 | 98 | /** 99 | * Compare equality with another CID. 100 | * 101 | * @param other The other CID. 102 | */ 103 | equals(other: any): boolean; 104 | 105 | /** 106 | * Test if the given input is a valid CID object. 107 | * Throws if it is not. 108 | * 109 | * @param other The other CID. 110 | */ 111 | static validateCID(other: any): void; 112 | 113 | static isCID(mixed: any): mixed is CID; 114 | 115 | static codecs: Record; 116 | } 117 | 118 | export = CID 119 | -------------------------------------------------------------------------------- /node_modules/cids/src/index.js.flow: -------------------------------------------------------------------------------- 1 | // @flow strict 2 | 3 | export type Version = 0 | 1 4 | export type Codec = string 5 | export type Multihash = Buffer 6 | export type BaseEncodedString = string 7 | export type MultibaseName = string 8 | 9 | declare class CID { 10 | constructor(Version, Codec, Multihash, multibaseName?:MultibaseName): void; 11 | constructor(BaseEncodedString): void; 12 | constructor(Buffer): void; 13 | 14 | +codec: Codec; 15 | +multihash: Multihash; 16 | +buffer: Buffer; 17 | +prefix: Buffer; 18 | 19 | toV0(): CID; 20 | toV1(): CID; 21 | toBaseEncodedString(base?: string): BaseEncodedString; 22 | toString(): BaseEncodedString; 23 | toJSON(): { codec: Codec, version: Version, hash: Multihash }; 24 | 25 | equals(mixed): boolean; 26 | 27 | static codecs: { [string]: Codec }; 28 | static isCID(mixed): boolean; 29 | static validateCID(mixed): void; 30 | } 31 | 32 | export default CID 33 | export type { CID } 34 | -------------------------------------------------------------------------------- /node_modules/class-is/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [package.json] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /node_modules/class-is/.eslintignore: -------------------------------------------------------------------------------- 1 | coverage/ 2 | lib/ 3 | es/ 4 | -------------------------------------------------------------------------------- /node_modules/class-is/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": [ 4 | "eslint-config-moxy/es6", 5 | "eslint-config-moxy/addons/node", 6 | "eslint-config-moxy/addons/jest" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /node_modules/class-is/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "node" 4 | - "lts/*" 5 | # Report coverage 6 | after_success: 7 | - "npm i codecov" 8 | - "node_modules/.bin/codecov" 9 | -------------------------------------------------------------------------------- /node_modules/class-is/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | 6 | # [1.1.0](https://github.com/moxystudio/js-class-is/compare/v1.0.0...v1.1.0) (2018-04-04) 7 | 8 | 9 | ### Features 10 | 11 | * add `withoutNew` option ([e6b0c18](https://github.com/moxystudio/js-class-is/commit/e6b0c18)) 12 | 13 | 14 | 15 | 16 | # [1.0.0](https://github.com/moxystudio/js-class-is/compare/v0.5.1...v1.0.0) (2018-03-30) 17 | 18 | 19 | 20 | 21 | ## [0.5.1](https://github.com/moxystudio/js-class-is/compare/v0.5.0...v0.5.1) (2018-03-30) 22 | 23 | 24 | ### Bug Fixes 25 | 26 | * fix non-boolean being returned for null/undefined values ([e5abd55](https://github.com/moxystudio/js-class-is/commit/e5abd55)) 27 | 28 | 29 | 30 | 31 | # [0.5.0](https://github.com/moxystudio/js-class-is/compare/v0.4.0...v0.5.0) (2018-03-28) 32 | 33 | 34 | ### Features 35 | 36 | * add support to ES5 classes ([0beb84f](https://github.com/moxystudio/js-class-is/commit/0beb84f)) 37 | 38 | 39 | 40 | 41 | # [0.4.0](https://github.com/moxystudio/js-class-is/compare/v0.3.1...v0.4.0) (2018-03-27) 42 | 43 | 44 | ### Bug Fixes 45 | 46 | * remove npm build from prerelease ([56a4b73](https://github.com/moxystudio/js-class-is/commit/56a4b73)) 47 | 48 | 49 | ### Features 50 | 51 | * remove babel ([e384228](https://github.com/moxystudio/js-class-is/commit/e384228)) 52 | 53 | 54 | 55 | 56 | ## [0.3.1](https://github.com/moxystudio/js-class-is/compare/v0.3.0...v0.3.1) (2018-03-23) 57 | 58 | 59 | 60 | 61 | # [0.3.0](https://github.com/moxystudio/js-class-is/compare/v0.2.1...v0.3.0) (2018-03-23) 62 | 63 | 64 | ### Features 65 | 66 | * add support for symbol.toStringTag ([3b86374](https://github.com/moxystudio/js-class-is/commit/3b86374)) 67 | 68 | 69 | 70 | 71 | ## [0.2.1](https://github.com/moxystudio/js-class-is/compare/v0.2.0...v0.2.1) (2018-03-23) 72 | 73 | 74 | ### Bug Fixes 75 | 76 | * update readme examples ([dc4ef01](https://github.com/moxystudio/js-class-is/commit/dc4ef01)) 77 | 78 | 79 | 80 | 81 | # [0.2.0](https://github.com/moxystudio/js-class-is/compare/v0.1.1...v0.2.0) (2018-03-23) 82 | 83 | 84 | ### Features 85 | 86 | * add name and symbol params ([#1](https://github.com/moxystudio/js-class-is/issues/1)) ([07cfdc9](https://github.com/moxystudio/js-class-is/commit/07cfdc9)) 87 | 88 | 89 | 90 | 91 | ## [0.1.1](https://github.com/moxystudio/js-is-class-decorator/compare/v0.1.0...v0.1.1) (2018-03-22) 92 | 93 | 94 | ### Bug Fixes 95 | 96 | * missing semicolon in package.json ([1615c58](https://github.com/moxystudio/js-is-class-decorator/commit/1615c58)) 97 | 98 | 99 | 100 | 101 | # 0.1.0 (2018-03-22) 102 | 103 | 104 | ### Features 105 | 106 | * initial commit ([9b3d9b9](https://github.com/moxystudio/js-is-class-decorator/commit/9b3d9b9)) 107 | -------------------------------------------------------------------------------- /node_modules/class-is/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Diogo Silva 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/class-is/README.md: -------------------------------------------------------------------------------- 1 | # class-is 2 | 3 | [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] [![Greenkeeper badge][greenkeeper-image]][greenkeeper-url] 4 | 5 | [npm-url]:https://npmjs.org/package/class-is 6 | [downloads-image]:http://img.shields.io/npm/dm/class-is.svg 7 | [npm-image]:http://img.shields.io/npm/v/class-is.svg 8 | [travis-url]:https://travis-ci.org/moxystudio/js-class-is 9 | [travis-image]:http://img.shields.io/travis/moxystudio/js-class-is/master.svg 10 | [codecov-url]:https://codecov.io/gh/moxystudio/js-class-is 11 | [codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/js-class-is/master.svg 12 | [david-dm-url]:https://david-dm.org/moxystudio/js-class-is 13 | [david-dm-image]:https://img.shields.io/david/moxystudio/js-class-is.svg 14 | [david-dm-dev-url]:https://david-dm.org/moxystudio/js-class-is?type=dev 15 | [david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/js-class-is.svg 16 | [greenkeeper-image]:https://badges.greenkeeper.io/moxystudio/js-class-is.svg 17 | [greenkeeper-url]:https://greenkeeper.io/ 18 | 19 | Enhances a JavaScript class by adding an `is` property to compare types between realms. 20 | 21 | 22 | ## Motivation 23 | 24 | Checking if a value is an instance of a class in JavaScript is not an easy task. 25 | 26 | You can use `instanceof`, but that doesn't work between different realms or different versions. Comparing with `constructor.name` could be a solution but if you need to Uglify the module it doesn't work, as it creates different names for the same module. 27 | 28 | [Symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) to the rescue! 29 | 30 | 31 | ## Installation 32 | 33 | `$ npm install class-is` 34 | 35 | If you want to use this module in the browser you have to compile it yourself to your desired target. 36 | 37 | 38 | ## Usage 39 | 40 | ### ES6 classes: 41 | 42 | ```js 43 | // Package X 44 | const withIs = require('class-is'); 45 | 46 | class Person { 47 | constructor(name, city) { 48 | this.name = name; 49 | this.city = city; 50 | } 51 | } 52 | 53 | module.exports = withIs(Person, { 54 | className: 'Person', 55 | symbolName: '@org/package-x/Person', 56 | }); 57 | ``` 58 | 59 | ```js 60 | // Package Y 61 | const withIs = require('class-is'); 62 | 63 | class Animal { 64 | constructor(species) { 65 | this.species = species; 66 | } 67 | } 68 | 69 | module.exports = withIs(Animal, { 70 | className: 'Animal', 71 | symbolName: '@org/package-y/Animal', 72 | }); 73 | ``` 74 | 75 | ```js 76 | const Person = require('package-x'); 77 | const Animal = require('package-y'); 78 | 79 | const diogo = new Person('Diogo', 'Porto'); 80 | const wolf = new Animal('Gray Wolf'); 81 | 82 | console.log(Person.isPerson(diogo)); 83 | console.log(Person.isPerson(wolf)); 84 | ``` 85 | 86 | Running the example above will print: 87 | 88 | ``` 89 | true 90 | false 91 | ``` 92 | 93 | ### ES5 and below classes: 94 | 95 | In ES5 it's not unusual to see constructors like the one below, so you can call it without using the `new` keyword. 96 | 97 | ```js 98 | function Circle(radius) { 99 | if (!(this instanceof Circle)) { 100 | return new Circle(); 101 | } 102 | 103 | this.radius = radius; 104 | } 105 | ``` 106 | 107 | In such cases you can use the `withIs.proto` method: 108 | 109 | ```js 110 | const withIs = require('class-is'); 111 | 112 | const Circle = withIs.proto(function (radius) { 113 | if (!(this instanceof Circle)) { 114 | return new Circle(); 115 | } 116 | 117 | this.radius = radius; 118 | }, { 119 | className: 'Circle', 120 | symbolName: '@org/package/Circle', 121 | }); 122 | ``` 123 | 124 | ...or even better: 125 | 126 | ```js 127 | const withIs = require('class-is'); 128 | 129 | function Circle(radius) { 130 | this.radius = radius; 131 | } 132 | 133 | module.exports = withIs.proto(Circle, { 134 | className: 'Circle', 135 | symbolName: '@org/package/Circle', 136 | withoutNew: true, 137 | }); 138 | ``` 139 | 140 | 141 | ## API 142 | 143 | ### withIs(Class, { className, symbolName }) 144 | 145 | ###### class 146 | 147 | Type: `class` 148 | 149 | The class to be enhanced. 150 | 151 | ###### className 152 | 153 | Type: `String` 154 | 155 | The name of the class your passing. 156 | 157 | ###### symbolName 158 | 159 | Type: `String` 160 | 161 | Unique *id* for the class. This should be namespaced so different classes from different modules do not collide and give false positives. 162 | 163 | Example: `@organization/package/Class` 164 | 165 | ### withIs.proto(Class, { className, symbolName, withoutNew }) 166 | 167 | The `className` and `symbolName` parameters are the same as above. 168 | 169 | ###### withoutNew 170 | 171 | Type: `Boolean` 172 | Default: `false` 173 | 174 | Allow creating an instance without the `new` operator. 175 | 176 | 177 | ## Tests 178 | 179 | `$ npm test` 180 | `$ npm test -- --watch` during development 181 | 182 | 183 | ## License 184 | 185 | [MIT](http://www.opensource.org/licenses/mit-license.php) 186 | -------------------------------------------------------------------------------- /node_modules/class-is/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function withIs(Class, { className, symbolName }) { 4 | const symbol = Symbol.for(symbolName); 5 | 6 | const ClassIsWrapper = { 7 | // The code below assigns the class wrapper to an object to trick 8 | // JavaScript engines to show the name of the extended class when 9 | // logging an instances. 10 | // We are assigning an anonymous class (class wrapper) to the object 11 | // with key `className` to keep the correct name. 12 | // If this is not supported it falls back to logging `ClassIsWrapper`. 13 | [className]: class extends Class { 14 | constructor(...args) { 15 | super(...args); 16 | Object.defineProperty(this, symbol, { value: true }); 17 | } 18 | 19 | get [Symbol.toStringTag]() { 20 | return className; 21 | } 22 | }, 23 | }[className]; 24 | 25 | ClassIsWrapper[`is${className}`] = (obj) => !!(obj && obj[symbol]); 26 | 27 | return ClassIsWrapper; 28 | } 29 | 30 | function withIsProto(Class, { className, symbolName, withoutNew }) { 31 | const symbol = Symbol.for(symbolName); 32 | 33 | /* eslint-disable object-shorthand */ 34 | const ClassIsWrapper = { 35 | [className]: function (...args) { 36 | if (withoutNew && !(this instanceof ClassIsWrapper)) { 37 | return new ClassIsWrapper(...args); 38 | } 39 | 40 | const _this = Class.call(this, ...args) || this; 41 | 42 | if (_this && !_this[symbol]) { 43 | Object.defineProperty(_this, symbol, { value: true }); 44 | } 45 | 46 | return _this; 47 | }, 48 | }[className]; 49 | /* eslint-enable object-shorthand */ 50 | 51 | ClassIsWrapper.prototype = Object.create(Class.prototype); 52 | ClassIsWrapper.prototype.constructor = ClassIsWrapper; 53 | 54 | Object.defineProperty(ClassIsWrapper.prototype, Symbol.toStringTag, { 55 | get() { 56 | return className; 57 | }, 58 | }); 59 | 60 | ClassIsWrapper[`is${className}`] = (obj) => !!(obj && obj[symbol]); 61 | 62 | return ClassIsWrapper; 63 | } 64 | 65 | module.exports = withIs; 66 | module.exports.proto = withIsProto; 67 | -------------------------------------------------------------------------------- /node_modules/class-is/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "class-is", 3 | "version": "1.1.0", 4 | "description": "Enhances a JavaScript class by adding an is property to compare types between realms.", 5 | "keywords": [ 6 | "withis", 7 | "with-is", 8 | "isclass", 9 | "is-class", 10 | "symbols", 11 | "realms", 12 | "instanceof", 13 | "instance-of" 14 | ], 15 | "author": "Diogo Silva ", 16 | "homepage": "https://github.com/moxystudio/js-class-is", 17 | "repository": { 18 | "type": "git", 19 | "url": "git@github.com:moxystudio/js-class-is.git" 20 | }, 21 | "license": "MIT", 22 | "main": "index.js", 23 | "scripts": { 24 | "lint": "eslint .", 25 | "test": "jest --env node --coverage", 26 | "prerelease": "npm t && npm run lint", 27 | "release": "standard-version", 28 | "precommit": "lint-staged", 29 | "commitmsg": "commitlint -e $GIT_PARAMS" 30 | }, 31 | "standard-version": { 32 | "scripts": { 33 | "posttag": "git push --follow-tags origin master && npm publish" 34 | } 35 | }, 36 | "lint-staged": { 37 | "*.js": [ 38 | "eslint --fix", 39 | "git add" 40 | ] 41 | }, 42 | "commitlint": { 43 | "extends": [ 44 | "@commitlint/config-conventional" 45 | ] 46 | }, 47 | "devDependencies": { 48 | "@commitlint/cli": "^6.1.3", 49 | "@commitlint/config-conventional": "^6.1.3", 50 | "eslint": "^4.19.1", 51 | "eslint-config-moxy": "^5.2.1", 52 | "husky": "^0.14.3", 53 | "jest": "^22.4.3", 54 | "lint-staged": "^7.0.0", 55 | "standard-version": "^4.3.0" 56 | }, 57 | "dependencies": {} 58 | } 59 | -------------------------------------------------------------------------------- /node_modules/class-is/test/es5.test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { 4 | Animal, 5 | Plant, 6 | Mammal, 7 | Algae, 8 | 9 | ExplicitWithoutNew, 10 | ImplicitWithoutNew, 11 | ImplicitExplicitWithoutNew, 12 | } = require('./fixtures/es5'); 13 | 14 | it('should setup the prototype chain correctly', () => { 15 | const animal = new Animal('mammal'); 16 | const plant = new Plant('algae'); 17 | 18 | expect(Object.getPrototypeOf(animal)).toBe(Animal.prototype); 19 | expect(Object.getPrototypeOf(Object.getPrototypeOf(animal))).toBe(Animal.WrappedClass.prototype); 20 | expect(Object.getPrototypeOf(animal)).not.toBe(Plant.prototype); 21 | expect(Object.getPrototypeOf(plant)).toBe(Plant.prototype); 22 | expect(Object.getPrototypeOf(Object.getPrototypeOf(plant))).toBe(Plant.WrappedClass.prototype); 23 | expect(Object.getPrototypeOf(plant)).not.toBe(Animal.prototype); 24 | 25 | expect(animal instanceof Animal).toBe(true); 26 | expect(animal instanceof Animal.WrappedClass).toBe(true); 27 | expect(animal instanceof Plant).toBe(false); 28 | expect(plant instanceof Plant).toBe(true); 29 | expect(plant instanceof Plant.WrappedClass).toBe(true); 30 | expect(plant instanceof Animal).toBe(false); 31 | 32 | expect(animal.getType()).toBe('mammal'); 33 | expect(plant.getType()).toBe('algae'); 34 | }); 35 | 36 | it('should have a custom toStringTag', () => { 37 | expect(Object.prototype.toString.call(new Animal())).toBe('[object Animal]'); 38 | expect(Object.prototype.toString.call(new Plant())).toBe('[object Plant]'); 39 | }); 40 | 41 | describe('is method', () => { 42 | it('should add a working is static method', () => { 43 | const animal = new Animal('mammal'); 44 | const plant = new Plant('algae'); 45 | 46 | expect(Animal.isAnimal(animal)).toBe(true); 47 | expect(Animal.isAnimal(plant)).toBe(false); 48 | expect(Plant.isPlant(plant)).toBe(true); 49 | expect(Plant.isPlant(animal)).toBe(false); 50 | }); 51 | 52 | it('should not crash if `null` or `undefined` is passed to is', () => { 53 | expect(Animal.isAnimal(null)).toBe(false); 54 | expect(Animal.isAnimal(undefined)).toBe(false); 55 | }); 56 | 57 | it('should work correctly for deep inheritance scenarios', () => { 58 | const mammal = new Mammal(); 59 | const algae = new Algae(); 60 | 61 | expect(Mammal.isMammal(mammal)).toBe(true); 62 | expect(Animal.isAnimal(mammal)).toBe(true); 63 | expect(Mammal.isMammal(algae)).toBe(false); 64 | expect(Animal.isAnimal(algae)).toBe(false); 65 | 66 | expect(Algae.isAlgae(algae)).toBe(true); 67 | expect(Plant.isPlant(algae)).toBe(true); 68 | expect(Algae.isAlgae(mammal)).toBe(false); 69 | expect(Plant.isPlant(mammal)).toBe(false); 70 | }); 71 | }); 72 | 73 | describe('new operator', () => { 74 | it('should work on explicit without-new handling', () => { 75 | const instance = new ExplicitWithoutNew(); 76 | const instance2 = ExplicitWithoutNew(); // eslint-disable-line new-cap 77 | 78 | expect(Object.getPrototypeOf(instance)).toBe(ExplicitWithoutNew.prototype); 79 | expect(Object.getPrototypeOf(Object.getPrototypeOf(instance))).toBe(ExplicitWithoutNew.WrappedClass.prototype); 80 | expect(Object.getPrototypeOf(instance2)).toBe(ExplicitWithoutNew.prototype); 81 | expect(Object.getPrototypeOf(Object.getPrototypeOf(instance2))).toBe(ExplicitWithoutNew.WrappedClass.prototype); 82 | 83 | expect(instance instanceof ExplicitWithoutNew).toBe(true); 84 | expect(instance instanceof ExplicitWithoutNew.WrappedClass).toBe(true); 85 | expect(instance2 instanceof ExplicitWithoutNew).toBe(true); 86 | expect(instance2 instanceof ExplicitWithoutNew.WrappedClass).toBe(true); 87 | 88 | expect(instance.getLabel()).toBe('ExplicitWithoutNew'); 89 | expect(instance2.getLabel()).toBe('ExplicitWithoutNew'); 90 | }); 91 | 92 | it('should work on implicit without-new handling', () => { 93 | const instance = new ImplicitWithoutNew(); 94 | const instanceNoNew = ImplicitWithoutNew(); // eslint-disable-line new-cap 95 | 96 | expect(Object.getPrototypeOf(instance)).toBe(ImplicitWithoutNew.prototype); 97 | expect(Object.getPrototypeOf(Object.getPrototypeOf(instance))).toBe(ImplicitWithoutNew.WrappedClass.prototype); 98 | expect(Object.getPrototypeOf(instanceNoNew)).toBe(ImplicitWithoutNew.prototype); 99 | expect(Object.getPrototypeOf(Object.getPrototypeOf(instanceNoNew))).toBe(ImplicitWithoutNew.WrappedClass.prototype); 100 | 101 | expect(instance instanceof ImplicitWithoutNew).toBe(true); 102 | expect(instance instanceof ImplicitWithoutNew.WrappedClass).toBe(true); 103 | expect(instanceNoNew instanceof ImplicitWithoutNew).toBe(true); 104 | expect(instanceNoNew instanceof ImplicitWithoutNew.WrappedClass).toBe(true); 105 | 106 | expect(instance.getLabel()).toBe('ImplicitWithoutNew'); 107 | expect(instanceNoNew.getLabel()).toBe('ImplicitWithoutNew'); 108 | }); 109 | 110 | it('should work on explicit & implicit without-new handling', () => { 111 | const instance = new ImplicitExplicitWithoutNew(); 112 | const instanceNoNew = ImplicitExplicitWithoutNew(); // eslint-disable-line new-cap 113 | 114 | expect(Object.getPrototypeOf(instance)).toBe(ImplicitExplicitWithoutNew.prototype); 115 | expect(Object.getPrototypeOf(Object.getPrototypeOf(instance))).toBe(ImplicitExplicitWithoutNew.WrappedClass.prototype); 116 | expect(Object.getPrototypeOf(instanceNoNew)).toBe(ImplicitExplicitWithoutNew.prototype); 117 | expect(Object.getPrototypeOf(Object.getPrototypeOf(instanceNoNew))).toBe(ImplicitExplicitWithoutNew.WrappedClass.prototype); 118 | 119 | expect(instance instanceof ImplicitExplicitWithoutNew).toBe(true); 120 | expect(instance instanceof ImplicitExplicitWithoutNew.WrappedClass).toBe(true); 121 | expect(instanceNoNew instanceof ImplicitExplicitWithoutNew).toBe(true); 122 | expect(instanceNoNew instanceof ImplicitExplicitWithoutNew.WrappedClass).toBe(true); 123 | 124 | expect(instance.getLabel()).toBe('ImplicitExplicitWithoutNew'); 125 | expect(instanceNoNew.getLabel()).toBe('ImplicitExplicitWithoutNew'); 126 | }); 127 | }); 128 | -------------------------------------------------------------------------------- /node_modules/class-is/test/es6.test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { 4 | Animal, 5 | Plant, 6 | Mammal, 7 | Algae, 8 | } = require('./fixtures/es6'); 9 | 10 | it('should setup the prototype chain correctly', () => { 11 | const animal = new Animal('mammal'); 12 | const plant = new Plant('algae'); 13 | 14 | expect(Object.getPrototypeOf(animal)).toBe(Animal.prototype); 15 | expect(Object.getPrototypeOf(Object.getPrototypeOf(animal))).toBe(Animal.WrappedClass.prototype); 16 | expect(Object.getPrototypeOf(animal)).not.toBe(Plant.prototype); 17 | expect(Object.getPrototypeOf(plant)).toBe(Plant.prototype); 18 | expect(Object.getPrototypeOf(Object.getPrototypeOf(plant))).toBe(Plant.WrappedClass.prototype); 19 | expect(Object.getPrototypeOf(plant)).not.toBe(Animal.prototype); 20 | 21 | expect(animal instanceof Animal).toBe(true); 22 | expect(animal instanceof Animal.WrappedClass).toBe(true); 23 | expect(animal instanceof Plant).toBe(false); 24 | expect(plant instanceof Plant).toBe(true); 25 | expect(plant instanceof Plant.WrappedClass).toBe(true); 26 | expect(plant instanceof Animal).toBe(false); 27 | 28 | expect(animal.getType()).toBe('mammal'); 29 | expect(plant.getType()).toBe('algae'); 30 | }); 31 | 32 | it('should have a custom toStringTag', () => { 33 | expect(Object.prototype.toString.call(new Animal())).toBe('[object Animal]'); 34 | expect(Object.prototype.toString.call(new Plant())).toBe('[object Plant]'); 35 | }); 36 | 37 | describe('is method', () => { 38 | it('should add a working is static method', () => { 39 | const animal = new Animal('mammal'); 40 | const plant = new Plant('algae'); 41 | 42 | expect(Animal.isAnimal(animal)).toBe(true); 43 | expect(Animal.isAnimal(plant)).toBe(false); 44 | expect(Plant.isPlant(plant)).toBe(true); 45 | expect(Plant.isPlant(animal)).toBe(false); 46 | }); 47 | 48 | it('should not crash if `null` or `undefined` is passed to is', () => { 49 | expect(Animal.isAnimal(null)).toBe(false); 50 | expect(Animal.isAnimal(undefined)).toBe(false); 51 | }); 52 | 53 | it('should work correctly for deep inheritance scenarios', () => { 54 | const mammal = new Mammal(); 55 | const algae = new Algae(); 56 | 57 | expect(Mammal.isMammal(mammal)).toBe(true); 58 | expect(Animal.isAnimal(mammal)).toBe(true); 59 | expect(Mammal.isMammal(algae)).toBe(false); 60 | expect(Animal.isAnimal(algae)).toBe(false); 61 | 62 | expect(Algae.isAlgae(algae)).toBe(true); 63 | expect(Plant.isPlant(algae)).toBe(true); 64 | expect(Algae.isAlgae(mammal)).toBe(false); 65 | expect(Plant.isPlant(mammal)).toBe(false); 66 | }); 67 | }); 68 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/Algae.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | const Plant = require('./Plant'); 5 | 6 | function Algae() { 7 | Plant.call(this, 'algae'); 8 | } 9 | 10 | Algae.prototype = Object.create(Plant.prototype); 11 | Algae.prototype.constructor = Algae; 12 | 13 | module.exports = withIs.proto(Algae, { 14 | className: 'Algae', 15 | symbolName: '@org/package/Algae', 16 | }); 17 | module.exports.WrappedClass = Algae; 18 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/Animal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | 5 | function Animal(type) { 6 | this.type = type; 7 | } 8 | 9 | Animal.prototype.getType = function () { 10 | return this.type; 11 | }; 12 | 13 | module.exports = withIs.proto(Animal, { 14 | className: 'Animal', 15 | symbolName: '@org/package/Animal', 16 | }); 17 | module.exports.WrappedClass = Animal; 18 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/ExplicitWithoutNew.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | 5 | function ExplicitWithoutNew_() { 6 | if (!(this instanceof ExplicitWithoutNew)) { 7 | return new ExplicitWithoutNew(); 8 | } 9 | 10 | this.label = 'ExplicitWithoutNew'; 11 | } 12 | 13 | ExplicitWithoutNew_.prototype.getLabel = function () { 14 | return this.label; 15 | }; 16 | 17 | const ExplicitWithoutNew = withIs.proto(ExplicitWithoutNew_, { 18 | className: 'ExplicitWithoutNew', 19 | symbolName: '@org/package/ExplicitWithoutNew', 20 | }); 21 | 22 | module.exports = ExplicitWithoutNew; 23 | module.exports.WrappedClass = ExplicitWithoutNew_; 24 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/ImplicitExplicitWithoutNew.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | 5 | function ImplicitExplicitWithoutNew_() { 6 | /* istanbul ignore if */ 7 | if (!(this instanceof ImplicitExplicitWithoutNew)) { 8 | return new ImplicitExplicitWithoutNew(); 9 | } 10 | 11 | this.label = 'ImplicitExplicitWithoutNew'; 12 | } 13 | 14 | ImplicitExplicitWithoutNew_.prototype.getLabel = function () { 15 | return this.label; 16 | }; 17 | 18 | const ImplicitExplicitWithoutNew = withIs.proto(ImplicitExplicitWithoutNew_, { 19 | className: 'ImplicitExplicitWithoutNew', 20 | symbolName: '@org/package/ImplicitExplicitWithoutNew', 21 | withoutNew: true, 22 | }); 23 | 24 | module.exports = ImplicitExplicitWithoutNew; 25 | module.exports.WrappedClass = ImplicitExplicitWithoutNew_; 26 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/ImplicitWithoutNew.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | 5 | function ImplicitWithoutNew() { 6 | this.label = 'ImplicitWithoutNew'; 7 | } 8 | 9 | ImplicitWithoutNew.prototype.getLabel = function () { 10 | return this.label; 11 | }; 12 | 13 | module.exports = withIs.proto(ImplicitWithoutNew, { 14 | className: 'ImplicitWithoutNew', 15 | symbolName: '@org/package/ImplicitWithoutNew', 16 | withoutNew: true, 17 | }); 18 | module.exports.WrappedClass = ImplicitWithoutNew; 19 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/Mammal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | const Animal = require('./Animal'); 5 | 6 | function Mammal() { 7 | Animal.call(this, 'mammal'); 8 | } 9 | 10 | Mammal.prototype = Object.create(Animal.prototype); 11 | Mammal.prototype.constructor = Mammal; 12 | 13 | module.exports = withIs.proto(Mammal, { 14 | className: 'Mammal', 15 | symbolName: '@org/package/Mammal', 16 | }); 17 | module.exports.WrappedClass = Mammal; 18 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/Plant.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | 5 | function Plant(type) { 6 | this.type = type; 7 | } 8 | 9 | Plant.prototype.getType = function () { 10 | return this.type; 11 | }; 12 | 13 | module.exports = withIs.proto(Plant, { 14 | className: 'Plant', 15 | symbolName: '@org/package/Plant', 16 | }); 17 | module.exports.WrappedClass = Plant; 18 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es5/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | Animal: require('./Animal'), 5 | Plant: require('./Plant'), 6 | Mammal: require('./Mammal'), 7 | Algae: require('./Algae'), 8 | 9 | ExplicitWithoutNew: require('./ExplicitWithoutNew'), 10 | ImplicitWithoutNew: require('./ImplicitWithoutNew'), 11 | ImplicitExplicitWithoutNew: require('./ImplicitExplicitWithoutNew'), 12 | }; 13 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es6/Algae.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | const Plant = require('./Plant'); 5 | 6 | class Algae extends Plant { 7 | constructor() { 8 | super('algae'); 9 | } 10 | } 11 | 12 | module.exports = withIs(Algae, { 13 | className: 'Algae', 14 | symbolName: '@org/package/Algae', 15 | }); 16 | module.exports.WrappedClass = Algae; 17 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es6/Animal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | 5 | class Animal { 6 | constructor(type) { 7 | this.type = type; 8 | } 9 | 10 | getType() { 11 | return this.type; 12 | } 13 | } 14 | 15 | module.exports = withIs(Animal, { 16 | className: 'Animal', 17 | symbolName: '@org/package/Animal', 18 | }); 19 | module.exports.WrappedClass = Animal; 20 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es6/Mammal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | const Animal = require('./Animal'); 5 | 6 | class Mammal extends Animal { 7 | constructor() { 8 | super('mammal'); 9 | } 10 | } 11 | 12 | module.exports = withIs(Mammal, { 13 | className: 'Mammal', 14 | symbolName: '@org/package/Mammal', 15 | }); 16 | module.exports.WrappedClass = Mammal; 17 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es6/Plant.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const withIs = require('../../..'); 4 | 5 | class Plant { 6 | constructor(type) { 7 | this.type = type; 8 | } 9 | 10 | getType() { 11 | return this.type; 12 | } 13 | } 14 | 15 | module.exports = withIs(Plant, { 16 | className: 'Plant', 17 | symbolName: '@org/package/Plant', 18 | }); 19 | module.exports.WrappedClass = Plant; 20 | -------------------------------------------------------------------------------- /node_modules/class-is/test/fixtures/es6/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | Animal: require('./Animal'), 5 | Plant: require('./Plant'), 6 | Mammal: require('./Mammal'), 7 | Algae: require('./Algae'), 8 | }; 9 | -------------------------------------------------------------------------------- /node_modules/ieee754/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008 Fair Oaks Labs, Inc. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /node_modules/ieee754/README.md: -------------------------------------------------------------------------------- 1 | # ieee754 [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] 2 | 3 | [travis-image]: https://img.shields.io/travis/feross/ieee754/master.svg 4 | [travis-url]: https://travis-ci.org/feross/ieee754 5 | [npm-image]: https://img.shields.io/npm/v/ieee754.svg 6 | [npm-url]: https://npmjs.org/package/ieee754 7 | [downloads-image]: https://img.shields.io/npm/dm/ieee754.svg 8 | [downloads-url]: https://npmjs.org/package/ieee754 9 | [standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg 10 | [standard-url]: https://standardjs.com 11 | 12 | [![saucelabs][saucelabs-image]][saucelabs-url] 13 | 14 | [saucelabs-image]: https://saucelabs.com/browser-matrix/ieee754.svg 15 | [saucelabs-url]: https://saucelabs.com/u/ieee754 16 | 17 | ### Read/write IEEE754 floating point numbers from/to a Buffer or array-like object. 18 | 19 | ## install 20 | 21 | ``` 22 | npm install ieee754 23 | ``` 24 | 25 | [Get supported ieee754 with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-ieee754?utm_source=npm-ieee754&utm_medium=referral&utm_campaign=readme) 26 | 27 | ## methods 28 | 29 | `var ieee754 = require('ieee754')` 30 | 31 | The `ieee754` object has the following functions: 32 | 33 | ``` 34 | ieee754.read = function (buffer, offset, isLE, mLen, nBytes) 35 | ieee754.write = function (buffer, value, offset, isLE, mLen, nBytes) 36 | ``` 37 | 38 | The arguments mean the following: 39 | 40 | - buffer = the buffer 41 | - offset = offset into the buffer 42 | - value = value to set (only for `write`) 43 | - isLe = is little endian? 44 | - mLen = mantissa length 45 | - nBytes = number of bytes 46 | 47 | ## what is ieee754? 48 | 49 | The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation. [Read more](http://en.wikipedia.org/wiki/IEEE_floating_point). 50 | 51 | ## license 52 | 53 | BSD 3 Clause. Copyright (c) 2008, Fair Oaks Labs, Inc. 54 | -------------------------------------------------------------------------------- /node_modules/ieee754/index.js: -------------------------------------------------------------------------------- 1 | exports.read = function (buffer, offset, isLE, mLen, nBytes) { 2 | var e, m 3 | var eLen = (nBytes * 8) - mLen - 1 4 | var eMax = (1 << eLen) - 1 5 | var eBias = eMax >> 1 6 | var nBits = -7 7 | var i = isLE ? (nBytes - 1) : 0 8 | var d = isLE ? -1 : 1 9 | var s = buffer[offset + i] 10 | 11 | i += d 12 | 13 | e = s & ((1 << (-nBits)) - 1) 14 | s >>= (-nBits) 15 | nBits += eLen 16 | for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} 17 | 18 | m = e & ((1 << (-nBits)) - 1) 19 | e >>= (-nBits) 20 | nBits += mLen 21 | for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} 22 | 23 | if (e === 0) { 24 | e = 1 - eBias 25 | } else if (e === eMax) { 26 | return m ? NaN : ((s ? -1 : 1) * Infinity) 27 | } else { 28 | m = m + Math.pow(2, mLen) 29 | e = e - eBias 30 | } 31 | return (s ? -1 : 1) * m * Math.pow(2, e - mLen) 32 | } 33 | 34 | exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { 35 | var e, m, c 36 | var eLen = (nBytes * 8) - mLen - 1 37 | var eMax = (1 << eLen) - 1 38 | var eBias = eMax >> 1 39 | var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) 40 | var i = isLE ? 0 : (nBytes - 1) 41 | var d = isLE ? 1 : -1 42 | var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 43 | 44 | value = Math.abs(value) 45 | 46 | if (isNaN(value) || value === Infinity) { 47 | m = isNaN(value) ? 1 : 0 48 | e = eMax 49 | } else { 50 | e = Math.floor(Math.log(value) / Math.LN2) 51 | if (value * (c = Math.pow(2, -e)) < 1) { 52 | e-- 53 | c *= 2 54 | } 55 | if (e + eBias >= 1) { 56 | value += rt / c 57 | } else { 58 | value += rt * Math.pow(2, 1 - eBias) 59 | } 60 | if (value * c >= 2) { 61 | e++ 62 | c /= 2 63 | } 64 | 65 | if (e + eBias >= eMax) { 66 | m = 0 67 | e = eMax 68 | } else if (e + eBias >= 1) { 69 | m = ((value * c) - 1) * Math.pow(2, mLen) 70 | e = e + eBias 71 | } else { 72 | m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) 73 | e = 0 74 | } 75 | } 76 | 77 | for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} 78 | 79 | e = (e << mLen) | m 80 | eLen += mLen 81 | for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} 82 | 83 | buffer[offset + i - d] |= s * 128 84 | } 85 | -------------------------------------------------------------------------------- /node_modules/ieee754/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ieee754", 3 | "description": "Read/write IEEE754 floating point numbers from/to a Buffer or array-like object", 4 | "version": "1.1.13", 5 | "author": { 6 | "name": "Feross Aboukhadijeh", 7 | "email": "feross@feross.org", 8 | "url": "http://feross.org" 9 | }, 10 | "contributors": [ 11 | "Romain Beauxis " 12 | ], 13 | "devDependencies": { 14 | "airtap": "0.1.0", 15 | "standard": "*", 16 | "tape": "^4.0.0" 17 | }, 18 | "keywords": [ 19 | "IEEE 754", 20 | "buffer", 21 | "convert", 22 | "floating point", 23 | "ieee754" 24 | ], 25 | "license": "BSD-3-Clause", 26 | "main": "index.js", 27 | "repository": { 28 | "type": "git", 29 | "url": "git://github.com/feross/ieee754.git" 30 | }, 31 | "scripts": { 32 | "test": "standard && npm run test-node && npm run test-browser", 33 | "test-browser": "airtap -- test/*.js", 34 | "test-browser-local": "airtap --local -- test/*.js", 35 | "test-node": "tape test/*.js" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /node_modules/multibase/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | # [0.7.0](https://github.com/multiformats/js-multibase/compare/v0.6.1...v0.7.0) (2020-03-16) 3 | 4 | 5 | ### Bug Fixes 6 | 7 | * throw new error object so stack traces are valid ([db415c9](https://github.com/multiformats/js-multibase/commit/db415c9)) 8 | 9 | 10 | ### Features 11 | 12 | * remove base1 and readme tweaks ([05cd102](https://github.com/multiformats/js-multibase/commit/05cd102)), closes [#48](https://github.com/multiformats/js-multibase/issues/48) [#44](https://github.com/multiformats/js-multibase/issues/44) 13 | 14 | 15 | 16 | 17 | ## [0.6.1](https://github.com/multiformats/js-multibase/compare/v0.6.0...v0.6.1) (2020-03-16) 18 | 19 | 20 | ### Bug Fixes 21 | 22 | * fix base32pad, cleanup ([bd02451](https://github.com/multiformats/js-multibase/commit/bd02451)) 23 | 24 | 25 | 26 | 27 | # [0.6.0](https://github.com/multiformats/js-multibase/compare/v0.5.0...v0.6.0) (2018-11-22) 28 | 29 | 30 | ### Bug Fixes 31 | 32 | * base64url encodes multiple occurances of + and / ([#39](https://github.com/multiformats/js-multibase/issues/39)) ([84f79ba](https://github.com/multiformats/js-multibase/commit/84f79ba)), closes [#35](https://github.com/multiformats/js-multibase/issues/35) 33 | * decode example typo ([4d0fc17](https://github.com/multiformats/js-multibase/commit/4d0fc17)) 34 | * do not throw when non buffer/string passed to isEncoded ([1ae01a0](https://github.com/multiformats/js-multibase/commit/1ae01a0)) 35 | 36 | 37 | 38 | 39 | # [0.5.0](https://github.com/multiformats/js-multibase/compare/v0.4.0...v0.5.0) (2018-08-30) 40 | 41 | 42 | ### Features 43 | 44 | * export list of multibase names and codes ([#31](https://github.com/multiformats/js-multibase/issues/31)) ([c9e221c](https://github.com/multiformats/js-multibase/commit/c9e221c)) 45 | 46 | 47 | 48 | 49 | # [0.4.0](https://github.com/multiformats/js-multibase/compare/v0.3.4...v0.4.0) (2018-01-01) 50 | 51 | 52 | ### Bug Fixes 53 | 54 | * base32 and base64 ([#23](https://github.com/multiformats/js-multibase/issues/23)) ([a9b5150](https://github.com/multiformats/js-multibase/commit/a9b5150)) 55 | 56 | 57 | 58 | 59 | ## [0.3.4](https://github.com/multiformats/js-multibase/compare/v0.3.3...v0.3.4) (2017-03-16) 60 | 61 | 62 | 63 | 64 | ## [0.3.3](https://github.com/multiformats/js-multibase/compare/v0.3.2...v0.3.3) (2017-03-15) 65 | 66 | 67 | ### Bug Fixes 68 | 69 | * **base16:** hex strings are always of even length ([#16](https://github.com/multiformats/js-multibase/issues/16)) ([b02e0d3](https://github.com/multiformats/js-multibase/commit/b02e0d3)) 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /node_modules/multibase/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Protocol Labs Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/multibase/README.md: -------------------------------------------------------------------------------- 1 | js-multibase 2 | ============ 3 | 4 | [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) 5 | [![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) 6 | [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) 7 | [![Dependency Status](https://david-dm.org/multiformats/js-multibase.svg?style=flat-square)](https://david-dm.org/multiformats/js-multibase) 8 | [![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multibase.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multibase) 9 | [![Travis CI](https://flat.badgen.net/travis/multiformats/js-multibase)](https://travis-ci.com/multiformats/js-multibase) 10 | 11 | > JavaScript implementation of the [multibase](https://github.com/multiformats/multibase) specification 12 | 13 | ## Lead Maintainer 14 | 15 | [Oli Evans](https://github.com/olizilla) 16 | 17 | ## Table of Contents 18 | 19 | - [Install](#install) 20 | - [In Node.js through npm](#in-nodejs-through-npm) 21 | - [Browser: Browserify, Webpack, other bundlers](#browser-browserify-webpack-other-bundlers) 22 | - [In the Browser through ` 61 | 62 | 63 | ``` 64 | 65 | ## Usage 66 | 67 | ### Example 68 | 69 | ```JavaScript 70 | const { Buffer } = require('buffer') 71 | const multibase = require('multibase') 72 | 73 | const encodedBuf = multibase.encode('base58btc', new Buffer('hey, how is it going')) 74 | 75 | const decodedBuf = multibase.decode(encodedBuf) 76 | console.log(decodedBuf.toString()) 77 | // hey, how is it going 78 | ``` 79 | 80 | ## API 81 | https://multiformats.github.io/js-multibase/ 82 | 83 | ### `multibase` - Prefixes an encoded buffer with its multibase code 84 | 85 | ``` 86 | const multibased = multibase(, encodedBuf) 87 | ``` 88 | 89 | ### `multibase.encode` - Encodes a buffer into one of the supported encodings, prefixing it with the multibase code 90 | 91 | ```JavaScript 92 | const encodedBuf = multibase.encode(, ) 93 | ``` 94 | 95 | ### `multibase.decode` - Decodes a buffer or string 96 | 97 | ```JavaScript 98 | const decodedBuf = multibase.decode(bufOrString) 99 | ``` 100 | 101 | ### `multibase.isEncoded` - Checks if buffer or string is encoded 102 | 103 | ```JavaScript 104 | const value = multibase.isEncoded(bufOrString) 105 | // value is the name of the encoding if it is encoded, false otherwise 106 | ``` 107 | 108 | ### `multibase.names` 109 | 110 | A frozen `Array` of supported base encoding names. 111 | 112 | ### `multibase.codes` 113 | 114 | A frozen `Array` of supported base encoding codes. 115 | 116 | ### Supported Encodings, see [`src/constants.js`](/src/constants.js) 117 | 118 | ## Architecture and Encoding/Decoding 119 | 120 | Multibase package defines all the supported bases and the location of their implementation in the constants.js file. A base is a class with a name, a code, an implementation and an alphabet. 121 | ```js 122 | class Base { 123 | constructor (name, code, implementation, alphabet) { 124 | //... 125 | } 126 | // ... 127 | } 128 | ``` 129 | The ```implementation``` is an object where the encoding/decoding functions are implemented. It must take one argument, (the alphabet) following the [base-x module](https://github.com/cryptocoinjs/base-x) architecture. 130 | 131 | The ```alphabet``` is the **ordered** set of defined symbols for a given base. 132 | 133 | The idea behind this is that several bases may have implementations from different locations/modules so it's useful to have an object (and a summary) of all of them in one location (hence the constants.js). 134 | 135 | All the supported bases are currently using the npm [base-x](https://github.com/cryptocoinjs/base-x) module as their implementation. It is using bitwise maipulation to go from one base to another, so this module does not support padding at the moment. 136 | 137 | ## Adding additional bases 138 | 139 | If the base you are looking for is not supported yet in js-multibase and you know a good encoding/decoding algorithm, you can add support for this base easily by editing the constants.js file 140 | (**you'll need to create an issue about that beforehand since a code and a canonical name have to be defined**): 141 | 142 | ```js 143 | const baseX = require('base-x') 144 | //const newPackage = require('your-package-name') 145 | 146 | const constants = [ 147 | ['base2', '0', baseX, '01'], 148 | ['base8', '7', baseX, '01234567'], 149 | // ... [ 'your-base-name', 'code-to-be-defined', newPackage, 'alphabet'] 150 | ] 151 | ``` 152 | The required package defines the implementation of the encoding/decoding process. **It must comply by these rules** : 153 | - `encode` and `decode` functions with to-be-encoded buffer as the only expected argument 154 | - the require call use the `alphabet` given as an argument for the encoding/decoding process 155 | 156 | *If no package is specified , it means the base is not implemented yet* 157 | 158 | Adding a new base requires the tests to be updated. Test files to be updated are : 159 | - constants.spec.js 160 | ```js 161 | describe('constants', () => { 162 | it('constants indexed by name', () => { 163 | const names = constants.names 164 | expect(Object.keys(names).length).to.equal(constants-count) // currently 12 165 | }) 166 | 167 | it('constants indexed by code', () => { 168 | const codes = constants.codes 169 | expect(Object.keys(codes).length).to.equal(constants-count) 170 | }) 171 | }) 172 | ``` 173 | 174 | - multibase.spec.js 175 | - if the base is implemented 176 | ```js 177 | const supportedBases = [ 178 | ['base2', 'yes mani !', '01111001011001010111001100100000011011010110000101101110011010010010000000100001'], 179 | ['base8', 'yes mani !', '7171312714403326055632220041'], 180 | ['base10', 'yes mani !', '9573277761329450583662625'], 181 | // ... ['your-base-name', 'what you want', 'expected output'] 182 | ``` 183 | - if the base is not implemented yet 184 | ```js 185 | const supportedBases = [ 186 | // ... ['your-base-name'] 187 | ``` 188 | 189 | ## Contribute 190 | 191 | Contributions welcome. Please check out [the issues](https://github.com/multiformats/js-multibase/issues). 192 | 193 | Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). 194 | 195 | Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. 196 | 197 | ## License 198 | 199 | [MIT](LICENSE) © Protocol Labs Inc. 200 | -------------------------------------------------------------------------------- /node_modules/multibase/dist/index.min.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * The buffer module from node.js, for the browser. 3 | * 4 | * @author Feross Aboukhadijeh 5 | * @license MIT 6 | */ 7 | -------------------------------------------------------------------------------- /node_modules/multibase/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multibase", 3 | "version": "0.7.0", 4 | "description": "JavaScript implementation of the multibase specification", 5 | "leadMaintainer": "Oli Evans ", 6 | "main": "src/index.js", 7 | "scripts": { 8 | "lint": "aegir lint", 9 | "test": "aegir test", 10 | "test:node": "aegir test -t node", 11 | "test:browser": "aegir test -t browser", 12 | "build": "aegir build", 13 | "docs": "aegir docs", 14 | "release": "aegir release --docs", 15 | "release-minor": "aegir release --type minor --docs", 16 | "release-major": "aegir release --type major --docs", 17 | "coverage": "aegir coverage", 18 | "coverage-publish": "aegir coverage publish" 19 | }, 20 | "files": [ 21 | "src", 22 | "dist" 23 | ], 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/multiformats/js-multibase.git" 27 | }, 28 | "keywords": [ 29 | "IPFS", 30 | "multiformats", 31 | "multibase", 32 | "encode", 33 | "decode", 34 | "formats" 35 | ], 36 | "devDependencies": { 37 | "aegir": "^21.3.0", 38 | "chai": "^4.1.2", 39 | "dirty-chai": "^2.0.1", 40 | "pre-commit": "^1.2.2" 41 | }, 42 | "dependencies": { 43 | "base-x": "^3.0.8", 44 | "buffer": "^5.5.0" 45 | }, 46 | "license": "MIT", 47 | "bugs": { 48 | "url": "https://github.com/multiformats/js-multibase/issues" 49 | }, 50 | "homepage": "https://github.com/multiformats/js-multibase#readme", 51 | "contributors": [ 52 | "David Dias ", 53 | "Oli Evans ", 54 | "Hugo Dias ", 55 | "Friedel Ziegelmayer ", 56 | "Alan Shaw ", 57 | "victorbjelkholm ", 58 | "achingbrain ", 59 | "theobat ", 60 | "Bora M. Alper ", 61 | "Henrique Dias ", 62 | "Richard Littauer " 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /node_modules/multibase/src/base.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | class Base { 4 | constructor (name, code, implementation, alphabet) { 5 | this.name = name 6 | this.code = code 7 | this.alphabet = alphabet 8 | if (implementation && alphabet) { 9 | this.engine = implementation(alphabet) 10 | } 11 | } 12 | 13 | encode (stringOrBuffer) { 14 | return this.engine.encode(stringOrBuffer) 15 | } 16 | 17 | decode (stringOrBuffer) { 18 | return this.engine.decode(stringOrBuffer) 19 | } 20 | 21 | isImplemented () { 22 | return this.engine 23 | } 24 | } 25 | 26 | module.exports = Base 27 | -------------------------------------------------------------------------------- /node_modules/multibase/src/base16.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const { Buffer } = require('buffer') 3 | 4 | module.exports = function base16 (alphabet) { 5 | return { 6 | encode (input) { 7 | if (typeof input === 'string') { 8 | return Buffer.from(input).toString('hex') 9 | } 10 | return input.toString('hex') 11 | }, 12 | decode (input) { 13 | for (const char of input) { 14 | if (alphabet.indexOf(char) < 0) { 15 | throw new Error('invalid base16 character') 16 | } 17 | } 18 | return Buffer.from(input, 'hex') 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /node_modules/multibase/src/base32.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | function decode (input, alphabet) { 4 | input = input.replace(new RegExp('=', 'g'), '') 5 | const length = input.length 6 | 7 | let bits = 0 8 | let value = 0 9 | 10 | let index = 0 11 | const output = new Uint8Array((length * 5 / 8) | 0) 12 | 13 | for (let i = 0; i < length; i++) { 14 | value = (value << 5) | alphabet.indexOf(input[i]) 15 | bits += 5 16 | 17 | if (bits >= 8) { 18 | output[index++] = (value >>> (bits - 8)) & 255 19 | bits -= 8 20 | } 21 | } 22 | 23 | return output.buffer 24 | } 25 | 26 | function encode (buffer, alphabet) { 27 | const length = buffer.byteLength 28 | const view = new Uint8Array(buffer) 29 | const padding = alphabet.indexOf('=') === alphabet.length - 1 30 | 31 | if (padding) { 32 | alphabet = alphabet.substring(0, alphabet.length - 1) 33 | } 34 | 35 | let bits = 0 36 | let value = 0 37 | let output = '' 38 | 39 | for (let i = 0; i < length; i++) { 40 | value = (value << 8) | view[i] 41 | bits += 8 42 | 43 | while (bits >= 5) { 44 | output += alphabet[(value >>> (bits - 5)) & 31] 45 | bits -= 5 46 | } 47 | } 48 | 49 | if (bits > 0) { 50 | output += alphabet[(value << (5 - bits)) & 31] 51 | } 52 | 53 | if (padding) { 54 | while ((output.length % 8) !== 0) { 55 | output += '=' 56 | } 57 | } 58 | 59 | return output 60 | } 61 | 62 | module.exports = function base32 (alphabet) { 63 | return { 64 | encode (input) { 65 | if (typeof input === 'string') { 66 | return encode(Uint8Array.from(input), alphabet) 67 | } 68 | 69 | return encode(input, alphabet) 70 | }, 71 | decode (input) { 72 | for (const char of input) { 73 | if (alphabet.indexOf(char) < 0) { 74 | throw new Error('invalid base32 character') 75 | } 76 | } 77 | 78 | return decode(input, alphabet) 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /node_modules/multibase/src/base64.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const { Buffer } = require('buffer') 3 | 4 | module.exports = function base64 (alphabet) { 5 | // The alphabet is only used to know: 6 | // 1. If padding is enabled (must contain '=') 7 | // 2. If the output must be url-safe (must contain '-' and '_') 8 | // 3. If the input of the output function is valid 9 | // The alphabets from RFC 4648 are always used. 10 | const padding = alphabet.indexOf('=') > -1 11 | const url = alphabet.indexOf('-') > -1 && alphabet.indexOf('_') > -1 12 | 13 | return { 14 | encode (input) { 15 | let output = '' 16 | 17 | if (typeof input === 'string') { 18 | output = Buffer.from(input).toString('base64') 19 | } else { 20 | output = input.toString('base64') 21 | } 22 | 23 | if (url) { 24 | output = output.replace(/\+/g, '-').replace(/\//g, '_') 25 | } 26 | 27 | const pad = output.indexOf('=') 28 | if (pad > 0 && !padding) { 29 | output = output.substring(0, pad) 30 | } 31 | 32 | return output 33 | }, 34 | decode (input) { 35 | for (const char of input) { 36 | if (alphabet.indexOf(char) < 0) { 37 | throw new Error('invalid base64 character') 38 | } 39 | } 40 | 41 | return Buffer.from(input, 'base64') 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /node_modules/multibase/src/constants.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const Base = require('./base.js') 4 | const baseX = require('base-x') 5 | const base16 = require('./base16') 6 | const base32 = require('./base32') 7 | const base64 = require('./base64') 8 | 9 | // name, code, implementation, alphabet 10 | const constants = [ 11 | ['base1', '1', '', '1'], 12 | ['base2', '0', baseX, '01'], 13 | ['base8', '7', baseX, '01234567'], 14 | ['base10', '9', baseX, '0123456789'], 15 | ['base16', 'f', base16, '0123456789abcdef'], 16 | ['base32', 'b', base32, 'abcdefghijklmnopqrstuvwxyz234567'], 17 | ['base32pad', 'c', base32, 'abcdefghijklmnopqrstuvwxyz234567='], 18 | ['base32hex', 'v', base32, '0123456789abcdefghijklmnopqrstuv'], 19 | ['base32hexpad', 't', base32, '0123456789abcdefghijklmnopqrstuv='], 20 | ['base32z', 'h', base32, 'ybndrfg8ejkmcpqxot1uwisza345h769'], 21 | ['base58flickr', 'Z', baseX, '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'], 22 | ['base58btc', 'z', baseX, '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'], 23 | ['base64', 'm', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'], 24 | ['base64pad', 'M', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='], 25 | ['base64url', 'u', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'], 26 | ['base64urlpad', 'U', base64, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='] 27 | ] 28 | 29 | const names = constants.reduce((prev, tupple) => { 30 | prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3]) 31 | return prev 32 | }, {}) 33 | 34 | const codes = constants.reduce((prev, tupple) => { 35 | prev[tupple[1]] = names[tupple[0]] 36 | return prev 37 | }, {}) 38 | 39 | module.exports = { 40 | names: names, 41 | codes: codes 42 | } 43 | -------------------------------------------------------------------------------- /node_modules/multibase/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implementation of the [multibase](https://github.com/multiformats/multibase) specification. 3 | * @module Multibase 4 | */ 5 | 'use strict' 6 | 7 | const { Buffer } = require('buffer') 8 | const constants = require('./constants') 9 | 10 | exports = module.exports = multibase 11 | exports.encode = encode 12 | exports.decode = decode 13 | exports.isEncoded = isEncoded 14 | exports.names = Object.freeze(Object.keys(constants.names)) 15 | exports.codes = Object.freeze(Object.keys(constants.codes)) 16 | 17 | /** 18 | * Create a new buffer with the multibase varint+code. 19 | * 20 | * @param {string|number} nameOrCode - The multibase name or code number. 21 | * @param {Buffer} buf - The data to be prefixed with multibase. 22 | * @memberof Multibase 23 | * @returns {Buffer} 24 | */ 25 | function multibase (nameOrCode, buf) { 26 | if (!buf) { 27 | throw new Error('requires an encoded buffer') 28 | } 29 | const base = getBase(nameOrCode) 30 | const codeBuf = Buffer.from(base.code) 31 | 32 | const name = base.name 33 | validEncode(name, buf) 34 | return Buffer.concat([codeBuf, buf]) 35 | } 36 | 37 | /** 38 | * Encode data with the specified base and add the multibase prefix. 39 | * 40 | * @param {string|number} nameOrCode - The multibase name or code number. 41 | * @param {Buffer} buf - The data to be encoded. 42 | * @returns {Buffer} 43 | * @memberof Multibase 44 | */ 45 | function encode (nameOrCode, buf) { 46 | const base = getBase(nameOrCode) 47 | const name = base.name 48 | 49 | return multibase(name, Buffer.from(base.encode(buf))) 50 | } 51 | 52 | /** 53 | * Takes a buffer or string encoded with multibase header, decodes it and 54 | * returns the decoded buffer 55 | * 56 | * @param {Buffer|string} bufOrString 57 | * @returns {Buffer} 58 | * @memberof Multibase 59 | * 60 | */ 61 | function decode (bufOrString) { 62 | if (Buffer.isBuffer(bufOrString)) { 63 | bufOrString = bufOrString.toString() 64 | } 65 | 66 | const code = bufOrString.substring(0, 1) 67 | bufOrString = bufOrString.substring(1, bufOrString.length) 68 | 69 | if (typeof bufOrString === 'string') { 70 | bufOrString = Buffer.from(bufOrString) 71 | } 72 | 73 | const base = getBase(code) 74 | return Buffer.from(base.decode(bufOrString.toString())) 75 | } 76 | 77 | /** 78 | * Is the given data multibase encoded? 79 | * 80 | * @param {Buffer|string} bufOrString 81 | * @returns {boolean} 82 | * @memberof Multibase 83 | */ 84 | function isEncoded (bufOrString) { 85 | if (Buffer.isBuffer(bufOrString)) { 86 | bufOrString = bufOrString.toString() 87 | } 88 | 89 | // Ensure bufOrString is a string 90 | if (Object.prototype.toString.call(bufOrString) !== '[object String]') { 91 | return false 92 | } 93 | 94 | const code = bufOrString.substring(0, 1) 95 | try { 96 | const base = getBase(code) 97 | return base.name 98 | } catch (err) { 99 | return false 100 | } 101 | } 102 | 103 | /** 104 | * @param {string} name 105 | * @param {Buffer} buf 106 | * @private 107 | * @returns {undefined} 108 | */ 109 | function validEncode (name, buf) { 110 | const base = getBase(name) 111 | base.decode(buf.toString()) 112 | } 113 | 114 | function getBase (nameOrCode) { 115 | let base 116 | 117 | if (constants.names[nameOrCode]) { 118 | base = constants.names[nameOrCode] 119 | } else if (constants.codes[nameOrCode]) { 120 | base = constants.codes[nameOrCode] 121 | } else { 122 | throw new Error('Unsupported encoding') 123 | } 124 | 125 | if (!base.isImplemented()) { 126 | throw new Error('Base ' + nameOrCode + ' is not implemented yet') 127 | } 128 | 129 | return base 130 | } 131 | -------------------------------------------------------------------------------- /node_modules/multicodec/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: npm 3 | stages: 4 | - check 5 | - test 6 | - cov 7 | 8 | node_js: 9 | - '10' 10 | 11 | os: 12 | - linux 13 | - osx 14 | - windows 15 | 16 | script: npx nyc -s npm run test:node -- --bail 17 | after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov 18 | 19 | jobs: 20 | include: 21 | - stage: check 22 | script: 23 | - npx aegir commitlint --travis 24 | - npx aegir dep-check 25 | - npm run lint 26 | 27 | - stage: test 28 | name: chrome 29 | addons: 30 | chrome: stable 31 | script: npx aegir test -t browser -t webworker 32 | 33 | - stage: test 34 | name: firefox 35 | addons: 36 | firefox: latest 37 | script: npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless 38 | 39 | notifications: 40 | email: false 41 | -------------------------------------------------------------------------------- /node_modules/multicodec/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright © 2016 Multiformats 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/multicodec/README.md: -------------------------------------------------------------------------------- 1 | # js-multicodec 2 | 3 | [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) 4 | [![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) 5 | [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) 6 | [![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) 7 | [![Travis CI](https://flat.badgen.net/travis/multiformats/js-multicodec)](https://travis-ci.com/multiformats/js-multicodec) 8 | [![Coverage Status](https://coveralls.io/repos/github/multiformats/js-multicodec/badge.svg?branch=master)](https://coveralls.io/github/multiformats/js-multiformats?branch=master) 9 | 10 | > JavaScript implementation of the multicodec specification 11 | 12 | ## Lead Maintainer 13 | 14 | [Henrique Dias](http://github.com/hacdias) 15 | 16 | ## Table of Contents 17 | 18 | - [Install](#install) 19 | - [Usage](#usage) 20 | - [Updating the lookup table](#updating-the-lookup-table) 21 | - [Contribute](#contribute) 22 | - [License](#license) 23 | 24 | ## Install 25 | 26 | ```sh 27 | > npm install multicodec 28 | ``` 29 | 30 | The type definitions for this package are available on http://definitelytyped.org/. To install just use: 31 | 32 | ```sh 33 | $ npm install -D @types/multicodec 34 | ``` 35 | 36 | ## Usage 37 | 38 | ### Example 39 | 40 | ```JavaScript 41 | 42 | const multicodec = require('multicodec') 43 | 44 | const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer) 45 | // prefixedProtobuf 0x50... 46 | 47 | // The multicodec codec values can be accessed directly: 48 | console.log(multicodec.DAG_CBOR) 49 | // 113 50 | 51 | // To get the string representation of a codec, e.g. for error messages: 52 | console.log(multicodec.print[113]) 53 | // dag-cbor 54 | ``` 55 | 56 | ### API 57 | 58 | https://multiformats.github.io/js-multicodec/ 59 | 60 | [multicodec default table](https://github.com/multiformats/multicodec/blob/master/table.csv) 61 | 62 | ## Updating the lookup table 63 | 64 | Updating the lookup table is done with a script. The source of truth is the 65 | [multicodec default table](https://github.com/multiformats/multicodec/blob/master/table.csv). 66 | Update the table with running: 67 | 68 | node ./tools/update-table.js 69 | 70 | ## Contribute 71 | 72 | Contributions welcome. Please check out [the issues](https://github.com/multiformats/js-multicodec/issues). 73 | 74 | Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). 75 | 76 | Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. 77 | 78 | ## License 79 | 80 | [MIT](LICENSE) © 2016 Protocol Labs Inc. 81 | -------------------------------------------------------------------------------- /node_modules/multicodec/dist/index.min.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * The buffer module from node.js, for the browser. 3 | * 4 | * @author Feross Aboukhadijeh 5 | * @license MIT 6 | */ 7 | -------------------------------------------------------------------------------- /node_modules/multicodec/example.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const multicodec = require('multicodec') 4 | 5 | const prefixedProtobuf = multicodec.addPrefix('protobuf', Buffer.from('some protobuf code')) 6 | 7 | // eslint-disable-next-line no-console 8 | console.log(prefixedProtobuf) 9 | // => prefixedProtobuf 0x50... 10 | -------------------------------------------------------------------------------- /node_modules/multicodec/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multicodec", 3 | "version": "1.0.1", 4 | "description": "JavaScript implementation of the multicodec specification", 5 | "leadMaintainer": "Henrique Dias ", 6 | "main": "src/index.js", 7 | "scripts": { 8 | "lint": "aegir lint", 9 | "test": "aegir test", 10 | "test:node": "aegir test --target node", 11 | "test:browser": "aegir test --target browser", 12 | "build": "aegir build", 13 | "docs": "aegir docs", 14 | "release": "aegir release", 15 | "release-minor": "aegir release --type minor", 16 | "release-major": "aegir release --type major", 17 | "coverage": "aegir coverage", 18 | "coverage-publish": "aegir coverage --provider coveralls" 19 | }, 20 | "pre-push": [ 21 | "lint", 22 | "test" 23 | ], 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/multiformats/js-multicodec.git" 27 | }, 28 | "keywords": [ 29 | "IPFS", 30 | "multiformats", 31 | "multicodec", 32 | "binary", 33 | "packed", 34 | "the", 35 | "data!" 36 | ], 37 | "license": "MIT", 38 | "bugs": { 39 | "url": "https://github.com/multiformats/js-multicodec/issues" 40 | }, 41 | "homepage": "https://github.com/multiformats/js-multicodec#readme", 42 | "dependencies": { 43 | "buffer": "^5.5.0", 44 | "varint": "^5.0.0" 45 | }, 46 | "devDependencies": { 47 | "aegir": "^21.3.0", 48 | "bent": "^7.0.4", 49 | "chai": "^4.2.0", 50 | "dirty-chai": "^2.0.1", 51 | "pre-push": "~0.1.1" 52 | }, 53 | "contributors": [ 54 | "David Dias ", 55 | "Henrique Dias ", 56 | "Volker Mische ", 57 | "Mikeal Rogers ", 58 | "Richard Littauer ", 59 | "wanderer ", 60 | "Friedel Ziegelmayer ", 61 | "ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ ", 62 | "Filip Š ", 63 | "Hugo Dias ", 64 | "Marcin Rataj ", 65 | "achingbrain ", 66 | "Carson Farmer " 67 | ] 68 | } 69 | -------------------------------------------------------------------------------- /node_modules/multicodec/src/constants.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const table = require('./base-table.json') 4 | 5 | // map for codecConstant -> code 6 | const constants = {} 7 | 8 | for (const [name, code] of Object.entries(table)) { 9 | constants[name.toUpperCase().replace(/-/g, '_')] = code 10 | } 11 | 12 | module.exports = Object.freeze(constants) 13 | -------------------------------------------------------------------------------- /node_modules/multicodec/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Implementation of the multicodec specification. 3 | * 4 | * @module multicodec 5 | * @example 6 | * const multicodec = require('multicodec') 7 | * 8 | * const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer) 9 | * // prefixedProtobuf 0x50... 10 | * 11 | */ 12 | 'use strict' 13 | 14 | const { Buffer } = require('buffer') 15 | const varint = require('varint') 16 | const intTable = require('./int-table') 17 | const codecNameToCodeVarint = require('./varint-table') 18 | const util = require('./util') 19 | 20 | exports = module.exports 21 | 22 | /** 23 | * Prefix a buffer with a multicodec-packed. 24 | * 25 | * @param {string|number} multicodecStrOrCode 26 | * @param {Buffer} data 27 | * @returns {Buffer} 28 | */ 29 | exports.addPrefix = (multicodecStrOrCode, data) => { 30 | let prefix 31 | 32 | if (Buffer.isBuffer(multicodecStrOrCode)) { 33 | prefix = util.varintBufferEncode(multicodecStrOrCode) 34 | } else { 35 | if (codecNameToCodeVarint[multicodecStrOrCode]) { 36 | prefix = codecNameToCodeVarint[multicodecStrOrCode] 37 | } else { 38 | throw new Error('multicodec not recognized') 39 | } 40 | } 41 | return Buffer.concat([prefix, data]) 42 | } 43 | 44 | /** 45 | * Decapsulate the multicodec-packed prefix from the data. 46 | * 47 | * @param {Buffer} data 48 | * @returns {Buffer} 49 | */ 50 | exports.rmPrefix = (data) => { 51 | varint.decode(data) 52 | return data.slice(varint.decode.bytes) 53 | } 54 | 55 | /** 56 | * Get the codec of the prefixed data. 57 | * @param {Buffer} prefixedData 58 | * @returns {string} 59 | */ 60 | exports.getCodec = (prefixedData) => { 61 | const code = varint.decode(prefixedData) 62 | const codecName = intTable.get(code) 63 | if (codecName === undefined) { 64 | throw new Error(`Code ${code} not found`) 65 | } 66 | return codecName 67 | } 68 | 69 | /** 70 | * Get the name of the codec. 71 | * @param {number} codec 72 | * @returns {string} 73 | */ 74 | exports.getName = (codec) => { 75 | return intTable.get(codec) 76 | } 77 | 78 | /** 79 | * Get the code of the codec 80 | * @param {string} name 81 | * @returns {number} 82 | */ 83 | exports.getNumber = (name) => { 84 | const code = codecNameToCodeVarint[name] 85 | if (code === undefined) { 86 | throw new Error('Codec `' + name + '` not found') 87 | } 88 | return util.varintBufferDecode(code)[0] 89 | } 90 | 91 | /** 92 | * Get the code of the prefixed data. 93 | * @param {Buffer} prefixedData 94 | * @returns {number} 95 | */ 96 | exports.getCode = (prefixedData) => { 97 | return varint.decode(prefixedData) 98 | } 99 | 100 | /** 101 | * Get the code as varint of a codec name. 102 | * @param {string} codecName 103 | * @returns {Buffer} 104 | */ 105 | exports.getCodeVarint = (codecName) => { 106 | const code = codecNameToCodeVarint[codecName] 107 | if (code === undefined) { 108 | throw new Error('Codec `' + codecName + '` not found') 109 | } 110 | return code 111 | } 112 | 113 | /** 114 | * Get the varint of a code. 115 | * @param {Number} code 116 | * @returns {Array.} 117 | */ 118 | exports.getVarint = (code) => { 119 | return varint.encode(code) 120 | } 121 | 122 | // Make the constants top-level constants 123 | const constants = require('./constants') 124 | Object.assign(exports, constants) 125 | 126 | // Human friendly names for printing, e.g. in error messages 127 | exports.print = require('./print') 128 | -------------------------------------------------------------------------------- /node_modules/multicodec/src/int-table.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const baseTable = require('./base-table.json') 3 | 4 | // map for hexString -> codecName 5 | const nameTable = new Map() 6 | 7 | for (const encodingName in baseTable) { 8 | const code = baseTable[encodingName] 9 | nameTable.set(code, encodingName) 10 | } 11 | 12 | module.exports = Object.freeze(nameTable) 13 | -------------------------------------------------------------------------------- /node_modules/multicodec/src/print.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const table = require('./base-table.json') 4 | 5 | // map for code -> print friendly name 6 | const tableByCode = {} 7 | 8 | for (const [name, code] of Object.entries(table)) { 9 | if (tableByCode[code] === undefined) tableByCode[code] = name 10 | } 11 | 12 | module.exports = Object.freeze(tableByCode) 13 | -------------------------------------------------------------------------------- /node_modules/multicodec/src/util.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const varint = require('varint') 3 | const { Buffer } = require('buffer') 4 | 5 | module.exports = { 6 | numberToBuffer, 7 | bufferToNumber, 8 | varintBufferEncode, 9 | varintBufferDecode, 10 | varintEncode 11 | } 12 | 13 | function bufferToNumber (buf) { 14 | return parseInt(buf.toString('hex'), 16) 15 | } 16 | 17 | function numberToBuffer (num) { 18 | let hexString = num.toString(16) 19 | if (hexString.length % 2 === 1) { 20 | hexString = '0' + hexString 21 | } 22 | return Buffer.from(hexString, 'hex') 23 | } 24 | 25 | function varintBufferEncode (input) { 26 | return Buffer.from(varint.encode(bufferToNumber(input))) 27 | } 28 | 29 | function varintBufferDecode (input) { 30 | return numberToBuffer(varint.decode(input)) 31 | } 32 | 33 | function varintEncode (num) { 34 | return Buffer.from(varint.encode(num)) 35 | } 36 | -------------------------------------------------------------------------------- /node_modules/multicodec/src/varint-table.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const baseTable = require('./base-table.json') 4 | const varintEncode = require('./util').varintEncode 5 | 6 | // map for codecName -> codeVarintBuffer 7 | const varintTable = {} 8 | 9 | for (const encodingName in baseTable) { 10 | const code = baseTable[encodingName] 11 | varintTable[encodingName] = varintEncode(code) 12 | } 13 | 14 | module.exports = Object.freeze(varintTable) 15 | -------------------------------------------------------------------------------- /node_modules/multicodec/tools/update-table.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const bent = require('bent') 4 | const path = require('path') 5 | 6 | const get = bent('string') 7 | const url = 'https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv' 8 | const fs = require('fs') 9 | 10 | const parse = async function * () { 11 | const str = await get(url) 12 | const lines = str.split('\n') 13 | lines.shift() 14 | for (const line of lines) { 15 | if (!line.length) continue 16 | const [name, tag, code] = line.split(',') 17 | yield { name: name.trim(), tag: tag.trim(), code: parseInt(code.trim(), 16) } 18 | } 19 | } 20 | 21 | const run = async () => { 22 | const table = {} 23 | 24 | for await (const { name, code } of parse()) { 25 | table[name] = code 26 | } 27 | 28 | fs.writeFileSync(path.join(__dirname, '../src/base-table.json'), JSON.stringify(table, null, 2)) 29 | } 30 | run() 31 | -------------------------------------------------------------------------------- /node_modules/multihashes/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ## [0.4.19](https://github.com/multiformats/js-multihash/compare/v0.4.18...v0.4.19) (2020-03-31) 3 | 4 | 5 | ### Bug Fixes 6 | 7 | * add missing md{4,5} hash codes ([010f8cd](https://github.com/multiformats/js-multihash/commit/010f8cd)) 8 | * support zero-length multihashes ([86f556f](https://github.com/multiformats/js-multihash/commit/86f556f)) 9 | * sync test fixtures with go-multihash ([00d5e23](https://github.com/multiformats/js-multihash/commit/00d5e23)) 10 | 11 | 12 | 13 | 14 | ## [0.4.18](https://github.com/multiformats/js-multihash/compare/v0.4.17...v0.4.18) (2020-03-24) 15 | 16 | 17 | 18 | 19 | ## [0.4.17](https://github.com/multiformats/js-multihash/compare/v0.4.16...v0.4.17) (2020-03-17) 20 | 21 | 22 | ### Bug Fixes 23 | 24 | * remove unnecessary deps ([#72](https://github.com/multiformats/js-multihash/issues/72)) ([1e0ac42](https://github.com/multiformats/js-multihash/commit/1e0ac42)) 25 | 26 | 27 | 28 | 29 | ## [0.4.16](https://github.com/multiformats/js-multihash/compare/v0.4.15...v0.4.16) (2020-03-16) 30 | 31 | 32 | ### Bug Fixes 33 | 34 | * add buffer dependency ([#71](https://github.com/multiformats/js-multihash/issues/71)) ([1e91e64](https://github.com/multiformats/js-multihash/commit/1e91e64)) 35 | 36 | 37 | 38 | 39 | ## [0.4.15](https://github.com/multiformats/js-multihash/compare/v0.4.14...v0.4.15) (2019-07-10) 40 | 41 | 42 | ### Features 43 | 44 | * support identity hashes ([b85999d](https://github.com/multiformats/js-multihash/commit/b85999d)) 45 | 46 | 47 | 48 | 49 | ## [0.4.14](https://github.com/multiformats/js-multihash/compare/v0.4.13...v0.4.14) (2018-08-08) 50 | 51 | 52 | ### Bug Fixes 53 | 54 | * missing id name constant ([42b9f0c](https://github.com/multiformats/js-multihash/commit/42b9f0c)) 55 | 56 | 57 | 58 | 59 | ## [0.4.13](https://github.com/multiformats/js-multihash/compare/v0.4.12...v0.4.13) (2018-01-04) 60 | 61 | 62 | ### Bug Fixes 63 | 64 | * add missing dbl-sha2-256 ([#44](https://github.com/multiformats/js-multihash/issues/44)) ([4421157](https://github.com/multiformats/js-multihash/commit/4421157)), closes [#38](https://github.com/multiformats/js-multihash/issues/38) 65 | 66 | 67 | 68 | 69 | ## [0.4.12](https://github.com/multiformats/js-multihash/compare/v0.4.11...v0.4.12) (2017-10-20) 70 | 71 | 72 | ### Bug Fixes 73 | 74 | * add missing blake2s-256 ([72b856f](https://github.com/multiformats/js-multihash/commit/72b856f)) 75 | 76 | 77 | 78 | 79 | ## [0.4.11](https://github.com/multiformats/js-multihash/compare/v0.4.10...v0.4.11) (2017-10-20) 80 | 81 | 82 | 83 | 84 | ## [0.4.10](https://github.com/multiformats/js-multihash/compare/v0.4.9...v0.4.10) (2017-10-13) 85 | 86 | 87 | ### Features 88 | 89 | * Adding Skein hash to the mix ([#34](https://github.com/multiformats/js-multihash/issues/34)) ([edf94d5](https://github.com/multiformats/js-multihash/commit/edf94d5)) 90 | 91 | 92 | 93 | 94 | ## [0.4.9](https://github.com/multiformats/js-multihash/compare/v0.4.8...v0.4.9) (2017-09-01) 95 | 96 | 97 | 98 | 99 | ## [0.4.8](https://github.com/multiformats/js-multihash/compare/v0.4.7...v0.4.8) (2017-08-23) 100 | 101 | 102 | 103 | 104 | ## [0.4.7](https://github.com/multiformats/js-multihash/compare/v0.4.6...v0.4.7) (2017-08-23) 105 | 106 | 107 | 108 | 109 | ## [0.4.6](https://github.com/multiformats/js-multihash/compare/v0.4.5...v0.4.6) (2017-08-23) 110 | 111 | 112 | 113 | 114 | ## [0.4.5](https://github.com/multiformats/js-multihash/compare/v0.4.4...v0.4.5) (2017-03-23) 115 | 116 | 117 | ### Bug Fixes 118 | 119 | * changed name of murmur3 codec to murmur3-128 ([34a9496](https://github.com/multiformats/js-multihash/commit/34a9496)) 120 | 121 | 122 | 123 | 124 | ## [0.4.4](https://github.com/multiformats/js-multihash/compare/v0.4.3...v0.4.4) (2017-03-16) 125 | 126 | 127 | 128 | 129 | ## [0.4.3](https://github.com/multiformats/js-multihash/compare/0.4.2...v0.4.3) (2017-02-24) 130 | 131 | 132 | 133 | 134 | ## [0.4.2](https://github.com/multiformats/js-multihash/compare/v0.4.1...0.4.2) (2017-02-24) 135 | 136 | 137 | 138 | 139 | ## [0.4.1](https://github.com/multiformats/js-multihash/compare/v0.4.0...v0.4.1) (2017-02-24) 140 | 141 | 142 | 143 | 144 | # [0.4.0](https://github.com/multiformats/js-multihash/compare/v0.3.3...v0.4.0) (2017-02-24) 145 | 146 | 147 | 148 | 149 | ## [0.3.3](https://github.com/multiformats/js-multihash/compare/v0.3.2...v0.3.3) (2017-02-09) 150 | 151 | 152 | 153 | 154 | ## [0.3.2](https://github.com/multiformats/js-multihash/compare/v0.3.1...v0.3.2) (2017-01-27) 155 | 156 | 157 | 158 | 159 | ## [0.3.1](https://github.com/multiformats/js-multihash/compare/v0.3.0...v0.3.1) (2016-12-16) 160 | 161 | 162 | ### Features 163 | 164 | * add .prefix function ([8fd714c](https://github.com/multiformats/js-multihash/commit/8fd714c)) 165 | 166 | 167 | 168 | 169 | # [0.3.0](https://github.com/multiformats/js-multihash/compare/v0.2.2...v0.3.0) (2016-11-26) 170 | 171 | 172 | ### Bug Fixes 173 | 174 | * update package.json ([bca3681](https://github.com/multiformats/js-multihash/commit/bca3681)) 175 | 176 | 177 | 178 | 179 | ## [0.2.2](https://github.com/multiformats/js-multihash/compare/v0.2.1...v0.2.2) (2016-05-16) 180 | 181 | 182 | ### Bug Fixes 183 | 184 | * Throw errors, do not return them ([1215fa6](https://github.com/multiformats/js-multihash/commit/1215fa6)) 185 | 186 | 187 | 188 | 189 | ## 0.2.1 (2016-04-17) 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /node_modules/multihashes/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Protocol Labs Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/multihashes/README.md: -------------------------------------------------------------------------------- 1 | js-multihash 2 | ============ 3 | 4 | [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) 5 | [![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats) 6 | [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) 7 | [![Coverage Status](https://coveralls.io/repos/github/multiformats/js-multihash/badge.svg?branch=master)](https://coveralls.io/github/multiformats/js-multihash?branch=master) 8 | [![Travis CI](https://img.shields.io/travis/multiformats/js-multihash.svg?style=flat-square&branch=master)](https://travis-ci.org/multiformats/js-multihash) 9 | [![Dependency Status](https://david-dm.org/multiformats/js-multihash.svg?style=flat-square)](https://david-dm.org/multiformats/js-multihash) 10 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) 11 | [![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) 12 | 13 | > multihash implementation in node.js 14 | 15 | This is the [multihash](//github.com/multiformats/multihash) implementation in Node. 16 | It is extended by [js-multihashing](https://github.com/multiformats/js-multihashing) 17 | and [js-multihashing-async](https://github.com/multiformats/js-multihashing-async), 18 | so give those a look as well. 19 | 20 | ## Lead Maintainer 21 | 22 | [David Dias](http://github.com/diasdavid/) 23 | 24 | ## Table of Contents 25 | 26 | - [Install](#install) 27 | - [In Node.js through npm](#in-nodejs-through-npm) 28 | - [Browser: Browserify, Webpack, other bundlers](#browser-browserify-webpack-other-bundlers) 29 | - [In the Browser through ` 58 | 59 | 60 | ``` 61 | 62 | #### Gotchas 63 | 64 | You will need to use Node.js `Buffer` API compatible, if you are running inside the browser, you can access it by `multihash.Buffer` or you can install Feross's [Buffer](https://github.com/feross/buffer). 65 | 66 | ## Usage 67 | 68 | ```js 69 | > var multihash = require('multihashes') 70 | > var buf = new Buffer('0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', 'hex') 71 | 72 | > var encoded = multihash.encode(buf, 'sha1') 73 | > console.log(encoded) 74 | 75 | 76 | > multihash.decode(encoded) 77 | { code: 17, 78 | name: 'sha1', 79 | length: 20, 80 | digest: } 81 | ``` 82 | 83 | ## API 84 | 85 | https://multiformats.github.io/js-multihash/ 86 | 87 | ## Contribute 88 | 89 | Contributions welcome. Please check out [the issues](https://github.com/multiformats/js-multihash/issues). 90 | 91 | Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). 92 | 93 | Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. 94 | 95 | ## License 96 | 97 | [MIT](LICENSE) © 2016 Protocol Labs Inc. 98 | -------------------------------------------------------------------------------- /node_modules/multihashes/dist/index.min.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * The buffer module from node.js, for the browser. 3 | * 4 | * @author Feross Aboukhadijeh 5 | * @license MIT 6 | */ 7 | -------------------------------------------------------------------------------- /node_modules/multihashes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multihashes", 3 | "version": "0.4.19", 4 | "description": "multihash implementation", 5 | "leadMaintainer": "David Dias ", 6 | "main": "src/index.js", 7 | "scripts": { 8 | "lint": "aegir lint", 9 | "test:browser": "aegir test --target browser", 10 | "test:node": "aegir test --target node", 11 | "build": "aegir build", 12 | "test": "aegir test", 13 | "docs": "aegir docs", 14 | "release": "aegir release --docs", 15 | "release-minor": "aegir release --type minor --docs", 16 | "release-major": "aegir release --type major --docs", 17 | "coverage": "aegir coverage", 18 | "coverage-publish": "aegir coverage --provider coveralls" 19 | }, 20 | "files": [ 21 | "src", 22 | "dist" 23 | ], 24 | "repository": { 25 | "type": "git", 26 | "url": "git://github.com/multiformats/js-multihash.git" 27 | }, 28 | "keywords": [ 29 | "multihash" 30 | ], 31 | "license": "MIT", 32 | "bugs": { 33 | "url": "https://github.com/multiformats/js-multihash/issues" 34 | }, 35 | "dependencies": { 36 | "buffer": "^5.5.0", 37 | "multibase": "^0.7.0", 38 | "varint": "^5.0.0" 39 | }, 40 | "devDependencies": { 41 | "aegir": "^21.4.4", 42 | "chai": "^4.1.2", 43 | "dirty-chai": "^2.0.1", 44 | "pre-commit": "^1.2.2" 45 | }, 46 | "contributors": [ 47 | "David Dias ", 48 | "Juan Benet ", 49 | "Friedel Ziegelmayer ", 50 | "Jacob Heun ", 51 | "Richard Littauer ", 52 | "ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ ", 53 | "Rod Vagg ", 54 | "Hugo Dias ", 55 | "Pedro Teixeira ", 56 | "kumavis ", 57 | "Alan Shaw ", 58 | "Fil ", 59 | "Donald Tsang ", 60 | "Trond Arne Bråthen ", 61 | "Vasco Santos ", 62 | "Volker Mische ", 63 | "William Cotton ", 64 | "nginnever ", 65 | "Linus Unnebäck ", 66 | "Nate Foss " 67 | ] 68 | } 69 | -------------------------------------------------------------------------------- /node_modules/multihashes/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Multihash implementation in JavaScript. 3 | * 4 | * @module multihash 5 | */ 6 | 'use strict' 7 | 8 | const { Buffer } = require('buffer') 9 | const multibase = require('multibase') 10 | const varint = require('varint') 11 | const cs = require('./constants') 12 | 13 | exports.names = cs.names 14 | exports.codes = cs.codes 15 | exports.defaultLengths = cs.defaultLengths 16 | 17 | /** 18 | * Convert the given multihash to a hex encoded string. 19 | * 20 | * @param {Buffer} hash 21 | * @returns {string} 22 | */ 23 | exports.toHexString = function toHexString (hash) { 24 | if (!Buffer.isBuffer(hash)) { 25 | throw new Error('must be passed a buffer') 26 | } 27 | 28 | return hash.toString('hex') 29 | } 30 | 31 | /** 32 | * Convert the given hex encoded string to a multihash. 33 | * 34 | * @param {string} hash 35 | * @returns {Buffer} 36 | */ 37 | exports.fromHexString = function fromHexString (hash) { 38 | return Buffer.from(hash, 'hex') 39 | } 40 | 41 | /** 42 | * Convert the given multihash to a base58 encoded string. 43 | * 44 | * @param {Buffer} hash 45 | * @returns {string} 46 | */ 47 | exports.toB58String = function toB58String (hash) { 48 | if (!Buffer.isBuffer(hash)) { 49 | throw new Error('must be passed a buffer') 50 | } 51 | 52 | return multibase.encode('base58btc', hash).toString().slice(1) 53 | } 54 | 55 | /** 56 | * Convert the given base58 encoded string to a multihash. 57 | * 58 | * @param {string|Buffer} hash 59 | * @returns {Buffer} 60 | */ 61 | exports.fromB58String = function fromB58String (hash) { 62 | let encoded = hash 63 | if (Buffer.isBuffer(hash)) { 64 | encoded = hash.toString() 65 | } 66 | 67 | return multibase.decode('z' + encoded) 68 | } 69 | 70 | /** 71 | * Decode a hash from the given multihash. 72 | * 73 | * @param {Buffer} buf 74 | * @returns {{code: number, name: string, length: number, digest: Buffer}} result 75 | */ 76 | exports.decode = function decode (buf) { 77 | if (!(Buffer.isBuffer(buf))) { 78 | throw new Error('multihash must be a Buffer') 79 | } 80 | 81 | if (buf.length < 2) { 82 | throw new Error('multihash too short. must be > 2 bytes.') 83 | } 84 | 85 | const code = varint.decode(buf) 86 | if (!exports.isValidCode(code)) { 87 | throw new Error(`multihash unknown function code: 0x${code.toString(16)}`) 88 | } 89 | buf = buf.slice(varint.decode.bytes) 90 | 91 | const len = varint.decode(buf) 92 | if (len < 0) { 93 | throw new Error(`multihash invalid length: ${len}`) 94 | } 95 | buf = buf.slice(varint.decode.bytes) 96 | 97 | if (buf.length !== len) { 98 | throw new Error(`multihash length inconsistent: 0x${buf.toString('hex')}`) 99 | } 100 | 101 | return { 102 | code: code, 103 | name: cs.codes[code], 104 | length: len, 105 | digest: buf 106 | } 107 | } 108 | 109 | /** 110 | * Encode a hash digest along with the specified function code. 111 | * 112 | * > **Note:** the length is derived from the length of the digest itself. 113 | * 114 | * @param {Buffer} digest 115 | * @param {string|number} code 116 | * @param {number} [length] 117 | * @returns {Buffer} 118 | */ 119 | exports.encode = function encode (digest, code, length) { 120 | if (!digest || code === undefined) { 121 | throw new Error('multihash encode requires at least two args: digest, code') 122 | } 123 | 124 | // ensure it's a hashfunction code. 125 | const hashfn = exports.coerceCode(code) 126 | 127 | if (!(Buffer.isBuffer(digest))) { 128 | throw new Error('digest should be a Buffer') 129 | } 130 | 131 | if (length == null) { 132 | length = digest.length 133 | } 134 | 135 | if (length && digest.length !== length) { 136 | throw new Error('digest length should be equal to specified length.') 137 | } 138 | 139 | return Buffer.concat([ 140 | Buffer.from(varint.encode(hashfn)), 141 | Buffer.from(varint.encode(length)), 142 | digest 143 | ]) 144 | } 145 | 146 | /** 147 | * Converts a hash function name into the matching code. 148 | * If passed a number it will return the number if it's a valid code. 149 | * @param {string|number} name 150 | * @returns {number} 151 | */ 152 | exports.coerceCode = function coerceCode (name) { 153 | let code = name 154 | 155 | if (typeof name === 'string') { 156 | if (cs.names[name] === undefined) { 157 | throw new Error(`Unrecognized hash function named: ${name}`) 158 | } 159 | code = cs.names[name] 160 | } 161 | 162 | if (typeof code !== 'number') { 163 | throw new Error(`Hash function code should be a number. Got: ${code}`) 164 | } 165 | 166 | if (cs.codes[code] === undefined && !exports.isAppCode(code)) { 167 | throw new Error(`Unrecognized function code: ${code}`) 168 | } 169 | 170 | return code 171 | } 172 | 173 | /** 174 | * Checks wether a code is part of the app range 175 | * 176 | * @param {number} code 177 | * @returns {boolean} 178 | */ 179 | exports.isAppCode = function appCode (code) { 180 | return code > 0 && code < 0x10 181 | } 182 | 183 | /** 184 | * Checks whether a multihash code is valid. 185 | * 186 | * @param {number} code 187 | * @returns {boolean} 188 | */ 189 | exports.isValidCode = function validCode (code) { 190 | if (exports.isAppCode(code)) { 191 | return true 192 | } 193 | 194 | if (cs.codes[code]) { 195 | return true 196 | } 197 | 198 | return false 199 | } 200 | 201 | /** 202 | * Check if the given buffer is a valid multihash. Throws an error if it is not valid. 203 | * 204 | * @param {Buffer} multihash 205 | * @returns {undefined} 206 | * @throws {Error} 207 | */ 208 | function validate (multihash) { 209 | exports.decode(multihash) // throws if bad. 210 | } 211 | exports.validate = validate 212 | 213 | /** 214 | * Returns a prefix from a valid multihash. Throws an error if it is not valid. 215 | * 216 | * @param {Buffer} multihash 217 | * @returns {undefined} 218 | * @throws {Error} 219 | */ 220 | exports.prefix = function prefix (multihash) { 221 | validate(multihash) 222 | 223 | return multihash.slice(0, 2) 224 | } 225 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Feross Aboukhadijeh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/index.js: -------------------------------------------------------------------------------- 1 | /*! safe-buffer. MIT License. Feross Aboukhadijeh */ 2 | /* eslint-disable node/no-deprecated-api */ 3 | var buffer = require('buffer') 4 | var Buffer = buffer.Buffer 5 | 6 | // alternative to using Object.keys for old browsers 7 | function copyProps (src, dst) { 8 | for (var key in src) { 9 | dst[key] = src[key] 10 | } 11 | } 12 | if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { 13 | module.exports = buffer 14 | } else { 15 | // Copy properties from require('buffer') 16 | copyProps(buffer, exports) 17 | exports.Buffer = SafeBuffer 18 | } 19 | 20 | function SafeBuffer (arg, encodingOrOffset, length) { 21 | return Buffer(arg, encodingOrOffset, length) 22 | } 23 | 24 | SafeBuffer.prototype = Object.create(Buffer.prototype) 25 | 26 | // Copy static methods from Buffer 27 | copyProps(Buffer, SafeBuffer) 28 | 29 | SafeBuffer.from = function (arg, encodingOrOffset, length) { 30 | if (typeof arg === 'number') { 31 | throw new TypeError('Argument must not be a number') 32 | } 33 | return Buffer(arg, encodingOrOffset, length) 34 | } 35 | 36 | SafeBuffer.alloc = function (size, fill, encoding) { 37 | if (typeof size !== 'number') { 38 | throw new TypeError('Argument must be a number') 39 | } 40 | var buf = Buffer(size) 41 | if (fill !== undefined) { 42 | if (typeof encoding === 'string') { 43 | buf.fill(fill, encoding) 44 | } else { 45 | buf.fill(fill) 46 | } 47 | } else { 48 | buf.fill(0) 49 | } 50 | return buf 51 | } 52 | 53 | SafeBuffer.allocUnsafe = function (size) { 54 | if (typeof size !== 'number') { 55 | throw new TypeError('Argument must be a number') 56 | } 57 | return Buffer(size) 58 | } 59 | 60 | SafeBuffer.allocUnsafeSlow = function (size) { 61 | if (typeof size !== 'number') { 62 | throw new TypeError('Argument must be a number') 63 | } 64 | return buffer.SlowBuffer(size) 65 | } 66 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "safe-buffer", 3 | "description": "Safer Node.js Buffer API", 4 | "version": "5.2.1", 5 | "author": { 6 | "name": "Feross Aboukhadijeh", 7 | "email": "feross@feross.org", 8 | "url": "https://feross.org" 9 | }, 10 | "bugs": { 11 | "url": "https://github.com/feross/safe-buffer/issues" 12 | }, 13 | "devDependencies": { 14 | "standard": "*", 15 | "tape": "^5.0.0" 16 | }, 17 | "homepage": "https://github.com/feross/safe-buffer", 18 | "keywords": [ 19 | "buffer", 20 | "buffer allocate", 21 | "node security", 22 | "safe", 23 | "safe-buffer", 24 | "security", 25 | "uninitialized" 26 | ], 27 | "license": "MIT", 28 | "main": "index.js", 29 | "types": "index.d.ts", 30 | "repository": { 31 | "type": "git", 32 | "url": "git://github.com/feross/safe-buffer.git" 33 | }, 34 | "scripts": { 35 | "test": "standard && tape test/*.js" 36 | }, 37 | "funding": [ 38 | { 39 | "type": "github", 40 | "url": "https://github.com/sponsors/feross" 41 | }, 42 | { 43 | "type": "patreon", 44 | "url": "https://www.patreon.com/feross" 45 | }, 46 | { 47 | "type": "consulting", 48 | "url": "https://feross.org/support" 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /node_modules/varint/README.md: -------------------------------------------------------------------------------- 1 | # varint 2 | 3 | encode whole numbers to an array of [protobuf-style varint bytes](https://developers.google.com/protocol-buffers/docs/encoding#varints) and also decode them. 4 | 5 | ```javascript 6 | var varint = require('varint') 7 | 8 | var bytes = varint.encode(300) // === [0xAC, 0x02] 9 | varint.decode(bytes) // 300 10 | varint.decode.bytes // 2 (the last decode() call required 2 bytes) 11 | ``` 12 | 13 | ## api 14 | 15 | ### varint = require('varint') 16 | 17 | ### varint.encode(num[, buffer=[], offset=0]) -> buffer 18 | 19 | Encodes `num` into `buffer` starting at `offset`. returns `buffer`, with the encoded varint written into it. If `buffer` is not provided, it will default to a new array. 20 | 21 | `varint.encode.bytes` will now be set to the number of bytes 22 | modified. 23 | 24 | ### varint.decode(data[, offset=0]) -> number 25 | 26 | decodes `data`, which can be either a buffer or array of integers, from position `offset` or default 0 and returns the decoded original integer. 27 | 28 | Throws a `RangeError` when `data` does not represent a valid encoding. 29 | 30 | ### varint.decode.bytes 31 | 32 | if you also require the length (number of bytes) that were required to decode the integer you can access it via `varint.decode.bytes`. this is an integer property that will tell you the number of bytes that the last .decode() call had to use to decode. 33 | 34 | ### varint.encode.bytes 35 | 36 | similar to `decode.bytes` when encoding a number it can be useful to know how many bytes where written (especially if you pass an output array). you can access this via `varint.encode.bytes` which holds the number of bytes written in the last encode. 37 | 38 | 39 | ### varint.encodingLength(num) 40 | 41 | returns the number of bytes this number will be encoded as, up to a maximum of 8. 42 | 43 | ## usage notes 44 | 45 | If varint is passed a buffer that does not contain a valid end 46 | byte, then `decode` will throw `RangeError`, and `decode.bytes` 47 | will be set to 0. If you are reading from a streaming source, 48 | it's okay to pass an incomplete buffer into `decode`, detect this 49 | case, and then concatenate the next buffer. 50 | 51 | # License 52 | 53 | MIT 54 | -------------------------------------------------------------------------------- /node_modules/varint/bench.js: -------------------------------------------------------------------------------- 1 | var N = 1e7 2 | var M = 10 3 | /* 4 | benchmark encoding and decoding N random integers. 5 | 6 | A number is encoded into a buffer, (the buffer is reused so 7 | that allocation does not affect the benchmark) 8 | 9 | to test the effect on performance of invalid records 10 | (i.e. too short, with the Most Significant Byte missing) 11 | every M items, attempt to decode from a shorter slice of the buffer. 12 | This will probably be produce an invalid result. We do not 13 | need to write into that buffer - because it refurs to the same memory as 14 | the full size buffer. 15 | 16 | run with INVALID=1 to include N/M invalid decodes. 17 | 18 | results: 19 | with no invalid decodes, I get about 2428 decodes/ms 20 | with invalid decodes: 21 | old code that overruns buffer: 1122 decodes/ms 22 | check length & return undefined: 2439 decodecs/ms 23 | check length & return NaN: 2434 d/ms 24 | check length & return -1: 2400 d/ms 25 | 26 | conclusion, it doesn't make a significant difference whether 27 | what is returned to show an invalid read, 28 | but if you overrun the buffer the cost is considerable. 29 | 30 | recomendation: return undefined 31 | */ 32 | 33 | var buffer = new Buffer(8) 34 | var _buffer = buffer.slice(0, 4) 35 | var varint = require('./') 36 | var l = N 37 | var invalid = 0 38 | 39 | includeInvalid = !!process.env.INVALID 40 | 41 | var start = Date.now() 42 | while (l--) { 43 | var int = Math.floor(Math.random()*0x01fffffffffffff) 44 | varint.encode(int, buffer, 0) 45 | //console.log(int, varint.decode(buffer, 0)) 46 | //every 1000 varints, do one that will be too short, 47 | //measure 48 | if(includeInvalid && !(l%M)) { 49 | if(undefined == varint.decode(_buffer, 0)) 50 | invalid ++ 51 | } else 52 | if(int !== varint.decode(buffer, 0)) 53 | throw new Error('decode was incorrect') 54 | } 55 | 56 | console.log('decode&encode/ms, invalidDecodes') 57 | console.log(N/(Date.now() - start) + ',', invalid) 58 | -------------------------------------------------------------------------------- /node_modules/varint/decode.js: -------------------------------------------------------------------------------- 1 | module.exports = read 2 | 3 | var MSB = 0x80 4 | , REST = 0x7F 5 | 6 | function read(buf, offset) { 7 | var res = 0 8 | , offset = offset || 0 9 | , shift = 0 10 | , counter = offset 11 | , b 12 | , l = buf.length 13 | 14 | do { 15 | if (counter >= l) { 16 | read.bytes = 0 17 | throw new RangeError('Could not decode varint') 18 | } 19 | b = buf[counter++] 20 | res += shift < 28 21 | ? (b & REST) << shift 22 | : (b & REST) * Math.pow(2, shift) 23 | shift += 7 24 | } while (b >= MSB) 25 | 26 | read.bytes = counter - offset 27 | 28 | return res 29 | } 30 | -------------------------------------------------------------------------------- /node_modules/varint/encode.js: -------------------------------------------------------------------------------- 1 | module.exports = encode 2 | 3 | var MSB = 0x80 4 | , REST = 0x7F 5 | , MSBALL = ~REST 6 | , INT = Math.pow(2, 31) 7 | 8 | function encode(num, out, offset) { 9 | out = out || [] 10 | offset = offset || 0 11 | var oldOffset = offset 12 | 13 | while(num >= INT) { 14 | out[offset++] = (num & 0xFF) | MSB 15 | num /= 128 16 | } 17 | while(num & MSBALL) { 18 | out[offset++] = (num & 0xFF) | MSB 19 | num >>>= 7 20 | } 21 | out[offset] = num | 0 22 | 23 | encode.bytes = offset - oldOffset + 1 24 | 25 | return out 26 | } 27 | -------------------------------------------------------------------------------- /node_modules/varint/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | encode: require('./encode.js') 3 | , decode: require('./decode.js') 4 | , encodingLength: require('./length.js') 5 | } 6 | -------------------------------------------------------------------------------- /node_modules/varint/length.js: -------------------------------------------------------------------------------- 1 | 2 | var N1 = Math.pow(2, 7) 3 | var N2 = Math.pow(2, 14) 4 | var N3 = Math.pow(2, 21) 5 | var N4 = Math.pow(2, 28) 6 | var N5 = Math.pow(2, 35) 7 | var N6 = Math.pow(2, 42) 8 | var N7 = Math.pow(2, 49) 9 | var N8 = Math.pow(2, 56) 10 | var N9 = Math.pow(2, 63) 11 | 12 | module.exports = function (value) { 13 | return ( 14 | value < N1 ? 1 15 | : value < N2 ? 2 16 | : value < N3 ? 3 17 | : value < N4 ? 4 18 | : value < N5 ? 5 19 | : value < N6 ? 6 20 | : value < N7 ? 7 21 | : value < N8 ? 8 22 | : value < N9 ? 9 23 | : 10 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /node_modules/varint/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "varint", 3 | "version": "5.0.0", 4 | "description": "protobuf-style varint bytes - use msb to create integer values of varying sizes", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node test.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/chrisdickinson/varint.git" 12 | }, 13 | "keywords": [ 14 | "varint", 15 | "protobuf", 16 | "encode", 17 | "decode" 18 | ], 19 | "author": "Chris Dickinson ", 20 | "license": "MIT", 21 | "devDependencies": { 22 | "tape": "~2.12.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /node_modules/varint/test.js: -------------------------------------------------------------------------------- 1 | var varint = require('./index') 2 | , test = require('tape') 3 | , decode = varint.decode 4 | , encode = varint.encode 5 | , encodingLength = varint.encodingLength 6 | 7 | test('fuzz test', function(assert) { 8 | var expect 9 | , encoded 10 | 11 | for(var i = 0, len = 100; i < len; ++i) { 12 | expect = randint(0x7FFFFFFF) 13 | encoded = encode(expect) 14 | var data = decode(encoded) 15 | assert.equal(expect, data, 'fuzz test: ' + expect.toString()) 16 | assert.equal(decode.bytes, encoded.length) 17 | } 18 | 19 | assert.end() 20 | }) 21 | 22 | test('test single byte works as expected', function(assert) { 23 | var buf = new Uint8Array(2) 24 | buf[0] = 172 25 | buf[1] = 2 26 | var data = decode(buf) 27 | assert.equal(data, 300, 'should equal 300') 28 | assert.equal(decode.bytes, 2) 29 | assert.end() 30 | }) 31 | 32 | test('test encode works as expected', function(assert) { 33 | var out = [] 34 | 35 | assert.deepEqual(encode(300), [0xAC, 0x02]) 36 | 37 | assert.end() 38 | }) 39 | 40 | test('test decode single bytes', function(assert) { 41 | var expected = randint(parseInt('1111111', '2')) 42 | var buf = new Uint8Array(1) 43 | buf[0] = expected 44 | var data = decode(buf) 45 | assert.equal(data, expected) 46 | assert.equal(decode.bytes, 1) 47 | assert.end() 48 | }) 49 | 50 | test('test decode multiple bytes with zero', function(assert) { 51 | var expected = randint(parseInt('1111111', '2')) 52 | var buf = new Uint8Array(2) 53 | buf[0] = 128 54 | buf[1] = expected 55 | var data = decode(buf) 56 | assert.equal(data, expected << 7) 57 | assert.equal(decode.bytes, 2) 58 | assert.end() 59 | }) 60 | 61 | test('encode single byte', function(assert) { 62 | var expected = randint(parseInt('1111111', '2')) 63 | assert.deepEqual(encode(expected), [expected]) 64 | assert.equal(encode.bytes, 1) 65 | assert.end() 66 | }) 67 | 68 | test('encode multiple byte with zero first byte', function(assert) { 69 | var expected = 0x0F00 70 | assert.deepEqual(encode(expected), [0x80, 0x1E]) 71 | assert.equal(encode.bytes, 2) 72 | assert.end() 73 | }) 74 | 75 | test('big integers', function (assert) { 76 | 77 | var bigs = [] 78 | for(var i = 32; i <= 53; i++) (function (i) { 79 | bigs.push(Math.pow(2, i) - 1) 80 | bigs.push(Math.pow(2, i)) 81 | })(i) 82 | 83 | bigs.forEach(function (n) { 84 | var data = encode(n) 85 | console.error(n, '->', data) 86 | assert.equal(decode(data), n) 87 | assert.notEqual(decode(data), n - 1) 88 | }) 89 | assert.end() 90 | }) 91 | 92 | test('fuzz test - big', function(assert) { 93 | var expect 94 | , encoded 95 | 96 | var MAX_INTD = Math.pow(2, 55) 97 | var MAX_INT = Math.pow(2, 31) 98 | 99 | for(var i = 0, len = 100; i < len; ++i) { 100 | expect = randint(MAX_INTD - MAX_INT) + MAX_INT 101 | encoded = encode(expect) 102 | var data = decode(encoded) 103 | assert.equal(expect, data, 'fuzz test: ' + expect.toString()) 104 | assert.equal(decode.bytes, encoded.length) 105 | } 106 | 107 | assert.end() 108 | }) 109 | 110 | test('encodingLength', function (assert) { 111 | 112 | for(var i = 0; i <= 53; i++) { 113 | var n = Math.pow(2, i) 114 | assert.equal(encode(n).length, encodingLength(n)) 115 | } 116 | 117 | assert.end() 118 | }) 119 | 120 | test('buffer too short', function (assert) { 121 | 122 | var value = encode(9812938912312) 123 | var buffer = encode(value) 124 | 125 | var l = buffer.length 126 | while(l--) { 127 | try { 128 | var val = decode(buffer.slice(0, l)) 129 | } catch (err) { 130 | assert.equal(err.constructor, RangeError) 131 | assert.equal(decode.bytes, 0) 132 | } 133 | } 134 | assert.end() 135 | }) 136 | 137 | function randint(range) { 138 | return Math.floor(Math.random() * range) 139 | } 140 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "convert-cidv0", 3 | "main": "index.js", 4 | "dependencies": { 5 | "@actions/core": "^1.2.6", 6 | "cids": "^0.8.1" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@actions/core@^1.2.6": 6 | version "1.2.6" 7 | resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09" 8 | integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA== 9 | 10 | base-x@^3.0.8: 11 | version "3.0.8" 12 | resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d" 13 | integrity sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA== 14 | dependencies: 15 | safe-buffer "^5.0.1" 16 | 17 | base64-js@^1.0.2: 18 | version "1.3.1" 19 | resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" 20 | integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== 21 | 22 | buffer@^5.5.0: 23 | version "5.6.0" 24 | resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786" 25 | integrity sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw== 26 | dependencies: 27 | base64-js "^1.0.2" 28 | ieee754 "^1.1.4" 29 | 30 | cids@^0.8.1: 31 | version "0.8.1" 32 | resolved "https://registry.yarnpkg.com/cids/-/cids-0.8.1.tgz#24a6e1c78ba27d1b80bd7e99e7d450a74a987014" 33 | integrity sha512-bs9hGUYHzsclGSt4ipi6SRUBIWYpuEHhd2uPc5hUatNQl6y5mFr+6JvJtN3fGUiNZNohc7rkY6OpXamwj6PQeg== 34 | dependencies: 35 | buffer "^5.5.0" 36 | class-is "^1.1.0" 37 | multibase "~0.7.0" 38 | multicodec "^1.0.1" 39 | multihashes "~0.4.17" 40 | 41 | class-is@^1.1.0: 42 | version "1.1.0" 43 | resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825" 44 | integrity sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw== 45 | 46 | ieee754@^1.1.4: 47 | version "1.1.13" 48 | resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" 49 | integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== 50 | 51 | multibase@^0.7.0, multibase@~0.7.0: 52 | version "0.7.0" 53 | resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" 54 | integrity sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg== 55 | dependencies: 56 | base-x "^3.0.8" 57 | buffer "^5.5.0" 58 | 59 | multicodec@^1.0.1: 60 | version "1.0.1" 61 | resolved "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.1.tgz#4e2812d726b9f7c7d615d3ebc5787d36a08680f9" 62 | integrity sha512-yrrU/K8zHyAH2B0slNVeq3AiwluflHpgQ3TAzwNJcuO2AoPyXgBT2EDkdbP1D8B/yFOY+S2hDYmFlI1vhVFkQw== 63 | dependencies: 64 | buffer "^5.5.0" 65 | varint "^5.0.0" 66 | 67 | multihashes@~0.4.17: 68 | version "0.4.19" 69 | resolved "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.19.tgz#d7493cf028e48747122f350908ea13d12d204813" 70 | integrity sha512-ej74GAfA20imjj00RO5h34aY3pGUFyzn9FJZFWwdeUHlHTkKmv90FrNpvYT4jYf1XXCy5O/5EjVnxTaESgOM6A== 71 | dependencies: 72 | buffer "^5.5.0" 73 | multibase "^0.7.0" 74 | varint "^5.0.0" 75 | 76 | safe-buffer@^5.0.1: 77 | version "5.2.1" 78 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" 79 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 80 | 81 | varint@^5.0.0: 82 | version "5.0.0" 83 | resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.0.tgz#d826b89f7490732fabc0c0ed693ed475dcb29ebf" 84 | integrity sha1-2Ca4n3SQcy+rwMDtaT7Uddyynr8= 85 | --------------------------------------------------------------------------------