multiformats
Advanced tools
Comparing version 4.3.5 to 4.4.0
@@ -7,2 +7,3 @@ 'use strict'; | ||
var crypto = require('crypto'); | ||
var identity = require('../src/hashes/identity.js'); | ||
var assert = require('assert'); | ||
@@ -72,2 +73,11 @@ var validMultihash = require('./fixtures/valid-multihash.js'); | ||
}); | ||
test('hash identity', async () => { | ||
const hash = await identity.digest(bytes.fromString('test')); | ||
same(hash.code, identity.code); | ||
same(identity.code, 0); | ||
same(hash.digest, bytes.fromString('test')); | ||
const hash2 = digest.decode(hash.bytes); | ||
same(hash2.code, identity.code); | ||
same(hash2.bytes, hash.bytes); | ||
}); | ||
}); | ||
@@ -74,0 +84,0 @@ describe('decode', () => { |
@@ -7,2 +7,3 @@ 'use strict'; | ||
var sha2 = require('../src/hashes/sha2.js'); | ||
var identity = require('../src/hashes/identity.js'); | ||
var assert = require('assert'); | ||
@@ -72,2 +73,11 @@ var validMultihash = require('./fixtures/valid-multihash.js'); | ||
}); | ||
test('hash identity', async () => { | ||
const hash = await identity.digest(bytes.fromString('test')); | ||
same(hash.code, identity.code); | ||
same(identity.code, 0); | ||
same(hash.digest, bytes.fromString('test')); | ||
const hash2 = digest.decode(hash.bytes); | ||
same(hash2.code, identity.code); | ||
same(hash2.bytes, hash.bytes); | ||
}); | ||
}); | ||
@@ -74,0 +84,0 @@ describe('decode', () => { |
@@ -15,2 +15,3 @@ import { | ||
} from '../src/hashes/sha2-browser.js'; | ||
import identity from '../src/hashes/identity.js'; | ||
import { | ||
@@ -75,2 +76,11 @@ decode as decodeDigest, | ||
}); | ||
test('hash identity', async () => { | ||
const hash = await identity.digest(fromString('test')); | ||
same(hash.code, identity.code); | ||
same(identity.code, 0); | ||
same(hash.digest, fromString('test')); | ||
const hash2 = decodeDigest(hash.bytes); | ||
same(hash2.code, identity.code); | ||
same(hash2.bytes, hash.bytes); | ||
}); | ||
}); | ||
@@ -77,0 +87,0 @@ describe('decode', () => { |
@@ -15,2 +15,3 @@ import { | ||
} from '../src/hashes/sha2.js'; | ||
import identity from '../src/hashes/identity.js'; | ||
import { | ||
@@ -75,2 +76,11 @@ decode as decodeDigest, | ||
}); | ||
test('hash identity', async () => { | ||
const hash = await identity.digest(fromString('test')); | ||
same(hash.code, identity.code); | ||
same(identity.code, 0); | ||
same(hash.digest, fromString('test')); | ||
const hash2 = decodeDigest(hash.bytes); | ||
same(hash2.code, identity.code); | ||
same(hash2.bytes, hash.bytes); | ||
}); | ||
}); | ||
@@ -77,0 +87,0 @@ describe('decode', () => { |
{ | ||
"name": "multiformats", | ||
"version": "4.3.5", | ||
"version": "4.4.0", | ||
"description": "Interface for multihash, multicodec, multibase and CID", | ||
@@ -91,2 +91,7 @@ "scripts": { | ||
}, | ||
"./hashes/identity": { | ||
"require": "./cjs/src/hashes/identity.js", | ||
"import": "./esm/src/hashes/identity.js", | ||
"browser": "./esm/src/hashes/identity.js" | ||
}, | ||
"./codecs/codec": { | ||
@@ -160,2 +165,3 @@ "require": "./cjs/src/codecs/codec.js", | ||
"./hashes/sha2": "./cjs/src/hashes/sha2-browser.js", | ||
"./hashes/identity": "./cjs/src/hashes/identity.js", | ||
"./codecs/codec": "./cjs/src/codecs/codec.js", | ||
@@ -162,0 +168,0 @@ "./codecs/json": "./cjs/src/codecs/json.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284181
138
8605