Compare commits
3 Commits
v0.2.0-dev
...
v0.2.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 95d572577c | |
Derrick Hammer | 01920ecf16 | |
Derrick Hammer | 55e28b806c |
|
@ -1,3 +1,5 @@
|
|||
# [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)
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lumeweb/libportal",
|
||||
"version": "0.2.0-develop.21",
|
||||
"version": "0.2.0-develop.22",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/libportal",
|
||||
"version": "0.2.0-develop.21",
|
||||
"version": "0.2.0-develop.22",
|
||||
"dependencies": {
|
||||
"@lumeweb/libs5": "^0.1.0-develop.44",
|
||||
"@noble/curves": "^1.1.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/libportal",
|
||||
"version": "0.2.0-develop.21",
|
||||
"version": "0.2.0-develop.22",
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
|
|
@ -49,9 +49,12 @@ export function encodeCid(
|
|||
return base58btc.encode(prefixedHash).toString();
|
||||
}
|
||||
|
||||
export function decodeCid(cid: string): CID {
|
||||
let bytes = base58btc.decode(cid);
|
||||
export function decodeCid(cid: string | Uint8Array): CID {
|
||||
let bytes = cid;
|
||||
|
||||
if (typeof bytes === "string") {
|
||||
bytes = base58btc.decode(bytes);
|
||||
}
|
||||
if (!Object.values(CID_TYPES).includes(bytes[0])) {
|
||||
throw new Error("Invalid cid type");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue