Compare commits
No commits in common. "v0.2.0-develop.22" and "v0.2.0-develop.21" have entirely different histories.
v0.2.0-dev
...
v0.2.0-dev
|
@ -1,5 +1,3 @@
|
||||||
# [0.2.0-develop.22](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.21...v0.2.0-develop.22) (2023-09-03)
|
|
||||||
|
|
||||||
# [0.2.0-develop.21](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.20...v0.2.0-develop.21) (2023-09-03)
|
# [0.2.0-develop.21](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.20...v0.2.0-develop.21) (2023-09-03)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.22",
|
"version": "0.2.0-develop.21",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.22",
|
"version": "0.2.0-develop.21",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/libs5": "^0.1.0-develop.44",
|
"@lumeweb/libs5": "^0.1.0-develop.44",
|
||||||
"@noble/curves": "^1.1.0",
|
"@noble/curves": "^1.1.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.22",
|
"version": "0.2.0-develop.21",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -49,12 +49,9 @@ export function encodeCid(
|
||||||
return base58btc.encode(prefixedHash).toString();
|
return base58btc.encode(prefixedHash).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decodeCid(cid: string | Uint8Array): CID {
|
export function decodeCid(cid: string): CID {
|
||||||
let bytes = cid;
|
let bytes = base58btc.decode(cid);
|
||||||
|
|
||||||
if (typeof bytes === "string") {
|
|
||||||
bytes = base58btc.decode(bytes);
|
|
||||||
}
|
|
||||||
if (!Object.values(CID_TYPES).includes(bytes[0])) {
|
if (!Object.values(CID_TYPES).includes(bytes[0])) {
|
||||||
throw new Error("Invalid cid type");
|
throw new Error("Invalid cid type");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue