Compare commits
3 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | a46f0bf255 | |
Derrick Hammer | e2e269483d | |
Derrick Hammer | 517446310d |
|
@ -1,3 +1,10 @@
|
||||||
|
# [0.1.0-develop.57](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.56...v0.1.0-develop.57) (2023-09-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* if the registry entry hash type is not ed25519, return a new cid with the type set to raw ([5174463](https://git.lumeweb.com/LumeWeb/libs5/commit/517446310dea876003246b15255659bddcccb0be))
|
||||||
|
|
||||||
# [0.1.0-develop.56](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.55...v0.1.0-develop.56) (2023-09-09)
|
# [0.1.0-develop.56](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.55...v0.1.0-develop.56) (2023-09-09)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libs5",
|
"name": "@lumeweb/libs5",
|
||||||
"version": "0.1.0-develop.56",
|
"version": "0.1.0-develop.57",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libs5",
|
"name": "@lumeweb/libs5",
|
||||||
"version": "0.1.0-develop.56",
|
"version": "0.1.0-develop.57",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@noble/curves": "^1.1.0",
|
"@noble/curves": "^1.1.0",
|
||||||
"@noble/hashes": "^1.3.1",
|
"@noble/hashes": "^1.3.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libs5",
|
"name": "@lumeweb/libs5",
|
||||||
"version": "0.1.0-develop.56",
|
"version": "0.1.0-develop.57",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
10
src/cid.ts
10
src/cid.ts
|
@ -1,6 +1,6 @@
|
||||||
import Multibase from "#multibase.js";
|
import Multibase from "#multibase.js";
|
||||||
import { Multihash } from "#multihash.js";
|
import { Multihash } from "#multihash.js";
|
||||||
import { CID_TYPES, REGISTRY_TYPES } from "#constants.js";
|
import { CID_HASH_TYPES, CID_TYPES, REGISTRY_TYPES } from "#constants.js";
|
||||||
import { decodeEndian, encodeEndian } from "#util.js";
|
import { decodeEndian, encodeEndian } from "#util.js";
|
||||||
import { concatBytes, equalBytes } from "@noble/curves/abstract/utils";
|
import { concatBytes, equalBytes } from "@noble/curves/abstract/utils";
|
||||||
import { hexToBytes } from "@noble/hashes/utils";
|
import { hexToBytes } from "@noble/hashes/utils";
|
||||||
|
@ -29,7 +29,13 @@ export default class CID extends Multibase {
|
||||||
|
|
||||||
bytes = bytes.slice(1);
|
bytes = bytes.slice(1);
|
||||||
|
|
||||||
return CID._init(bytes);
|
const cid = CID._init(bytes);
|
||||||
|
|
||||||
|
if (cid.hash.functionType !== CID_HASH_TYPES.ED25519) {
|
||||||
|
return cid.copyWith({ type: CID_TYPES.RAW });
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromBytes(bytes: Uint8Array): CID {
|
static fromBytes(bytes: Uint8Array): CID {
|
||||||
|
|
Loading…
Reference in New Issue