Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (options.tags) {
tags = Object.assign({}, defaultTags, options && options.tags)
}
} else {
// no options, reset to defaults
currentSize = defaultSize
maxSize = defaultMaxSize
}
const decoderOptions = {
tags: tags,
size: currentSize
}
decoder = new cbor.Decoder(decoderOptions)
// borc edits opts.size in-place so we can capture _actual_ size
currentSize = decoderOptions.size
}
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
const codec = 'dag-cbor'
const version = 1
const CID_CBOR_TAG = 42
const decoder = new cbor.Decoder({
tags: {
[CID_CBOR_TAG]: val => {
return {
'/': val.slice(1)
}
}
}
})
const serialize = (elem, tasks, t, i) => {
const seen = []
let cid
const tagged = transform(elem, val => {
if (!isObject(val)) {
return val
}
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
const CID_CBOR_TAG = 42
const decoder = new cbor.Decoder({
tags: {
[CID_CBOR_TAG]: val => {
return {
'/': val.slice(1)
}
}
}
})
const sha2_256 = data => {
return crypto.createHash('sha256').update(data).digest()
}
exports.codec = 'dag-cbor'
exports.version = 1