This commit is contained in:
parent
e7ed382823
commit
11e41de86a
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ docs/
|
||||
|
||||
# Dotenv file
|
||||
.env
|
||||
broadcast
|
55
Makefile
Normal file
55
Makefile
Normal file
@ -0,0 +1,55 @@
|
||||
-include .env
|
||||
|
||||
.PHONY: all test clean deploy fund help install snapshot format anvil zktest
|
||||
|
||||
DEFAULT_ANVIL_KEY := 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|
||||
DEFAULT_ZKSYNC_LOCAL_KEY := 0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110
|
||||
|
||||
all: clean remove install update build
|
||||
|
||||
# Clean the repo
|
||||
clean :; forge clean
|
||||
|
||||
# Remove modules
|
||||
remove :; rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules && git add . && git commit -m "modules"
|
||||
|
||||
install :; forge install cyfrin/foundry-devops@0.2.2 --no-commit && forge install foundry-rs/forge-std@v1.8.2 --no-commit && forge install openzeppelin/openzeppelin-contracts@v5.0.2 --no-commit
|
||||
|
||||
# Update Dependencies
|
||||
update:; forge update
|
||||
|
||||
build:; forge build
|
||||
|
||||
test :; forge test
|
||||
|
||||
zktest :; foundryup-zksync && forge test --zksync && foundryup
|
||||
|
||||
snapshot :; forge snapshot
|
||||
|
||||
format :; forge fmt
|
||||
|
||||
anvil :; anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1
|
||||
|
||||
NETWORK_ARGS := --rpc-url http://localhost:8545 --private-key $(DEFAULT_ANVIL_KEY) --broadcast
|
||||
|
||||
ifeq ($(findstring --network sepolia,$(ARGS)),--network sepolia)
|
||||
NETWORK_ARGS := --rpc-url $(SEPOLIA_RPC_URL) --private-key $(SEPOLIA_PRIVATE_KEY) --broadcast --verify --etherscan-api-key $(ETHERSCAN_API_KEY) -vvvv
|
||||
endif
|
||||
|
||||
deploy:
|
||||
@forge script script/DeployBasicNft.s.sol:DeployBasicNft $(NETWORK_ARGS)
|
||||
|
||||
mint:
|
||||
@forge script script/Interactions.s.sol:MintBasicNft ${NETWORK_ARGS}
|
||||
|
||||
deployMood:
|
||||
@forge script script/DeployMoodNft.s.sol:DeployMoodNft $(NETWORK_ARGS)
|
||||
|
||||
mintMoodNft:
|
||||
@forge script script/Interactions.s.sol:MintMoodNft $(NETWORK_ARGS)
|
||||
|
||||
flipMoodNft:
|
||||
@forge script script/Interactions.s.sol:FlipMoodNft $(NETWORK_ARGS)
|
||||
|
||||
zkdeploy:
|
||||
@forge create src/OurToken.sol:OurToken --rpc-url http://127.0.0.1:8011 --private-key $(DEFAULT_ZKSYNC_LOCAL_KEY) --legacy --zksync
|
73
README.md
73
README.md
@ -1,66 +1,15 @@
|
||||
## Foundry
|
||||
https://eips.ethereum.org/EIPS/eip-721
|
||||
|
||||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
|
||||
forge init
|
||||
forge install OpenZeppelin/openzeppelin-contracts --no-commit
|
||||
forge install ChainAccelOrg/foundry-devops --no-commit
|
||||
|
||||
Foundry consists of:
|
||||
// Local Anvil Test
|
||||
make deploy
|
||||
make mint
|
||||
|
||||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
|
||||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
|
||||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
|
||||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
|
||||
// Sepolia Test
|
||||
make deploy ARGS="--network sepolia"
|
||||
make mint ARGS="--network sepolia"
|
||||
|
||||
## Documentation
|
||||
|
||||
https://book.getfoundry.sh/
|
||||
|
||||
## Usage
|
||||
|
||||
### Build
|
||||
|
||||
```shell
|
||||
$ forge build
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
```shell
|
||||
$ forge test
|
||||
```
|
||||
|
||||
### Format
|
||||
|
||||
```shell
|
||||
$ forge fmt
|
||||
```
|
||||
|
||||
### Gas Snapshots
|
||||
|
||||
```shell
|
||||
$ forge snapshot
|
||||
```
|
||||
|
||||
### Anvil
|
||||
|
||||
```shell
|
||||
$ anvil
|
||||
```
|
||||
|
||||
### Deploy
|
||||
|
||||
```shell
|
||||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
|
||||
```
|
||||
|
||||
### Cast
|
||||
|
||||
```shell
|
||||
$ cast <subcommand>
|
||||
```
|
||||
|
||||
### Help
|
||||
|
||||
```shell
|
||||
$ forge --help
|
||||
$ anvil --help
|
||||
$ cast --help
|
||||
```
|
||||
// MetaMask add deployed contract address with token id start with 0
|
||||
|
12
foundry.toml
12
foundry.toml
@ -2,5 +2,17 @@
|
||||
src = "src"
|
||||
out = "out"
|
||||
libs = ["lib"]
|
||||
fs_permissions = [
|
||||
{ access = "read", path = "./images/" },
|
||||
{ access = "read", path = "./broadcast" },
|
||||
]
|
||||
remappping = ["@openzeppelin/contracts=lib/openzeppelin-contracts/contracts"]
|
||||
ffi = true
|
||||
|
||||
[etherscan]
|
||||
mainnet = { key = "${ETHERSCAN_API_KEY}" }
|
||||
sepolia = { key = "${ETHERSCAN_API_KEY}" }
|
||||
|
||||
[rpc_endpoints]
|
||||
sepolia = "${SEPOLIA_RPC_URL}"
|
||||
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
|
||||
|
BIN
img/Hoelee.png
Normal file
BIN
img/Hoelee.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
11
img/dog.json
Normal file
11
img/dog.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "PUG",
|
||||
"description": "An adorable PUG pup!",
|
||||
"image": "https://ipfs.io/ipfs/QmSsYRx3LpDAb1GZQm7zZ1AuHZjfbPkD6J7s9r41xu1mf8?filename=pug.png",
|
||||
"attributes": [
|
||||
{
|
||||
"trait_type": "cuteness",
|
||||
"value": 100
|
||||
}
|
||||
]
|
||||
}
|
11
img/hoelee.json
Normal file
11
img/hoelee.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "HOELEE",
|
||||
"description": "A Digital Representation of Mr HOELEE.",
|
||||
"image": "https://ipfs.io/ipfs/QmSsYRx3LpDAb1GZQm7zZ1AuHZjfbPkD6J7s9r41xu1mf8?filename=pug.png",
|
||||
"attributes": [
|
||||
{ "trait_type": "height", "value": "172CM" },
|
||||
{ "trait_type": "race", "value": "Chinese" },
|
||||
{ "trait_type": "sex", "value": "Male" },
|
||||
{ "trait_type": "website", "value": "https://www.hoelee.com" }
|
||||
]
|
||||
}
|
11
img/hoeleev2.json
Normal file
11
img/hoeleev2.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Mr Hoelee",
|
||||
"description": "A Digital Act Represent of Hoelee.",
|
||||
"image": "https://ipfs.io/ipfs/QmW1aRxvAngY22wrxyrUYSriekkHQMcXA3D1mjHgBc5ge6?filename=Hoelee.png",
|
||||
"attributes": [
|
||||
{ "trait_type": "height", "value": "172CM" },
|
||||
{ "trait_type": "race", "value": "Chinese" },
|
||||
{ "trait_type": "sex", "value": "Male" },
|
||||
{ "trait_type": "website", "value": "https://www.hoelee.com" }
|
||||
]
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit 19ea2626cc584763fb7f20aec56fca92951b109a
|
||||
Subproject commit df9f90b490423578142b5dd50752db9427efb2ac
|
16
node_modules/.yarn-integrity
generated
vendored
Normal file
16
node_modules/.yarn-integrity
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"systemParams": "linux-x64-108",
|
||||
"modulesFolders": [
|
||||
"node_modules"
|
||||
],
|
||||
"flags": [],
|
||||
"linkedModules": [],
|
||||
"topLevelPatterns": [
|
||||
"multiformats@^13.2.2"
|
||||
],
|
||||
"lockfileEntries": {
|
||||
"multiformats@^13.2.2": "https://registry.yarnpkg.com/multiformats/-/multiformats-13.2.2.tgz#16da153ee8b68d8c9da31b52176e90b3cd8b43ef"
|
||||
},
|
||||
"files": [],
|
||||
"artifacts": {}
|
||||
}
|
4
node_modules/multiformats/LICENSE
generated
vendored
Normal file
4
node_modules/multiformats/LICENSE
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
This project is dual licensed under MIT and Apache-2.0.
|
||||
|
||||
MIT: https://www.opensource.org/licenses/mit
|
||||
Apache-2.0: https://www.apache.org/licenses/license-2.0
|
249
node_modules/multiformats/README.md
generated
vendored
Normal file
249
node_modules/multiformats/README.md
generated
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
[](http://multiformats.io)
|
||||
[](https://codecov.io/gh/multiformats/js-multiformats)
|
||||
[](https://github.com/multiformats/js-multiformats/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
|
||||
|
||||
> Interface for multihash, multicodec, multibase and CID
|
||||
|
||||
# About
|
||||
|
||||
<!--
|
||||
|
||||
!IMPORTANT!
|
||||
|
||||
Everything in this README between "# About" and "# Install" is automatically
|
||||
generated and will be overwritten the next time the doc generator is run.
|
||||
|
||||
To make changes to this section, please update the @packageDocumentation section
|
||||
of src/index.js or src/index.ts
|
||||
|
||||
To experiment with formatting, please run "npm run docs" from the root of this
|
||||
repo and examine the changes made.
|
||||
|
||||
-->
|
||||
|
||||
This library defines common interfaces and low level building blocks for various interrelated multiformat technologies (multicodec, multihash, multibase, and CID). They can be used to implement custom base encoders / decoders / codecs, codec encoders /decoders and multihash hashers that comply to the interface that layers above assume.
|
||||
|
||||
This library provides implementations for most basics and many others can be found in linked repositories.
|
||||
|
||||
```TypeScript
|
||||
import { CID } from 'multiformats/cid'
|
||||
import * as json from 'multiformats/codecs/json'
|
||||
import { sha256 } from 'multiformats/hashes/sha2'
|
||||
|
||||
const bytes = json.encode({ hello: 'world' })
|
||||
|
||||
const hash = await sha256.digest(bytes)
|
||||
const cid = CID.create(1, json.code, hash)
|
||||
//> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)
|
||||
```
|
||||
|
||||
## Creating Blocks
|
||||
|
||||
```TypeScript
|
||||
import * as Block from 'multiformats/block'
|
||||
import * as codec from '@ipld/dag-cbor'
|
||||
import { sha256 as hasher } from 'multiformats/hashes/sha2'
|
||||
|
||||
const value = { hello: 'world' }
|
||||
|
||||
// encode a block
|
||||
let block = await Block.encode({ value, codec, hasher })
|
||||
|
||||
block.value // { hello: 'world' }
|
||||
block.bytes // Uint8Array
|
||||
block.cid // CID() w/ sha2-256 hash address and dag-cbor codec
|
||||
|
||||
// you can also decode blocks from their binary state
|
||||
block = await Block.decode({ bytes: block.bytes, codec, hasher })
|
||||
|
||||
// if you have the cid you can also verify the hash on decode
|
||||
block = await Block.create({ bytes: block.bytes, cid: block.cid, codec, hasher })
|
||||
```
|
||||
|
||||
## Multibase Encoders / Decoders / Codecs
|
||||
|
||||
CIDs can be serialized to string representation using multibase encoders that implement [`MultibaseEncoder`](https://github.com/multiformats/js-multiformats/blob/master/src/bases/interface.ts) interface. This library provides quite a few implementations that can be imported:
|
||||
|
||||
```TypeScript
|
||||
import { base64 } from "multiformats/bases/base64"
|
||||
cid.toString(base64.encoder)
|
||||
//> 'mAYAEEiCTojlxqRTl6svwqNJRVM2jCcPBxy+7mRTUfGDzy2gViA'
|
||||
```
|
||||
|
||||
Parsing CID string serialized CIDs requires multibase decoder that implements [`MultibaseDecoder`](https://github.com/multiformats/js-multiformats/blob/master/src/bases/interface.ts) interface. This library provides a decoder for every encoder it provides:
|
||||
|
||||
```TypeScript
|
||||
CID.parse('mAYAEEiCTojlxqRTl6svwqNJRVM2jCcPBxy+7mRTUfGDzy2gViA', base64.decoder)
|
||||
//> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)
|
||||
```
|
||||
|
||||
Dual of multibase encoder & decoder is defined as multibase codec and it exposes
|
||||
them as `encoder` and `decoder` properties. For added convenience codecs also
|
||||
implement `MultibaseEncoder` and `MultibaseDecoder` interfaces so they could be
|
||||
used as either or both:
|
||||
|
||||
```TypeScript
|
||||
cid.toString(base64)
|
||||
CID.parse(cid.toString(base64), base64)
|
||||
```
|
||||
|
||||
**Note:** CID implementation comes bundled with `base32` and `base58btc`
|
||||
multibase codecs so that CIDs can be base serialized to (version specific)
|
||||
default base encoding and parsed without having to supply base encoders/decoders:
|
||||
|
||||
```TypeScript
|
||||
const v1 = CID.parse('bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea')
|
||||
v1.toString()
|
||||
//> 'bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea'
|
||||
|
||||
const v0 = CID.parse('QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')
|
||||
v0.toString()
|
||||
//> 'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n'
|
||||
v0.toV1().toString()
|
||||
//> 'bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku'
|
||||
```
|
||||
|
||||
## Multicodec Encoders / Decoders / Codecs
|
||||
|
||||
This library defines [`BlockEncoder`, `BlockDecoder` and `BlockCodec` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts).
|
||||
Codec implementations should conform to the `BlockCodec` interface which implements both `BlockEncoder` and `BlockDecoder`.
|
||||
Here is an example implementation of JSON `BlockCodec`.
|
||||
|
||||
```TypeScript
|
||||
export const { name, code, encode, decode } = {
|
||||
name: 'json',
|
||||
code: 0x0200,
|
||||
encode: json => new TextEncoder().encode(JSON.stringify(json)),
|
||||
decode: bytes => JSON.parse(new TextDecoder().decode(bytes))
|
||||
}
|
||||
```
|
||||
|
||||
## Multihash Hashers
|
||||
|
||||
This library defines [`MultihashHasher` and `MultihashDigest` interfaces](https://github.com/multiformats/js-multiformats/blob/master/src/hashes/interface.ts) and convinient function for implementing them:
|
||||
|
||||
```TypeScript
|
||||
import * as hasher from 'multiformats/hashes/hasher'
|
||||
|
||||
const sha256 = hasher.from({
|
||||
// As per multiformats table
|
||||
// https://github.com/multiformats/multicodec/blob/master/table.csv#L9
|
||||
name: 'sha2-256',
|
||||
code: 0x12,
|
||||
|
||||
encode: (input) => new Uint8Array(crypto.createHash('sha256').update(input).digest())
|
||||
})
|
||||
|
||||
const hash = await sha256.digest(json.encode({ hello: 'world' }))
|
||||
CID.create(1, json.code, hash)
|
||||
|
||||
//> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)
|
||||
```
|
||||
|
||||
## Traversal
|
||||
|
||||
This library contains higher-order functions for traversing graphs of data easily.
|
||||
|
||||
`walk()` walks through the links in each block of a DAG calling a user-supplied loader function for each one, in depth-first order with no duplicate block visits. The loader should return a `Block` object and can be used to inspect and collect block ordering for a full DAG walk. The loader should `throw` on error, and return `null` if a block should be skipped by `walk()`.
|
||||
|
||||
```TypeScript
|
||||
import { walk } from 'multiformats/traversal'
|
||||
import * as Block from 'multiformats/block'
|
||||
import * as codec from 'multiformats/codecs/json'
|
||||
import { sha256 as hasher } from 'multiformats/hashes/sha2'
|
||||
|
||||
// build a DAG (a single block for this simple example)
|
||||
const value = { hello: 'world' }
|
||||
const block = await Block.encode({ value, codec, hasher })
|
||||
const { cid } = block
|
||||
console.log(cid)
|
||||
//> CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)
|
||||
|
||||
// create a loader function that also collects CIDs of blocks in
|
||||
// their traversal order
|
||||
const load = (cid, blocks) => async (cid) => {
|
||||
// fetch a block using its cid
|
||||
// e.g.: const block = await fetchBlockByCID(cid)
|
||||
blocks.push(cid)
|
||||
return block
|
||||
}
|
||||
|
||||
// collect blocks in this DAG starting from the root `cid`
|
||||
const blocks = []
|
||||
await walk({ cid, load: load(cid, blocks) })
|
||||
|
||||
console.log(blocks)
|
||||
//> [CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)]
|
||||
```
|
||||
|
||||
## Legacy interface
|
||||
|
||||
[`blockcodec-to-ipld-format`](https://github.com/ipld/js-blockcodec-to-ipld-format) converts a multiformats [`BlockCodec`](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts#L21) into an
|
||||
[`interface-ipld-format`](https://github.com/ipld/interface-ipld-format) for use with the [`ipld`](https://github.com/ipld/ipld) package. This can help bridge IPLD codecs implemented using the structure and interfaces defined here to existing code that assumes, or requires `interface-ipld-format`. This bridge also includes the relevant TypeScript definitions.
|
||||
|
||||
## Implementations
|
||||
|
||||
By default, no base encodings (other than base32 & base58btc), hash functions,
|
||||
or codec implementations are exposed by `multiformats`, you need to
|
||||
import the ones you need yourself.
|
||||
|
||||
### Multibase codecs
|
||||
|
||||
| bases | import | repo |
|
||||
| ------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------- |
|
||||
| `base16` | `multiformats/bases/base16` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |
|
||||
| `base32`, `base32pad`, `base32hex`, `base32hexpad`, `base32z` | `multiformats/bases/base32` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |
|
||||
| `base64`, `base64pad`, `base64url`, `base64urlpad` | `multiformats/bases/base64` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |
|
||||
| `base58btc`, `base58flick4` | `multiformats/bases/base58` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) |
|
||||
|
||||
Other (less useful) bases implemented in [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) include: `base2`, `base8`, `base10`, `base36` and `base256emoji`.
|
||||
|
||||
### Multihash hashers
|
||||
|
||||
| hashes | import | repo |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| `sha2-256`, `sha2-512` | `multiformats/hashes/sha2` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/hashes) |
|
||||
| `sha3-224`, `sha3-256`, `sha3-384`,`sha3-512`, `shake-128`, `shake-256`, `keccak-224`, `keccak-256`, `keccak-384`, `keccak-512` | `@multiformats/sha3` | [multiformats/js-sha3](https://github.com/multiformats/js-sha3) |
|
||||
| `identity` | `multiformats/hashes/identity` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/hashes/identity.js) |
|
||||
| `murmur3-128`, `murmur3-32` | `@multiformats/murmur3` | [multiformats/js-murmur3](https://github.com/multiformats/js-murmur3) |
|
||||
| `blake2b-*`, `blake2s-*` | `@multiformats/blake2` | [multiformats/js-blake2](https://github.com/multiformats/js-blake2) |
|
||||
|
||||
### IPLD codecs (multicodec)
|
||||
|
||||
| codec | import | repo |
|
||||
| ---------- | -------------------------- | ------------------------------------------------------------------------------------------------------ |
|
||||
| `raw` | `multiformats/codecs/raw` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/codecs) |
|
||||
| `json` | `multiformats/codecs/json` | [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/src/codecs) |
|
||||
| `dag-cbor` | `@ipld/dag-cbor` | [ipld/js-dag-cbor](https://github.com/ipld/js-dag-cbor) |
|
||||
| `dag-json` | `@ipld/dag-json` | [ipld/js-dag-json](https://github.com/ipld/js-dag-json) |
|
||||
| `dag-pb` | `@ipld/dag-pb` | [ipld/js-dag-pb](https://github.com/ipld/js-dag-pb) |
|
||||
| `dag-jose` | `dag-jose` | [ceramicnetwork/js-dag-jose](https://github.com/ceramicnetwork/js-dag-jose) |
|
||||
|
||||
# Install
|
||||
|
||||
```console
|
||||
$ npm i multiformats
|
||||
```
|
||||
|
||||
## Browser `<script>` tag
|
||||
|
||||
Loading this module through a script tag will make it's exports available as `Multiformats` in the global namespace.
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/multiformats/dist/index.min.js"></script>
|
||||
```
|
||||
|
||||
# API Docs
|
||||
|
||||
- <https://multiformats.github.io/js-multiformats>
|
||||
|
||||
# License
|
||||
|
||||
Licensed under either of
|
||||
|
||||
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
||||
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
||||
|
||||
# Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|
3
node_modules/multiformats/dist/index.min.js
generated
vendored
Normal file
3
node_modules/multiformats/dist/index.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
74
node_modules/multiformats/dist/src/bases/base.d.ts
generated
vendored
Normal file
74
node_modules/multiformats/dist/src/bases/base.d.ts
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
import type { BaseCodec, BaseDecoder, BaseEncoder, CombobaseDecoder, Multibase, MultibaseCodec, MultibaseDecoder, MultibaseEncoder, UnibaseDecoder } from './interface.js';
|
||||
interface EncodeFn {
|
||||
(bytes: Uint8Array): string;
|
||||
}
|
||||
interface DecodeFn {
|
||||
(text: string): Uint8Array;
|
||||
}
|
||||
/**
|
||||
* Class represents both BaseEncoder and MultibaseEncoder meaning it
|
||||
* can be used to encode to multibase or base encode without multibase
|
||||
* prefix.
|
||||
*/
|
||||
declare class Encoder<Base extends string, Prefix extends string> implements MultibaseEncoder<Prefix>, BaseEncoder {
|
||||
readonly name: Base;
|
||||
readonly prefix: Prefix;
|
||||
readonly baseEncode: EncodeFn;
|
||||
constructor(name: Base, prefix: Prefix, baseEncode: EncodeFn);
|
||||
encode(bytes: Uint8Array): Multibase<Prefix>;
|
||||
}
|
||||
/**
|
||||
* Class represents both BaseDecoder and MultibaseDecoder so it could be used
|
||||
* to decode multibases (with matching prefix) or just base decode strings
|
||||
* with corresponding base encoding.
|
||||
*/
|
||||
declare class Decoder<Base extends string, Prefix extends string> implements MultibaseDecoder<Prefix>, UnibaseDecoder<Prefix>, BaseDecoder {
|
||||
readonly name: Base;
|
||||
readonly prefix: Prefix;
|
||||
readonly baseDecode: DecodeFn;
|
||||
private readonly prefixCodePoint;
|
||||
constructor(name: Base, prefix: Prefix, baseDecode: DecodeFn);
|
||||
decode(text: string): Uint8Array;
|
||||
or<OtherPrefix extends string>(decoder: UnibaseDecoder<OtherPrefix> | ComposedDecoder<OtherPrefix>): ComposedDecoder<Prefix | OtherPrefix>;
|
||||
}
|
||||
type Decoders<Prefix extends string> = Record<Prefix, UnibaseDecoder<Prefix>>;
|
||||
declare class ComposedDecoder<Prefix extends string> implements MultibaseDecoder<Prefix>, CombobaseDecoder<Prefix> {
|
||||
readonly decoders: Decoders<Prefix>;
|
||||
constructor(decoders: Decoders<Prefix>);
|
||||
or<OtherPrefix extends string>(decoder: UnibaseDecoder<OtherPrefix> | ComposedDecoder<OtherPrefix>): ComposedDecoder<Prefix | OtherPrefix>;
|
||||
decode(input: string): Uint8Array;
|
||||
}
|
||||
export declare function or<L extends string, R extends string>(left: UnibaseDecoder<L> | CombobaseDecoder<L>, right: UnibaseDecoder<R> | CombobaseDecoder<R>): ComposedDecoder<L | R>;
|
||||
export declare class Codec<Base extends string, Prefix extends string> implements MultibaseCodec<Prefix>, MultibaseEncoder<Prefix>, MultibaseDecoder<Prefix>, BaseCodec, BaseEncoder, BaseDecoder {
|
||||
readonly name: Base;
|
||||
readonly prefix: Prefix;
|
||||
readonly baseEncode: EncodeFn;
|
||||
readonly baseDecode: DecodeFn;
|
||||
readonly encoder: Encoder<Base, Prefix>;
|
||||
readonly decoder: Decoder<Base, Prefix>;
|
||||
constructor(name: Base, prefix: Prefix, baseEncode: EncodeFn, baseDecode: DecodeFn);
|
||||
encode(input: Uint8Array): string;
|
||||
decode(input: string): Uint8Array;
|
||||
}
|
||||
export declare function from<Base extends string, Prefix extends string>({ name, prefix, encode, decode }: {
|
||||
name: Base;
|
||||
prefix: Prefix;
|
||||
encode: EncodeFn;
|
||||
decode: DecodeFn;
|
||||
}): Codec<Base, Prefix>;
|
||||
export declare function baseX<Base extends string, Prefix extends string>({ name, prefix, alphabet }: {
|
||||
name: Base;
|
||||
prefix: Prefix;
|
||||
alphabet: string;
|
||||
}): Codec<Base, Prefix>;
|
||||
/**
|
||||
* RFC4648 Factory
|
||||
*/
|
||||
export declare function rfc4648<Base extends string, Prefix extends string>({ name, prefix, bitsPerChar, alphabet }: {
|
||||
name: Base;
|
||||
prefix: Prefix;
|
||||
bitsPerChar: number;
|
||||
alphabet: string;
|
||||
}): Codec<Base, Prefix>;
|
||||
export {};
|
||||
//# sourceMappingURL=base.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/bases/base.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE1K,UAAU,QAAQ;IAAG,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAA;CAAE;AAClD,UAAU,QAAQ;IAAG,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE;AAEjD;;;;GAIG;AACH,cAAM,OAAO,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,CAAE,YAAW,gBAAgB,CAAC,MAAM,CAAC,EAAE,WAAW;IACxG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAA;gBAEhB,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ;IAM7D,MAAM,CAAE,KAAK,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A;CAAE,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAE5L;AAED,wBAAgB,KAAK,CAAE,IAAI,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,EAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAQrK;AAkFD;;GAEG;AACH,wBAAgB,OAAO,CAAE,IAAI,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,EAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAWzM"}
|
202
node_modules/multiformats/dist/src/bases/base.js
generated
vendored
Normal file
202
node_modules/multiformats/dist/src/bases/base.js
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
import { coerce } from '../bytes.js';
|
||||
import basex from '../vendor/base-x.js';
|
||||
/**
|
||||
* Class represents both BaseEncoder and MultibaseEncoder meaning it
|
||||
* can be used to encode to multibase or base encode without multibase
|
||||
* prefix.
|
||||
*/
|
||||
class Encoder {
|
||||
name;
|
||||
prefix;
|
||||
baseEncode;
|
||||
constructor(name, prefix, baseEncode) {
|
||||
this.name = name;
|
||||
this.prefix = prefix;
|
||||
this.baseEncode = baseEncode;
|
||||
}
|
||||
encode(bytes) {
|
||||
if (bytes instanceof Uint8Array) {
|
||||
return `${this.prefix}${this.baseEncode(bytes)}`;
|
||||
}
|
||||
else {
|
||||
throw Error('Unknown type, must be binary type');
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Class represents both BaseDecoder and MultibaseDecoder so it could be used
|
||||
* to decode multibases (with matching prefix) or just base decode strings
|
||||
* with corresponding base encoding.
|
||||
*/
|
||||
class Decoder {
|
||||
name;
|
||||
prefix;
|
||||
baseDecode;
|
||||
prefixCodePoint;
|
||||
constructor(name, prefix, baseDecode) {
|
||||
this.name = name;
|
||||
this.prefix = prefix;
|
||||
/* c8 ignore next 3 */
|
||||
if (prefix.codePointAt(0) === undefined) {
|
||||
throw new Error('Invalid prefix character');
|
||||
}
|
||||
this.prefixCodePoint = prefix.codePointAt(0);
|
||||
this.baseDecode = baseDecode;
|
||||
}
|
||||
decode(text) {
|
||||
if (typeof text === 'string') {
|
||||
if (text.codePointAt(0) !== this.prefixCodePoint) {
|
||||
throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
|
||||
}
|
||||
return this.baseDecode(text.slice(this.prefix.length));
|
||||
}
|
||||
else {
|
||||
throw Error('Can only multibase decode strings');
|
||||
}
|
||||
}
|
||||
or(decoder) {
|
||||
return or(this, decoder);
|
||||
}
|
||||
}
|
||||
class ComposedDecoder {
|
||||
decoders;
|
||||
constructor(decoders) {
|
||||
this.decoders = decoders;
|
||||
}
|
||||
or(decoder) {
|
||||
return or(this, decoder);
|
||||
}
|
||||
decode(input) {
|
||||
const prefix = input[0];
|
||||
const decoder = this.decoders[prefix];
|
||||
if (decoder != null) {
|
||||
return decoder.decode(input);
|
||||
}
|
||||
else {
|
||||
throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
|
||||
}
|
||||
}
|
||||
}
|
||||
export function or(left, right) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
return new ComposedDecoder({
|
||||
...(left.decoders ?? { [left.prefix]: left }),
|
||||
...(right.decoders ?? { [right.prefix]: right })
|
||||
});
|
||||
}
|
||||
export class Codec {
|
||||
name;
|
||||
prefix;
|
||||
baseEncode;
|
||||
baseDecode;
|
||||
encoder;
|
||||
decoder;
|
||||
constructor(name, prefix, baseEncode, baseDecode) {
|
||||
this.name = name;
|
||||
this.prefix = prefix;
|
||||
this.baseEncode = baseEncode;
|
||||
this.baseDecode = baseDecode;
|
||||
this.encoder = new Encoder(name, prefix, baseEncode);
|
||||
this.decoder = new Decoder(name, prefix, baseDecode);
|
||||
}
|
||||
encode(input) {
|
||||
return this.encoder.encode(input);
|
||||
}
|
||||
decode(input) {
|
||||
return this.decoder.decode(input);
|
||||
}
|
||||
}
|
||||
export function from({ name, prefix, encode, decode }) {
|
||||
return new Codec(name, prefix, encode, decode);
|
||||
}
|
||||
export function baseX({ name, prefix, alphabet }) {
|
||||
const { encode, decode } = basex(alphabet, name);
|
||||
return from({
|
||||
prefix,
|
||||
name,
|
||||
encode,
|
||||
decode: (text) => coerce(decode(text))
|
||||
});
|
||||
}
|
||||
function decode(string, alphabet, bitsPerChar, name) {
|
||||
// Build the character lookup table:
|
||||
const codes = {};
|
||||
for (let i = 0; i < alphabet.length; ++i) {
|
||||
codes[alphabet[i]] = i;
|
||||
}
|
||||
// Count the padding bytes:
|
||||
let end = string.length;
|
||||
while (string[end - 1] === '=') {
|
||||
--end;
|
||||
}
|
||||
// Allocate the output:
|
||||
const out = new Uint8Array((end * bitsPerChar / 8) | 0);
|
||||
// Parse the data:
|
||||
let bits = 0; // Number of bits currently in the buffer
|
||||
let buffer = 0; // Bits waiting to be written out, MSB first
|
||||
let written = 0; // Next byte to write
|
||||
for (let i = 0; i < end; ++i) {
|
||||
// Read one character from the string:
|
||||
const value = codes[string[i]];
|
||||
if (value === undefined) {
|
||||
throw new SyntaxError(`Non-${name} character`);
|
||||
}
|
||||
// Append the bits to the buffer:
|
||||
buffer = (buffer << bitsPerChar) | value;
|
||||
bits += bitsPerChar;
|
||||
// Write out some bits if the buffer has a byte's worth:
|
||||
if (bits >= 8) {
|
||||
bits -= 8;
|
||||
out[written++] = 0xff & (buffer >> bits);
|
||||
}
|
||||
}
|
||||
// Verify that we have received just enough bits:
|
||||
if (bits >= bitsPerChar || (0xff & (buffer << (8 - bits))) !== 0) {
|
||||
throw new SyntaxError('Unexpected end of data');
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function encode(data, alphabet, bitsPerChar) {
|
||||
const pad = alphabet[alphabet.length - 1] === '=';
|
||||
const mask = (1 << bitsPerChar) - 1;
|
||||
let out = '';
|
||||
let bits = 0; // Number of bits currently in the buffer
|
||||
let buffer = 0; // Bits waiting to be written out, MSB first
|
||||
for (let i = 0; i < data.length; ++i) {
|
||||
// Slurp data into the buffer:
|
||||
buffer = (buffer << 8) | data[i];
|
||||
bits += 8;
|
||||
// Write out as much as we can:
|
||||
while (bits > bitsPerChar) {
|
||||
bits -= bitsPerChar;
|
||||
out += alphabet[mask & (buffer >> bits)];
|
||||
}
|
||||
}
|
||||
// Partial character:
|
||||
if (bits !== 0) {
|
||||
out += alphabet[mask & (buffer << (bitsPerChar - bits))];
|
||||
}
|
||||
// Add padding characters until we hit a byte boundary:
|
||||
if (pad) {
|
||||
while (((out.length * bitsPerChar) & 7) !== 0) {
|
||||
out += '=';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* RFC4648 Factory
|
||||
*/
|
||||
export function rfc4648({ name, prefix, bitsPerChar, alphabet }) {
|
||||
return from({
|
||||
prefix,
|
||||
name,
|
||||
encode(input) {
|
||||
return encode(input, alphabet, bitsPerChar);
|
||||
},
|
||||
decode(input) {
|
||||
return decode(input, alphabet, bitsPerChar, name);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=base.js.map
|
1
node_modules/multiformats/dist/src/bases/base.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/multiformats/dist/src/bases/base10.d.ts
generated
vendored
Normal file
2
node_modules/multiformats/dist/src/bases/base10.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare const base10: import("./base.js").Codec<"base10", "9">;
|
||||
//# sourceMappingURL=base10.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base10.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base10.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base10.d.ts","sourceRoot":"","sources":["../../../src/bases/base10.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,0CAIjB,CAAA"}
|
7
node_modules/multiformats/dist/src/bases/base10.js
generated
vendored
Normal file
7
node_modules/multiformats/dist/src/bases/base10.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import { baseX } from './base.js';
|
||||
export const base10 = baseX({
|
||||
prefix: '9',
|
||||
name: 'base10',
|
||||
alphabet: '0123456789'
|
||||
});
|
||||
//# sourceMappingURL=base10.js.map
|
1
node_modules/multiformats/dist/src/bases/base10.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base10.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base10.js","sourceRoot":"","sources":["../../../src/bases/base10.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC;IAC1B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,YAAY;CACvB,CAAC,CAAA"}
|
3
node_modules/multiformats/dist/src/bases/base16.d.ts
generated
vendored
Normal file
3
node_modules/multiformats/dist/src/bases/base16.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export declare const base16: import("./base.js").Codec<"base16", "f">;
|
||||
export declare const base16upper: import("./base.js").Codec<"base16upper", "F">;
|
||||
//# sourceMappingURL=base16.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base16.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base16.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base16.d.ts","sourceRoot":"","sources":["../../../src/bases/base16.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,0CAKjB,CAAA;AAEF,eAAO,MAAM,WAAW,+CAKtB,CAAA"}
|
14
node_modules/multiformats/dist/src/bases/base16.js
generated
vendored
Normal file
14
node_modules/multiformats/dist/src/bases/base16.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import { rfc4648 } from './base.js';
|
||||
export const base16 = rfc4648({
|
||||
prefix: 'f',
|
||||
name: 'base16',
|
||||
alphabet: '0123456789abcdef',
|
||||
bitsPerChar: 4
|
||||
});
|
||||
export const base16upper = rfc4648({
|
||||
prefix: 'F',
|
||||
name: 'base16upper',
|
||||
alphabet: '0123456789ABCDEF',
|
||||
bitsPerChar: 4
|
||||
});
|
||||
//# sourceMappingURL=base16.js.map
|
1
node_modules/multiformats/dist/src/bases/base16.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base16.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base16.js","sourceRoot":"","sources":["../../../src/bases/base16.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,kBAAkB;IAC5B,WAAW,EAAE,CAAC;CACf,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;IACjC,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,kBAAkB;IAC5B,WAAW,EAAE,CAAC;CACf,CAAC,CAAA"}
|
2
node_modules/multiformats/dist/src/bases/base2.d.ts
generated
vendored
Normal file
2
node_modules/multiformats/dist/src/bases/base2.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare const base2: import("./base.js").Codec<"base2", "0">;
|
||||
//# sourceMappingURL=base2.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base2.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base2.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base2.d.ts","sourceRoot":"","sources":["../../../src/bases/base2.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yCAKhB,CAAA"}
|
8
node_modules/multiformats/dist/src/bases/base2.js
generated
vendored
Normal file
8
node_modules/multiformats/dist/src/bases/base2.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import { rfc4648 } from './base.js';
|
||||
export const base2 = rfc4648({
|
||||
prefix: '0',
|
||||
name: 'base2',
|
||||
alphabet: '01',
|
||||
bitsPerChar: 1
|
||||
});
|
||||
//# sourceMappingURL=base2.js.map
|
1
node_modules/multiformats/dist/src/bases/base2.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base2.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base2.js","sourceRoot":"","sources":["../../../src/bases/base2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,CAAC;CACf,CAAC,CAAA"}
|
2
node_modules/multiformats/dist/src/bases/base256emoji.d.ts
generated
vendored
Normal file
2
node_modules/multiformats/dist/src/bases/base256emoji.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare const base256emoji: import("./base.js").Codec<"base256emoji", "🚀">;
|
||||
//# sourceMappingURL=base256emoji.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base256emoji.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base256emoji.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base256emoji.d.ts","sourceRoot":"","sources":["../../../src/bases/base256emoji.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,YAAY,iDAKvB,CAAA"}
|
28
node_modules/multiformats/dist/src/bases/base256emoji.js
generated
vendored
Normal file
28
node_modules/multiformats/dist/src/bases/base256emoji.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
import { from } from './base.js';
|
||||
const alphabet = Array.from('🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂');
|
||||
const alphabetBytesToChars = (alphabet.reduce((p, c, i) => { p[i] = c; return p; }, ([])));
|
||||
const alphabetCharsToBytes = (alphabet.reduce((p, c, i) => { p[c.codePointAt(0)] = i; return p; }, ([])));
|
||||
function encode(data) {
|
||||
return data.reduce((p, c) => {
|
||||
p += alphabetBytesToChars[c];
|
||||
return p;
|
||||
}, '');
|
||||
}
|
||||
function decode(str) {
|
||||
const byts = [];
|
||||
for (const char of str) {
|
||||
const byt = alphabetCharsToBytes[char.codePointAt(0)];
|
||||
if (byt === undefined) {
|
||||
throw new Error(`Non-base256emoji character: ${char}`);
|
||||
}
|
||||
byts.push(byt);
|
||||
}
|
||||
return new Uint8Array(byts);
|
||||
}
|
||||
export const base256emoji = from({
|
||||
prefix: '🚀',
|
||||
name: 'base256emoji',
|
||||
encode,
|
||||
decode
|
||||
});
|
||||
//# sourceMappingURL=base256emoji.js.map
|
1
node_modules/multiformats/dist/src/bases/base256emoji.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base256emoji.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base256emoji.js","sourceRoot":"","sources":["../../../src/bases/base256emoji.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,weAAwe,CAAC,CAAA;AACrgB,MAAM,oBAAoB,GAAa,CAAC,QAAQ,CAAC,MAAM,CAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC7G,MAAM,oBAAoB,GAAa,CAAC,QAAQ,CAAC,MAAM,CAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAW,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAEtI,SAAS,MAAM,CAAE,IAAgB;IAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAA;QAC5B,OAAO,CAAC,CAAA;IACV,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC;AAED,SAAS,MAAM,CAAE,GAAW;IAC1B,MAAM,IAAI,GAAG,EAAE,CAAA;IACf,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAW,CAAC,CAAA;QAC/D,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAA;QACxD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChB,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;AAC7B,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,cAAc;IACpB,MAAM;IACN,MAAM;CACP,CAAC,CAAA"}
|
10
node_modules/multiformats/dist/src/bases/base32.d.ts
generated
vendored
Normal file
10
node_modules/multiformats/dist/src/bases/base32.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export declare const base32: import("./base.js").Codec<"base32", "b">;
|
||||
export declare const base32upper: import("./base.js").Codec<"base32upper", "B">;
|
||||
export declare const base32pad: import("./base.js").Codec<"base32pad", "c">;
|
||||
export declare const base32padupper: import("./base.js").Codec<"base32padupper", "C">;
|
||||
export declare const base32hex: import("./base.js").Codec<"base32hex", "v">;
|
||||
export declare const base32hexupper: import("./base.js").Codec<"base32hexupper", "V">;
|
||||
export declare const base32hexpad: import("./base.js").Codec<"base32hexpad", "t">;
|
||||
export declare const base32hexpadupper: import("./base.js").Codec<"base32hexpadupper", "T">;
|
||||
export declare const base32z: import("./base.js").Codec<"base32z", "h">;
|
||||
//# sourceMappingURL=base32.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base32.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base32.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base32.d.ts","sourceRoot":"","sources":["../../../src/bases/base32.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,0CAKjB,CAAA;AAEF,eAAO,MAAM,WAAW,+CAKtB,CAAA;AAEF,eAAO,MAAM,SAAS,6CAKpB,CAAA;AAEF,eAAO,MAAM,cAAc,kDAKzB,CAAA;AAEF,eAAO,MAAM,SAAS,6CAKpB,CAAA;AAEF,eAAO,MAAM,cAAc,kDAKzB,CAAA;AAEF,eAAO,MAAM,YAAY,gDAKvB,CAAA;AAEF,eAAO,MAAM,iBAAiB,qDAK5B,CAAA;AAEF,eAAO,MAAM,OAAO,2CAKlB,CAAA"}
|
56
node_modules/multiformats/dist/src/bases/base32.js
generated
vendored
Normal file
56
node_modules/multiformats/dist/src/bases/base32.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
import { rfc4648 } from './base.js';
|
||||
export const base32 = rfc4648({
|
||||
prefix: 'b',
|
||||
name: 'base32',
|
||||
alphabet: 'abcdefghijklmnopqrstuvwxyz234567',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32upper = rfc4648({
|
||||
prefix: 'B',
|
||||
name: 'base32upper',
|
||||
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32pad = rfc4648({
|
||||
prefix: 'c',
|
||||
name: 'base32pad',
|
||||
alphabet: 'abcdefghijklmnopqrstuvwxyz234567=',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32padupper = rfc4648({
|
||||
prefix: 'C',
|
||||
name: 'base32padupper',
|
||||
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32hex = rfc4648({
|
||||
prefix: 'v',
|
||||
name: 'base32hex',
|
||||
alphabet: '0123456789abcdefghijklmnopqrstuv',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32hexupper = rfc4648({
|
||||
prefix: 'V',
|
||||
name: 'base32hexupper',
|
||||
alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32hexpad = rfc4648({
|
||||
prefix: 't',
|
||||
name: 'base32hexpad',
|
||||
alphabet: '0123456789abcdefghijklmnopqrstuv=',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32hexpadupper = rfc4648({
|
||||
prefix: 'T',
|
||||
name: 'base32hexpadupper',
|
||||
alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
export const base32z = rfc4648({
|
||||
prefix: 'h',
|
||||
name: 'base32z',
|
||||
alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769',
|
||||
bitsPerChar: 5
|
||||
});
|
||||
//# sourceMappingURL=base32.js.map
|
1
node_modules/multiformats/dist/src/bases/base32.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base32.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base32.js","sourceRoot":"","sources":["../../../src/bases/base32.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,kCAAkC;IAC5C,WAAW,EAAE,CAAC;CACf,CAAC,CAAA;AAEF,MAAM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,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,kCAAkC;IAC5C,WAAW,EAAE,CAAC;CACf,CAAC,CAAA"}
|
3
node_modules/multiformats/dist/src/bases/base36.d.ts
generated
vendored
Normal file
3
node_modules/multiformats/dist/src/bases/base36.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export declare const base36: import("./base.js").Codec<"base36", "k">;
|
||||
export declare const base36upper: import("./base.js").Codec<"base36upper", "K">;
|
||||
//# sourceMappingURL=base36.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base36.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base36.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base36.d.ts","sourceRoot":"","sources":["../../../src/bases/base36.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,0CAIjB,CAAA;AAEF,eAAO,MAAM,WAAW,+CAItB,CAAA"}
|
12
node_modules/multiformats/dist/src/bases/base36.js
generated
vendored
Normal file
12
node_modules/multiformats/dist/src/bases/base36.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { baseX } from './base.js';
|
||||
export const base36 = baseX({
|
||||
prefix: 'k',
|
||||
name: 'base36',
|
||||
alphabet: '0123456789abcdefghijklmnopqrstuvwxyz'
|
||||
});
|
||||
export const base36upper = baseX({
|
||||
prefix: 'K',
|
||||
name: 'base36upper',
|
||||
alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
});
|
||||
//# sourceMappingURL=base36.js.map
|
1
node_modules/multiformats/dist/src/bases/base36.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base36.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base36.js","sourceRoot":"","sources":["../../../src/bases/base36.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC;IAC1B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,sCAAsC;CACjD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC;IAC/B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,sCAAsC;CACjD,CAAC,CAAA"}
|
3
node_modules/multiformats/dist/src/bases/base58.d.ts
generated
vendored
Normal file
3
node_modules/multiformats/dist/src/bases/base58.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export declare const base58btc: import("./base.js").Codec<"base58btc", "z">;
|
||||
export declare const base58flickr: import("./base.js").Codec<"base58flickr", "Z">;
|
||||
//# sourceMappingURL=base58.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base58.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base58.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../../src/bases/base58.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,6CAIpB,CAAA;AAEF,eAAO,MAAM,YAAY,gDAIvB,CAAA"}
|
12
node_modules/multiformats/dist/src/bases/base58.js
generated
vendored
Normal file
12
node_modules/multiformats/dist/src/bases/base58.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { baseX } from './base.js';
|
||||
export const base58btc = baseX({
|
||||
name: 'base58btc',
|
||||
prefix: 'z',
|
||||
alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
||||
});
|
||||
export const base58flickr = baseX({
|
||||
name: 'base58flickr',
|
||||
prefix: 'Z',
|
||||
alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
|
||||
});
|
||||
//# sourceMappingURL=base58.js.map
|
1
node_modules/multiformats/dist/src/bases/base58.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base58.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base58.js","sourceRoot":"","sources":["../../../src/bases/base58.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;IAC7B,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,4DAA4D;CACvE,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;IAChC,IAAI,EAAE,cAAc;IACpB,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,4DAA4D;CACvE,CAAC,CAAA"}
|
5
node_modules/multiformats/dist/src/bases/base64.d.ts
generated
vendored
Normal file
5
node_modules/multiformats/dist/src/bases/base64.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
export declare const base64: import("./base.js").Codec<"base64", "m">;
|
||||
export declare const base64pad: import("./base.js").Codec<"base64pad", "M">;
|
||||
export declare const base64url: import("./base.js").Codec<"base64url", "u">;
|
||||
export declare const base64urlpad: import("./base.js").Codec<"base64urlpad", "U">;
|
||||
//# sourceMappingURL=base64.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base64.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base64.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/bases/base64.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,0CAKjB,CAAA;AAEF,eAAO,MAAM,SAAS,6CAKpB,CAAA;AAEF,eAAO,MAAM,SAAS,6CAKpB,CAAA;AAEF,eAAO,MAAM,YAAY,gDAKvB,CAAA"}
|
26
node_modules/multiformats/dist/src/bases/base64.js
generated
vendored
Normal file
26
node_modules/multiformats/dist/src/bases/base64.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import { rfc4648 } from './base.js';
|
||||
export const base64 = rfc4648({
|
||||
prefix: 'm',
|
||||
name: 'base64',
|
||||
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
||||
bitsPerChar: 6
|
||||
});
|
||||
export const base64pad = rfc4648({
|
||||
prefix: 'M',
|
||||
name: 'base64pad',
|
||||
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
||||
bitsPerChar: 6
|
||||
});
|
||||
export const base64url = rfc4648({
|
||||
prefix: 'u',
|
||||
name: 'base64url',
|
||||
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
|
||||
bitsPerChar: 6
|
||||
});
|
||||
export const base64urlpad = rfc4648({
|
||||
prefix: 'U',
|
||||
name: 'base64urlpad',
|
||||
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=',
|
||||
bitsPerChar: 6
|
||||
});
|
||||
//# sourceMappingURL=base64.js.map
|
1
node_modules/multiformats/dist/src/bases/base64.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base64.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../../src/bases/base64.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,kEAAkE;IAC5E,WAAW,EAAE,CAAC;CACf,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,mEAAmE;IAC7E,WAAW,EAAE,CAAC;CACf,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,kEAAkE;IAC5E,WAAW,EAAE,CAAC;CACf,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;IAClC,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,mEAAmE;IAC7E,WAAW,EAAE,CAAC;CACf,CAAC,CAAA"}
|
2
node_modules/multiformats/dist/src/bases/base8.d.ts
generated
vendored
Normal file
2
node_modules/multiformats/dist/src/bases/base8.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare const base8: import("./base.js").Codec<"base8", "7">;
|
||||
//# sourceMappingURL=base8.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/base8.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base8.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base8.d.ts","sourceRoot":"","sources":["../../../src/bases/base8.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yCAKhB,CAAA"}
|
8
node_modules/multiformats/dist/src/bases/base8.js
generated
vendored
Normal file
8
node_modules/multiformats/dist/src/bases/base8.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import { rfc4648 } from './base.js';
|
||||
export const base8 = rfc4648({
|
||||
prefix: '7',
|
||||
name: 'base8',
|
||||
alphabet: '01234567',
|
||||
bitsPerChar: 3
|
||||
});
|
||||
//# sourceMappingURL=base8.js.map
|
1
node_modules/multiformats/dist/src/bases/base8.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/base8.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"base8.js","sourceRoot":"","sources":["../../../src/bases/base8.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,CAAC;CACf,CAAC,CAAA"}
|
2
node_modules/multiformats/dist/src/bases/identity.d.ts
generated
vendored
Normal file
2
node_modules/multiformats/dist/src/bases/identity.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare const identity: import("./base.js").Codec<"identity", "\0">;
|
||||
//# sourceMappingURL=identity.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/identity.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/identity.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/bases/identity.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,6CAKnB,CAAA"}
|
9
node_modules/multiformats/dist/src/bases/identity.js
generated
vendored
Normal file
9
node_modules/multiformats/dist/src/bases/identity.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { fromString, toString } from '../bytes.js';
|
||||
import { from } from './base.js';
|
||||
export const identity = from({
|
||||
prefix: '\x00',
|
||||
name: 'identity',
|
||||
encode: (buf) => toString(buf),
|
||||
decode: (str) => fromString(str)
|
||||
});
|
||||
//# sourceMappingURL=identity.js.map
|
1
node_modules/multiformats/dist/src/bases/identity.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/identity.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/bases/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC9B,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;CACjC,CAAC,CAAA"}
|
83
node_modules/multiformats/dist/src/bases/interface.d.ts
generated
vendored
Normal file
83
node_modules/multiformats/dist/src/bases/interface.d.ts
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Base encoder just encodes bytes into base encoded string.
|
||||
*/
|
||||
export interface BaseEncoder {
|
||||
/**
|
||||
* Base encodes to a **plain** (and not a multibase) string. Unlike
|
||||
* `encode` no multibase prefix is added.
|
||||
*/
|
||||
baseEncode(bytes: Uint8Array): string;
|
||||
}
|
||||
/**
|
||||
* Base decoder decodes encoded with matching base encoding into bytes.
|
||||
*/
|
||||
export interface BaseDecoder {
|
||||
/**
|
||||
* Decodes **plain** (and not a multibase) string. Unlike
|
||||
* decode
|
||||
*/
|
||||
baseDecode(text: string): Uint8Array;
|
||||
}
|
||||
/**
|
||||
* Base codec is just dual of encoder and decoder.
|
||||
*/
|
||||
export interface BaseCodec {
|
||||
encoder: BaseEncoder;
|
||||
decoder: BaseDecoder;
|
||||
}
|
||||
/**
|
||||
* Multibase represents base encoded strings with a prefix first character
|
||||
* describing it's encoding.
|
||||
*/
|
||||
export type Multibase<Prefix extends string> = string | string & {
|
||||
[0]: Prefix;
|
||||
};
|
||||
/**
|
||||
* Multibase encoder for the specific base encoding encodes bytes into
|
||||
* multibase of that encoding.
|
||||
*/
|
||||
export interface MultibaseEncoder<Prefix extends string> {
|
||||
/**
|
||||
* Name of the encoding.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Prefix character for that base encoding.
|
||||
*/
|
||||
prefix: Prefix;
|
||||
/**
|
||||
* Encodes binary data into **multibase** string (which will have a
|
||||
* prefix added).
|
||||
*/
|
||||
encode(bytes: Uint8Array): Multibase<Prefix>;
|
||||
}
|
||||
/**
|
||||
* Interface implemented by multibase decoder, that takes multibase strings
|
||||
* to bytes. It may support single encoding like base32 or multiple encodings
|
||||
* like base32, base58btc, base64. If passed multibase is incompatible it will
|
||||
* throw an exception.
|
||||
*/
|
||||
export interface MultibaseDecoder<Prefix extends string> {
|
||||
/**
|
||||
* Decodes **multibase** string (which must have a multibase prefix added).
|
||||
* If prefix does not match
|
||||
*/
|
||||
decode(multibase: Multibase<Prefix>): Uint8Array;
|
||||
}
|
||||
/**
|
||||
* Dual of multibase encoder and decoder.
|
||||
*/
|
||||
export interface MultibaseCodec<Prefix extends string> {
|
||||
name: string;
|
||||
prefix: Prefix;
|
||||
encoder: MultibaseEncoder<Prefix>;
|
||||
decoder: MultibaseDecoder<Prefix>;
|
||||
}
|
||||
export interface UnibaseDecoder<Prefix extends string> extends MultibaseDecoder<Prefix> {
|
||||
readonly decoders?: null;
|
||||
readonly prefix: Prefix;
|
||||
}
|
||||
export interface CombobaseDecoder<Prefix extends string> extends MultibaseDecoder<Prefix> {
|
||||
readonly decoders: Record<Prefix, UnibaseDecoder<Prefix>>;
|
||||
}
|
||||
//# sourceMappingURL=interface.d.ts.map
|
1
node_modules/multiformats/dist/src/bases/interface.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/interface.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/bases/interface.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAA;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GA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MAAM,CAAC,CAAC,CAAA;CAC1D"}
|
4
node_modules/multiformats/dist/src/bases/interface.js
generated
vendored
Normal file
4
node_modules/multiformats/dist/src/bases/interface.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
// Base encoders / decoders just base encode / decode between binary and
|
||||
// textual representation. They are unaware of multibase.
|
||||
export {};
|
||||
//# sourceMappingURL=interface.js.map
|
1
node_modules/multiformats/dist/src/bases/interface.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bases/interface.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/bases/interface.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,yDAAyD"}
|
45
node_modules/multiformats/dist/src/basics.d.ts
generated
vendored
Normal file
45
node_modules/multiformats/dist/src/basics.d.ts
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import * as json from './codecs/json.js';
|
||||
import * as raw from './codecs/raw.js';
|
||||
import { CID, hasher, digest, varint, bytes } from './index.js';
|
||||
export declare const bases: {
|
||||
base256emoji: import("./bases/base.js").Codec<"base256emoji", "🚀">;
|
||||
base64: import("./bases/base.js").Codec<"base64", "m">;
|
||||
base64pad: import("./bases/base.js").Codec<"base64pad", "M">;
|
||||
base64url: import("./bases/base.js").Codec<"base64url", "u">;
|
||||
base64urlpad: import("./bases/base.js").Codec<"base64urlpad", "U">;
|
||||
base58btc: import("./bases/base.js").Codec<"base58btc", "z">;
|
||||
base58flickr: import("./bases/base.js").Codec<"base58flickr", "Z">;
|
||||
base36: import("./bases/base.js").Codec<"base36", "k">;
|
||||
base36upper: import("./bases/base.js").Codec<"base36upper", "K">;
|
||||
base32: import("./bases/base.js").Codec<"base32", "b">;
|
||||
base32upper: import("./bases/base.js").Codec<"base32upper", "B">;
|
||||
base32pad: import("./bases/base.js").Codec<"base32pad", "c">;
|
||||
base32padupper: import("./bases/base.js").Codec<"base32padupper", "C">;
|
||||
base32hex: import("./bases/base.js").Codec<"base32hex", "v">;
|
||||
base32hexupper: import("./bases/base.js").Codec<"base32hexupper", "V">;
|
||||
base32hexpad: import("./bases/base.js").Codec<"base32hexpad", "t">;
|
||||
base32hexpadupper: import("./bases/base.js").Codec<"base32hexpadupper", "T">;
|
||||
base32z: import("./bases/base.js").Codec<"base32z", "h">;
|
||||
base16: import("./bases/base.js").Codec<"base16", "f">;
|
||||
base16upper: import("./bases/base.js").Codec<"base16upper", "F">;
|
||||
base10: import("./bases/base.js").Codec<"base10", "9">;
|
||||
base8: import("./bases/base.js").Codec<"base8", "7">;
|
||||
base2: import("./bases/base.js").Codec<"base2", "0">;
|
||||
identity: import("./bases/base.js").Codec<"identity", "\0">;
|
||||
};
|
||||
export declare const hashes: {
|
||||
identity: {
|
||||
code: number;
|
||||
name: string;
|
||||
encode: (input: Uint8Array) => Uint8Array;
|
||||
digest: (input: Uint8Array) => digest.Digest<0, number>;
|
||||
};
|
||||
sha256: hasher.Hasher<"sha2-256", 18>;
|
||||
sha512: hasher.Hasher<"sha2-512", 19>;
|
||||
};
|
||||
export declare const codecs: {
|
||||
raw: typeof raw;
|
||||
json: typeof json;
|
||||
};
|
||||
export { CID, hasher, digest, varint, bytes };
|
||||
//# sourceMappingURL=basics.d.ts.map
|
1
node_modules/multiformats/dist/src/basics.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/basics.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"basics.d.ts","sourceRoot":"","sources":["../../src/basics.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAA;AAGtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAE/D,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;CAA6H,CAAA;AAC/I,eAAO,MAAM,MAAM;;;;;;;;;CAA2B,CAAA;AAC9C,eAAO,MAAM,MAAM;;;CAAgB,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA"}
|
20
node_modules/multiformats/dist/src/basics.js
generated
vendored
Normal file
20
node_modules/multiformats/dist/src/basics.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import * as base10 from './bases/base10.js';
|
||||
import * as base16 from './bases/base16.js';
|
||||
import * as base2 from './bases/base2.js';
|
||||
import * as base256emoji from './bases/base256emoji.js';
|
||||
import * as base32 from './bases/base32.js';
|
||||
import * as base36 from './bases/base36.js';
|
||||
import * as base58 from './bases/base58.js';
|
||||
import * as base64 from './bases/base64.js';
|
||||
import * as base8 from './bases/base8.js';
|
||||
import * as identityBase from './bases/identity.js';
|
||||
import * as json from './codecs/json.js';
|
||||
import * as raw from './codecs/raw.js';
|
||||
import * as identity from './hashes/identity.js';
|
||||
import * as sha2 from './hashes/sha2.js';
|
||||
import { CID, hasher, digest, varint, bytes } from './index.js';
|
||||
export const bases = { ...identityBase, ...base2, ...base8, ...base10, ...base16, ...base32, ...base36, ...base58, ...base64, ...base256emoji };
|
||||
export const hashes = { ...sha2, ...identity };
|
||||
export const codecs = { raw, json };
|
||||
export { CID, hasher, digest, varint, bytes };
|
||||
//# sourceMappingURL=basics.js.map
|
1
node_modules/multiformats/dist/src/basics.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/basics.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"basics.js","sourceRoot":"","sources":["../../src/basics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,KAAK,GAAG,MAAM,iBAAiB,CAAA;AACtC,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAE/D,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,YAAY,EAAE,CAAA;AAC/I,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAE,CAAA;AAC9C,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA"}
|
77
node_modules/multiformats/dist/src/block.d.ts
generated
vendored
Normal file
77
node_modules/multiformats/dist/src/block.d.ts
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
import { CID } from './index.js';
|
||||
import type * as API from './interface.js';
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template C - multicodec code corresponding to codec used to encode the block
|
||||
* @template A - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
* @template V - CID version
|
||||
*/
|
||||
export declare class Block<T, C extends number, A extends number, V extends API.Version> implements API.BlockView<T, C, A, V> {
|
||||
readonly cid: CID<T, C, A, V>;
|
||||
readonly bytes: API.ByteView<T>;
|
||||
readonly value: T;
|
||||
readonly asBlock: this;
|
||||
constructor({ cid, bytes, value }: {
|
||||
cid: CID<T, C, A, V>;
|
||||
bytes: API.ByteView<T>;
|
||||
value: T;
|
||||
});
|
||||
links(): Iterable<[string, CID<unknown, number, number, API.Version>]>;
|
||||
tree(): Iterable<string>;
|
||||
get(path?: string): API.BlockCursorView<unknown>;
|
||||
}
|
||||
interface EncodeInput<T, Code extends number, Alg extends number> {
|
||||
value: T;
|
||||
codec: API.BlockEncoder<Code, T>;
|
||||
hasher: API.MultihashHasher<Alg>;
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
*/
|
||||
export declare function encode<T, Code extends number, Alg extends number>({ value, codec, hasher }: EncodeInput<T, Code, Alg>): Promise<API.BlockView<T, Code, Alg>>;
|
||||
interface DecodeInput<T, Code extends number, Alg extends number> {
|
||||
bytes: API.ByteView<T>;
|
||||
codec: API.BlockDecoder<Code, T>;
|
||||
hasher: API.MultihashHasher<Alg>;
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
*/
|
||||
export declare function decode<T, Code extends number, Alg extends number>({ bytes, codec, hasher }: DecodeInput<T, Code, Alg>): Promise<API.BlockView<T, Code, Alg>>;
|
||||
type CreateUnsafeInput<T, Code extends number, Alg extends number, V extends API.Version> = {
|
||||
cid: API.Link<T, Code, Alg, V>;
|
||||
value: T;
|
||||
codec?: API.BlockDecoder<Code, T>;
|
||||
bytes: API.ByteView<T>;
|
||||
} | {
|
||||
cid: API.Link<T, Code, Alg, V>;
|
||||
value?: undefined;
|
||||
codec: API.BlockDecoder<Code, T>;
|
||||
bytes: API.ByteView<T>;
|
||||
};
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
* @template V - CID version
|
||||
*/
|
||||
export declare function createUnsafe<T, Code extends number, Alg extends number, V extends API.Version>({ bytes, cid, value: maybeValue, codec }: CreateUnsafeInput<T, Code, Alg, V>): API.BlockView<T, Code, Alg, V>;
|
||||
interface CreateInput<T, Code extends number, Alg extends number, V extends API.Version> {
|
||||
bytes: API.ByteView<T>;
|
||||
cid: API.Link<T, Code, Alg, V>;
|
||||
hasher: API.MultihashHasher<Alg>;
|
||||
codec: API.BlockDecoder<Code, T>;
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
* @template V - CID version
|
||||
*/
|
||||
export declare function create<T, Code extends number, Alg extends number, V extends API.Version>({ bytes, cid, hasher, codec }: CreateInput<T, Code, Alg, V>): Promise<API.BlockView<T, Code, Alg, V>>;
|
||||
export {};
|
||||
//# sourceMappingURL=block.d.ts.map
|
1
node_modules/multiformats/dist/src/block.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/block.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,GAAG,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAqF1C;;;;;GAKG;AACH,qBAAa,KAAK,CAAC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AE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAetM"}
|
193
node_modules/multiformats/dist/src/block.js
generated
vendored
Normal file
193
node_modules/multiformats/dist/src/block.js
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
import { bytes as binary, CID } from './index.js';
|
||||
function readonly({ enumerable = true, configurable = false } = {}) {
|
||||
return { enumerable, configurable, writable: false };
|
||||
}
|
||||
function* linksWithin(path, value) {
|
||||
if (value != null && typeof value === 'object') {
|
||||
if (Array.isArray(value)) {
|
||||
for (const [index, element] of value.entries()) {
|
||||
const elementPath = [...path, index];
|
||||
const cid = CID.asCID(element);
|
||||
if (cid != null) {
|
||||
yield [elementPath.join('/'), cid];
|
||||
}
|
||||
else if (typeof element === 'object') {
|
||||
yield* links(element, elementPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const cid = CID.asCID(value);
|
||||
if (cid != null) {
|
||||
yield [path.join('/'), cid];
|
||||
}
|
||||
else {
|
||||
yield* links(value, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function* links(source, base) {
|
||||
if (source == null || source instanceof Uint8Array) {
|
||||
return;
|
||||
}
|
||||
const cid = CID.asCID(source);
|
||||
if (cid != null) {
|
||||
yield [base.join('/'), cid];
|
||||
}
|
||||
for (const [key, value] of Object.entries(source)) {
|
||||
const path = [...base, key];
|
||||
yield* linksWithin(path, value);
|
||||
}
|
||||
}
|
||||
function* treeWithin(path, value) {
|
||||
if (Array.isArray(value)) {
|
||||
for (const [index, element] of value.entries()) {
|
||||
const elementPath = [...path, index];
|
||||
yield elementPath.join('/');
|
||||
if (typeof element === 'object' && (CID.asCID(element) == null)) {
|
||||
yield* tree(element, elementPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
yield* tree(value, path);
|
||||
}
|
||||
}
|
||||
function* tree(source, base) {
|
||||
if (source == null || typeof source !== 'object') {
|
||||
return;
|
||||
}
|
||||
for (const [key, value] of Object.entries(source)) {
|
||||
const path = [...base, key];
|
||||
yield path.join('/');
|
||||
if (value != null && !(value instanceof Uint8Array) && typeof value === 'object' && (CID.asCID(value) == null)) {
|
||||
yield* treeWithin(path, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
function get(source, path) {
|
||||
let node = source;
|
||||
for (const [index, key] of path.entries()) {
|
||||
node = node[key];
|
||||
if (node == null) {
|
||||
throw new Error(`Object has no property at ${path.slice(0, index + 1).map(part => `[${JSON.stringify(part)}]`).join('')}`);
|
||||
}
|
||||
const cid = CID.asCID(node);
|
||||
if (cid != null) {
|
||||
return { value: cid, remaining: path.slice(index + 1).join('/') };
|
||||
}
|
||||
}
|
||||
return { value: node };
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template C - multicodec code corresponding to codec used to encode the block
|
||||
* @template A - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
* @template V - CID version
|
||||
*/
|
||||
export class Block {
|
||||
cid;
|
||||
bytes;
|
||||
value;
|
||||
asBlock;
|
||||
constructor({ cid, bytes, value }) {
|
||||
if (cid == null || bytes == null || typeof value === 'undefined') {
|
||||
throw new Error('Missing required argument');
|
||||
}
|
||||
this.cid = cid;
|
||||
this.bytes = bytes;
|
||||
this.value = value;
|
||||
this.asBlock = this;
|
||||
// Mark all the properties immutable
|
||||
Object.defineProperties(this, {
|
||||
cid: readonly(),
|
||||
bytes: readonly(),
|
||||
value: readonly(),
|
||||
asBlock: readonly()
|
||||
});
|
||||
}
|
||||
links() {
|
||||
return links(this.value, []);
|
||||
}
|
||||
tree() {
|
||||
return tree(this.value, []);
|
||||
}
|
||||
get(path = '/') {
|
||||
return get(this.value, path.split('/').filter(Boolean));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
*/
|
||||
export async function encode({ value, codec, hasher }) {
|
||||
if (typeof value === 'undefined')
|
||||
throw new Error('Missing required argument "value"');
|
||||
if (codec == null || hasher == null)
|
||||
throw new Error('Missing required argument: codec or hasher');
|
||||
const bytes = codec.encode(value);
|
||||
const hash = await hasher.digest(bytes);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
const cid = CID.create(1, codec.code, hash);
|
||||
return new Block({ value, bytes, cid });
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
*/
|
||||
export async function decode({ bytes, codec, hasher }) {
|
||||
if (bytes == null)
|
||||
throw new Error('Missing required argument "bytes"');
|
||||
if (codec == null || hasher == null)
|
||||
throw new Error('Missing required argument: codec or hasher');
|
||||
const value = codec.decode(bytes);
|
||||
const hash = await hasher.digest(bytes);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
const cid = CID.create(1, codec.code, hash);
|
||||
return new Block({ value, bytes, cid });
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
* @template V - CID version
|
||||
*/
|
||||
export function createUnsafe({ bytes, cid, value: maybeValue, codec }) {
|
||||
const value = maybeValue !== undefined
|
||||
? maybeValue
|
||||
: (codec?.decode(bytes));
|
||||
if (value === undefined)
|
||||
throw new Error('Missing required argument, must either provide "value" or "codec"');
|
||||
return new Block({
|
||||
cid: cid,
|
||||
bytes,
|
||||
value
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template Code - multicodec code corresponding to codec used to encode the block
|
||||
* @template Alg - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
* @template V - CID version
|
||||
*/
|
||||
export async function create({ bytes, cid, hasher, codec }) {
|
||||
if (bytes == null)
|
||||
throw new Error('Missing required argument "bytes"');
|
||||
if (hasher == null)
|
||||
throw new Error('Missing required argument "hasher"');
|
||||
const value = codec.decode(bytes);
|
||||
const hash = await hasher.digest(bytes);
|
||||
if (!binary.equals(cid.multihash.bytes, hash.bytes)) {
|
||||
throw new Error('CID hash does not match bytes');
|
||||
}
|
||||
return createUnsafe({
|
||||
bytes,
|
||||
cid,
|
||||
value,
|
||||
codec
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=block.js.map
|
1
node_modules/multiformats/dist/src/block.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/block.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
63
node_modules/multiformats/dist/src/block/interface.d.ts
generated
vendored
Normal file
63
node_modules/multiformats/dist/src/block/interface.d.ts
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
import type { CID } from '../cid.js';
|
||||
import type { Link, Version } from '../link/interface.js';
|
||||
/**
|
||||
* A byte-encoded representation of some type of `Data`.
|
||||
*
|
||||
* A `ByteView` is essentially a `Uint8Array` that's been "tagged" with
|
||||
* a `Data` type parameter indicating the type of encoded data.
|
||||
*
|
||||
* For example, a `ByteView<{ hello: "world" }>` is a `Uint8Array` containing a
|
||||
* binary representation of a `{hello: "world"}`.
|
||||
*/
|
||||
export interface ByteView<Data> extends Uint8Array, Phantom<Data> {
|
||||
}
|
||||
/**
|
||||
* Similar to ByteView but extends ArrayBuffer.
|
||||
*/
|
||||
export interface ArrayBufferView<Data> extends ArrayBuffer, Phantom<Data> {
|
||||
}
|
||||
declare const Marker: unique symbol;
|
||||
/**
|
||||
* A utility type to retain an unused type parameter `T`.
|
||||
* Similar to [phantom type parameters in Rust](https://doc.rust-lang.org/rust-by-example/generics/phantom.html).
|
||||
*
|
||||
* Capturing unused type parameters allows us to define "nominal types," which
|
||||
* TypeScript does not natively support. Nominal types in turn allow us to capture
|
||||
* semantics not represented in the actual type structure, without requiring us to define
|
||||
* new classes or pay additional runtime costs.
|
||||
*
|
||||
* For a concrete example, see {@link ByteView}, which extends the `Uint8Array` type to capture
|
||||
* type information about the structure of the data encoded into the array.
|
||||
*/
|
||||
export interface Phantom<T> {
|
||||
[Marker]?: T;
|
||||
}
|
||||
/**
|
||||
* Represents an IPLD block (including its CID) that can be decoded to data of
|
||||
* type `T`.
|
||||
*
|
||||
* @template T - Logical type of the data encoded in the block
|
||||
* @template C - multicodec code corresponding to codec used to encode the block
|
||||
* @template A - multicodec code corresponding to the hashing algorithm used in CID creation.
|
||||
* @template V - CID version
|
||||
*/
|
||||
export interface Block<T = unknown, C extends number = number, A extends number = number, V extends Version = 1> {
|
||||
bytes: ByteView<T>;
|
||||
cid: Link<T, C, A, V>;
|
||||
}
|
||||
export type BlockCursorView<T = unknown> = {
|
||||
value: T;
|
||||
remaining?: undefined;
|
||||
} | {
|
||||
value: CID;
|
||||
remaining: string;
|
||||
};
|
||||
export interface BlockView<T = unknown, C extends number = number, A extends number = number, V extends Version = 1> extends Block<T, C, A, V> {
|
||||
cid: CID<T, C, A, V>;
|
||||
value: T;
|
||||
links(): Iterable<[string, CID]>;
|
||||
tree(): Iterable<string>;
|
||||
get(path: string): BlockCursorView<unknown>;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=interface.d.ts.map
|
1
node_modules/multiformats/dist/src/block/interface.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/block/interface.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/block/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;;;;;;;GAQG;AACH,MAAM,WA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Q,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;IAChC,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAA;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;CAC5C"}
|
2
node_modules/multiformats/dist/src/block/interface.js
generated
vendored
Normal file
2
node_modules/multiformats/dist/src/block/interface.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=interface.js.map
|
1
node_modules/multiformats/dist/src/block/interface.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/block/interface.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/block/interface.ts"],"names":[],"mappings":""}
|
9
node_modules/multiformats/dist/src/bytes.d.ts
generated
vendored
Normal file
9
node_modules/multiformats/dist/src/bytes.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
export declare const empty: Uint8Array;
|
||||
export declare function toHex(d: Uint8Array): string;
|
||||
export declare function fromHex(hex: string): Uint8Array;
|
||||
export declare function equals(aa: Uint8Array, bb: Uint8Array): boolean;
|
||||
export declare function coerce(o: ArrayBufferView | ArrayBuffer | Uint8Array): Uint8Array;
|
||||
export declare function isBinary(o: unknown): o is ArrayBuffer | ArrayBufferView;
|
||||
export declare function fromString(str: string): Uint8Array;
|
||||
export declare function toString(b: Uint8Array): string;
|
||||
//# sourceMappingURL=bytes.d.ts.map
|
1
node_modules/multiformats/dist/src/bytes.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bytes.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,YAAoB,CAAA;AAEtC,wBAAgB,KAAK,CAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAE5C;AAED,wBAAgB,OAAO,CAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAGhD;AAED,wBAAgB,MAAM,CAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAa/D;AAED,wBAAgB,MAAM,CAAE,CAAC,EAAE,eAAe,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAOjF;AAED,wBAAgB,QAAQ,CAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,WAAW,GAAG,eAAe,CAExE;AAED,wBAAgB,UAAU,CAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAEnD;AAED,wBAAgB,QAAQ,CAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAE/C"}
|
41
node_modules/multiformats/dist/src/bytes.js
generated
vendored
Normal file
41
node_modules/multiformats/dist/src/bytes.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
export const empty = new Uint8Array(0);
|
||||
export function toHex(d) {
|
||||
return d.reduce((hex, byte) => hex + byte.toString(16).padStart(2, '0'), '');
|
||||
}
|
||||
export function fromHex(hex) {
|
||||
const hexes = hex.match(/../g);
|
||||
return hexes != null ? new Uint8Array(hexes.map(b => parseInt(b, 16))) : empty;
|
||||
}
|
||||
export function equals(aa, bb) {
|
||||
if (aa === bb)
|
||||
return true;
|
||||
if (aa.byteLength !== bb.byteLength) {
|
||||
return false;
|
||||
}
|
||||
for (let ii = 0; ii < aa.byteLength; ii++) {
|
||||
if (aa[ii] !== bb[ii]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
export function coerce(o) {
|
||||
if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array')
|
||||
return o;
|
||||
if (o instanceof ArrayBuffer)
|
||||
return new Uint8Array(o);
|
||||
if (ArrayBuffer.isView(o)) {
|
||||
return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
|
||||
}
|
||||
throw new Error('Unknown type, must be binary type');
|
||||
}
|
||||
export function isBinary(o) {
|
||||
return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
|
||||
}
|
||||
export function fromString(str) {
|
||||
return new TextEncoder().encode(str);
|
||||
}
|
||||
export function toString(b) {
|
||||
return new TextDecoder().decode(b);
|
||||
}
|
||||
//# sourceMappingURL=bytes.js.map
|
1
node_modules/multiformats/dist/src/bytes.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/bytes.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;AAEtC,MAAM,UAAU,KAAK,CAAE,CAAa;IAClC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAA;AAC9E,CAAC;AAED,MAAM,UAAU,OAAO,CAAE,GAAW;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC9B,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;AAChF,CAAC;AAED,MAAM,UAAU,MAAM,CAAE,EAAc,EAAE,EAAc;IACpD,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,CAAC,UAAU,KAAK,EAAE,CAAC,UAAU,EAAE,CAAC;QACpC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC;QAC1C,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;YACtB,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,MAAM,CAAE,CAA6C;IACnE,IAAI,CAAC,YAAY,UAAU,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,CAAC,CAAA;IAC5E,IAAI,CAAC,YAAY,WAAW;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;IACtD,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,CAAA;IAC7D,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;AACtD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAE,CAAU;IAClC,OAAO,CAAC,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAC1D,CAAC;AAED,MAAM,UAAU,UAAU,CAAE,GAAW;IACrC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAE,CAAa;IACrC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AACpC,CAAC"}
|
108
node_modules/multiformats/dist/src/cid.d.ts
generated
vendored
Normal file
108
node_modules/multiformats/dist/src/cid.d.ts
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
import type * as API from './link/interface.js';
|
||||
export * from './link/interface.js';
|
||||
export declare function format<T extends API.Link<unknown, number, number, API.Version>, Prefix extends string>(link: T, base?: API.MultibaseEncoder<Prefix>): API.ToString<T, Prefix>;
|
||||
export declare function toJSON<Link extends API.UnknownLink>(link: Link): API.LinkJSON<Link>;
|
||||
export declare function fromJSON<Link extends API.UnknownLink>(json: API.LinkJSON<Link>): CID<unknown, number, number, API.Version>;
|
||||
export declare class CID<Data = unknown, Format extends number = number, Alg extends number = number, Version extends API.Version = API.Version> implements API.Link<Data, Format, Alg, Version> {
|
||||
readonly code: Format;
|
||||
readonly version: Version;
|
||||
readonly multihash: API.MultihashDigest<Alg>;
|
||||
readonly bytes: Uint8Array;
|
||||
readonly '/': Uint8Array;
|
||||
/**
|
||||
* @param version - Version of the CID
|
||||
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
||||
* @param multihash - (Multi)hash of the of the content.
|
||||
*/
|
||||
constructor(version: Version, code: Format, multihash: API.MultihashDigest<Alg>, bytes: Uint8Array);
|
||||
/**
|
||||
* Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
|
||||
* please either use `CID.asCID(cid)` or switch to new signalling mechanism
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
get asCID(): this;
|
||||
get byteOffset(): number;
|
||||
get byteLength(): number;
|
||||
toV0(): CID<Data, API.DAG_PB, API.SHA_256, 0>;
|
||||
toV1(): CID<Data, Format, Alg, 1>;
|
||||
equals(other: unknown): other is CID<Data, Format, Alg, Version>;
|
||||
static equals<Data, Format extends number, Alg extends number, Version extends API.Version>(self: API.Link<Data, Format, Alg, Version>, other: unknown): other is CID;
|
||||
toString(base?: API.MultibaseEncoder<string>): string;
|
||||
toJSON(): API.LinkJSON<this>;
|
||||
link(): this;
|
||||
readonly [Symbol.toStringTag] = "CID";
|
||||
/**
|
||||
* Takes any input `value` and returns a `CID` instance if it was
|
||||
* a `CID` otherwise returns `null`. If `value` is instanceof `CID`
|
||||
* it will return value back. If `value` is not instance of this CID
|
||||
* class, but is compatible CID it will return new instance of this
|
||||
* `CID` class. Otherwise returns null.
|
||||
*
|
||||
* This allows two different incompatible versions of CID library to
|
||||
* co-exist and interop as long as binary interface is compatible.
|
||||
*/
|
||||
static asCID<Data, Format extends number, Alg extends number, Version extends API.Version, U>(input: API.Link<Data, Format, Alg, Version> | U): CID<Data, Format, Alg, Version> | null;
|
||||
/**
|
||||
* @param version - Version of the CID
|
||||
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
||||
* @param digest - (Multi)hash of the of the content.
|
||||
*/
|
||||
static create<Data, Format extends number, Alg extends number, Version extends API.Version>(version: Version, code: Format, digest: API.MultihashDigest<Alg>): CID<Data, Format, Alg, Version>;
|
||||
/**
|
||||
* Simplified version of `create` for CIDv0.
|
||||
*/
|
||||
static createV0<T = unknown>(digest: API.MultihashDigest<typeof SHA_256_CODE>): CID<T, typeof DAG_PB_CODE, typeof SHA_256_CODE, 0>;
|
||||
/**
|
||||
* Simplified version of `create` for CIDv1.
|
||||
*
|
||||
* @param code - Content encoding format code.
|
||||
* @param digest - Multihash of the content.
|
||||
*/
|
||||
static createV1<Data, Code extends number, Alg extends number>(code: Code, digest: API.MultihashDigest<Alg>): CID<Data, Code, Alg, 1>;
|
||||
/**
|
||||
* Decoded a CID from its binary representation. The byte array must contain
|
||||
* only the CID with no additional bytes.
|
||||
*
|
||||
* An error will be thrown if the bytes provided do not contain a valid
|
||||
* binary representation of a CID.
|
||||
*/
|
||||
static decode<Data, Code extends number, Alg extends number, Version extends API.Version>(bytes: API.ByteView<API.Link<Data, Code, Alg, Version>>): CID<Data, Code, Alg, Version>;
|
||||
/**
|
||||
* Decoded a CID from its binary representation at the beginning of a byte
|
||||
* array.
|
||||
*
|
||||
* Returns an array with the first element containing the CID and the second
|
||||
* element containing the remainder of the original byte array. The remainder
|
||||
* will be a zero-length byte array if the provided bytes only contained a
|
||||
* binary CID representation.
|
||||
*/
|
||||
static decodeFirst<T, C extends number, A extends number, V extends API.Version>(bytes: API.ByteView<API.Link<T, C, A, V>>): [CID<T, C, A, V>, Uint8Array];
|
||||
/**
|
||||
* Inspect the initial bytes of a CID to determine its properties.
|
||||
*
|
||||
* Involves decoding up to 4 varints. Typically this will require only 4 to 6
|
||||
* bytes but for larger multicodec code values and larger multihash digest
|
||||
* lengths these varints can be quite large. It is recommended that at least
|
||||
* 10 bytes be made available in the `initialBytes` argument for a complete
|
||||
* inspection.
|
||||
*/
|
||||
static inspectBytes<T, C extends number, A extends number, V extends API.Version>(initialBytes: API.ByteView<API.Link<T, C, A, V>>): {
|
||||
version: V;
|
||||
codec: C;
|
||||
multihashCode: A;
|
||||
digestSize: number;
|
||||
multihashSize: number;
|
||||
size: number;
|
||||
};
|
||||
/**
|
||||
* Takes cid in a string representation and creates an instance. If `base`
|
||||
* decoder is not provided will use a default from the configuration. It will
|
||||
* throw an error if encoding of the CID is not compatible with supplied (or
|
||||
* a default decoder).
|
||||
*/
|
||||
static parse<Prefix extends string, Data, Code extends number, Alg extends number, Version extends API.Version>(source: API.ToString<API.Link<Data, Code, Alg, Version>, Prefix>, base?: API.MultibaseDecoder<Prefix>): CID<Data, Code, Alg, Version>;
|
||||
}
|
||||
declare const DAG_PB_CODE = 112;
|
||||
declare const SHA_256_CODE = 18;
|
||||
//# sourceMappingURL=cid.d.ts.map
|
1
node_modules/multiformats/dist/src/cid.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/cid.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"cid.d.ts","sourceRoot":"","sources":["../../src/cid.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAG/C,cAAc,qBAAqB,CAAA;AAEnC,wBAAgB,MAAM,CAAE,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,SAAS,MAAM,EAAG,IAAI,EAAE,CAAC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AAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC;IAyB3J;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAE,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,CAAC,CAAC;QAAC,aAAa,EAAE,CAAC,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IA+BzO;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAE,MAAM,SAAS,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,OAAO,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC;CAcvP;AA2DD,QAAA,MAAM,WAAW,MAAO,CAAA;AACxB,QAAA,MAAM,YAAY,KAAO,CAAA"}
|
374
node_modules/multiformats/dist/src/cid.js
generated
vendored
Normal file
374
node_modules/multiformats/dist/src/cid.js
generated
vendored
Normal file
@ -0,0 +1,374 @@
|
||||
import { base32 } from './bases/base32.js';
|
||||
import { base58btc } from './bases/base58.js';
|
||||
import { coerce } from './bytes.js';
|
||||
import * as Digest from './hashes/digest.js';
|
||||
import * as varint from './varint.js';
|
||||
// This way TS will also expose all the types from module
|
||||
export * from './link/interface.js';
|
||||
export function format(link, base) {
|
||||
const { bytes, version } = link;
|
||||
switch (version) {
|
||||
case 0:
|
||||
return toStringV0(bytes, baseCache(link), base ?? base58btc.encoder);
|
||||
default:
|
||||
return toStringV1(bytes, baseCache(link), (base ?? base32.encoder));
|
||||
}
|
||||
}
|
||||
export function toJSON(link) {
|
||||
return {
|
||||
'/': format(link)
|
||||
};
|
||||
}
|
||||
export function fromJSON(json) {
|
||||
return CID.parse(json['/']);
|
||||
}
|
||||
const cache = new WeakMap();
|
||||
function baseCache(cid) {
|
||||
const baseCache = cache.get(cid);
|
||||
if (baseCache == null) {
|
||||
const baseCache = new Map();
|
||||
cache.set(cid, baseCache);
|
||||
return baseCache;
|
||||
}
|
||||
return baseCache;
|
||||
}
|
||||
export class CID {
|
||||
code;
|
||||
version;
|
||||
multihash;
|
||||
bytes;
|
||||
'/';
|
||||
/**
|
||||
* @param version - Version of the CID
|
||||
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
||||
* @param multihash - (Multi)hash of the of the content.
|
||||
*/
|
||||
constructor(version, code, multihash, bytes) {
|
||||
this.code = code;
|
||||
this.version = version;
|
||||
this.multihash = multihash;
|
||||
this.bytes = bytes;
|
||||
// flag to serializers that this is a CID and
|
||||
// should be treated specially
|
||||
this['/'] = bytes;
|
||||
}
|
||||
/**
|
||||
* Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
|
||||
* please either use `CID.asCID(cid)` or switch to new signalling mechanism
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
get asCID() {
|
||||
return this;
|
||||
}
|
||||
// ArrayBufferView
|
||||
get byteOffset() {
|
||||
return this.bytes.byteOffset;
|
||||
}
|
||||
// ArrayBufferView
|
||||
get byteLength() {
|
||||
return this.bytes.byteLength;
|
||||
}
|
||||
toV0() {
|
||||
switch (this.version) {
|
||||
case 0: {
|
||||
return this;
|
||||
}
|
||||
case 1: {
|
||||
const { code, multihash } = this;
|
||||
if (code !== DAG_PB_CODE) {
|
||||
throw new Error('Cannot convert a non dag-pb CID to CIDv0');
|
||||
}
|
||||
// sha2-256
|
||||
if (multihash.code !== SHA_256_CODE) {
|
||||
throw new Error('Cannot convert non sha2-256 multihash CID to CIDv0');
|
||||
}
|
||||
return (CID.createV0(multihash));
|
||||
}
|
||||
default: {
|
||||
throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
|
||||
}
|
||||
}
|
||||
}
|
||||
toV1() {
|
||||
switch (this.version) {
|
||||
case 0: {
|
||||
const { code, digest } = this.multihash;
|
||||
const multihash = Digest.create(code, digest);
|
||||
return (CID.createV1(this.code, multihash));
|
||||
}
|
||||
case 1: {
|
||||
return this;
|
||||
}
|
||||
default: {
|
||||
throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);
|
||||
}
|
||||
}
|
||||
}
|
||||
equals(other) {
|
||||
return CID.equals(this, other);
|
||||
}
|
||||
static equals(self, other) {
|
||||
const unknown = other;
|
||||
return (unknown != null &&
|
||||
self.code === unknown.code &&
|
||||
self.version === unknown.version &&
|
||||
Digest.equals(self.multihash, unknown.multihash));
|
||||
}
|
||||
toString(base) {
|
||||
return format(this, base);
|
||||
}
|
||||
toJSON() {
|
||||
return { '/': format(this) };
|
||||
}
|
||||
link() {
|
||||
return this;
|
||||
}
|
||||
[Symbol.toStringTag] = 'CID';
|
||||
// Legacy
|
||||
[Symbol.for('nodejs.util.inspect.custom')]() {
|
||||
return `CID(${this.toString()})`;
|
||||
}
|
||||
/**
|
||||
* Takes any input `value` and returns a `CID` instance if it was
|
||||
* a `CID` otherwise returns `null`. If `value` is instanceof `CID`
|
||||
* it will return value back. If `value` is not instance of this CID
|
||||
* class, but is compatible CID it will return new instance of this
|
||||
* `CID` class. Otherwise returns null.
|
||||
*
|
||||
* This allows two different incompatible versions of CID library to
|
||||
* co-exist and interop as long as binary interface is compatible.
|
||||
*/
|
||||
static asCID(input) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
const value = input;
|
||||
if (value instanceof CID) {
|
||||
// If value is instance of CID then we're all set.
|
||||
return value;
|
||||
}
|
||||
else if ((value['/'] != null && value['/'] === value.bytes) || value.asCID === value) {
|
||||
// If value isn't instance of this CID class but `this.asCID === this` or
|
||||
// `value['/'] === value.bytes` is true it is CID instance coming from a
|
||||
// different implementation (diff version or duplicate). In that case we
|
||||
// rebase it to this `CID` implementation so caller is guaranteed to get
|
||||
// instance with expected API.
|
||||
const { version, code, multihash, bytes } = value;
|
||||
return new CID(version, code, multihash, bytes ?? encodeCID(version, code, multihash.bytes));
|
||||
}
|
||||
else if (value[cidSymbol] === true) {
|
||||
// If value is a CID from older implementation that used to be tagged via
|
||||
// symbol we still rebase it to the this `CID` implementation by
|
||||
// delegating that to a constructor.
|
||||
const { version, multihash, code } = value;
|
||||
const digest = Digest.decode(multihash);
|
||||
return CID.create(version, code, digest);
|
||||
}
|
||||
else {
|
||||
// Otherwise value is not a CID (or an incompatible version of it) in
|
||||
// which case we return `null`.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param version - Version of the CID
|
||||
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
||||
* @param digest - (Multi)hash of the of the content.
|
||||
*/
|
||||
static create(version, code, digest) {
|
||||
if (typeof code !== 'number') {
|
||||
throw new Error('String codecs are no longer supported');
|
||||
}
|
||||
if (!(digest.bytes instanceof Uint8Array)) {
|
||||
throw new Error('Invalid digest');
|
||||
}
|
||||
switch (version) {
|
||||
case 0: {
|
||||
if (code !== DAG_PB_CODE) {
|
||||
throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
|
||||
}
|
||||
else {
|
||||
return new CID(version, code, digest, digest.bytes);
|
||||
}
|
||||
}
|
||||
case 1: {
|
||||
const bytes = encodeCID(version, code, digest.bytes);
|
||||
return new CID(version, code, digest, bytes);
|
||||
}
|
||||
default: {
|
||||
throw new Error('Invalid version');
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Simplified version of `create` for CIDv0.
|
||||
*/
|
||||
static createV0(digest) {
|
||||
return CID.create(0, DAG_PB_CODE, digest);
|
||||
}
|
||||
/**
|
||||
* Simplified version of `create` for CIDv1.
|
||||
*
|
||||
* @param code - Content encoding format code.
|
||||
* @param digest - Multihash of the content.
|
||||
*/
|
||||
static createV1(code, digest) {
|
||||
return CID.create(1, code, digest);
|
||||
}
|
||||
/**
|
||||
* Decoded a CID from its binary representation. The byte array must contain
|
||||
* only the CID with no additional bytes.
|
||||
*
|
||||
* An error will be thrown if the bytes provided do not contain a valid
|
||||
* binary representation of a CID.
|
||||
*/
|
||||
static decode(bytes) {
|
||||
const [cid, remainder] = CID.decodeFirst(bytes);
|
||||
if (remainder.length !== 0) {
|
||||
throw new Error('Incorrect length');
|
||||
}
|
||||
return cid;
|
||||
}
|
||||
/**
|
||||
* Decoded a CID from its binary representation at the beginning of a byte
|
||||
* array.
|
||||
*
|
||||
* Returns an array with the first element containing the CID and the second
|
||||
* element containing the remainder of the original byte array. The remainder
|
||||
* will be a zero-length byte array if the provided bytes only contained a
|
||||
* binary CID representation.
|
||||
*/
|
||||
static decodeFirst(bytes) {
|
||||
const specs = CID.inspectBytes(bytes);
|
||||
const prefixSize = specs.size - specs.multihashSize;
|
||||
const multihashBytes = coerce(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
|
||||
if (multihashBytes.byteLength !== specs.multihashSize) {
|
||||
throw new Error('Incorrect length');
|
||||
}
|
||||
const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
||||
const digest = new Digest.Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
|
||||
const cid = specs.version === 0
|
||||
? CID.createV0(digest)
|
||||
: CID.createV1(specs.codec, digest);
|
||||
return [cid, bytes.subarray(specs.size)];
|
||||
}
|
||||
/**
|
||||
* Inspect the initial bytes of a CID to determine its properties.
|
||||
*
|
||||
* Involves decoding up to 4 varints. Typically this will require only 4 to 6
|
||||
* bytes but for larger multicodec code values and larger multihash digest
|
||||
* lengths these varints can be quite large. It is recommended that at least
|
||||
* 10 bytes be made available in the `initialBytes` argument for a complete
|
||||
* inspection.
|
||||
*/
|
||||
static inspectBytes(initialBytes) {
|
||||
let offset = 0;
|
||||
const next = () => {
|
||||
const [i, length] = varint.decode(initialBytes.subarray(offset));
|
||||
offset += length;
|
||||
return i;
|
||||
};
|
||||
let version = next();
|
||||
let codec = DAG_PB_CODE;
|
||||
if (version === 18) {
|
||||
// CIDv0
|
||||
version = 0;
|
||||
offset = 0;
|
||||
}
|
||||
else {
|
||||
codec = next();
|
||||
}
|
||||
if (version !== 0 && version !== 1) {
|
||||
throw new RangeError(`Invalid CID version ${version}`);
|
||||
}
|
||||
const prefixSize = offset;
|
||||
const multihashCode = next(); // multihash code
|
||||
const digestSize = next(); // multihash length
|
||||
const size = offset + digestSize;
|
||||
const multihashSize = size - prefixSize;
|
||||
return { version, codec, multihashCode, digestSize, multihashSize, size };
|
||||
}
|
||||
/**
|
||||
* Takes cid in a string representation and creates an instance. If `base`
|
||||
* decoder is not provided will use a default from the configuration. It will
|
||||
* throw an error if encoding of the CID is not compatible with supplied (or
|
||||
* a default decoder).
|
||||
*/
|
||||
static parse(source, base) {
|
||||
const [prefix, bytes] = parseCIDtoBytes(source, base);
|
||||
const cid = CID.decode(bytes);
|
||||
if (cid.version === 0 && source[0] !== 'Q') {
|
||||
throw Error('Version 0 CID string must not include multibase prefix');
|
||||
}
|
||||
// Cache string representation to avoid computing it on `this.toString()`
|
||||
baseCache(cid).set(prefix, source);
|
||||
return cid;
|
||||
}
|
||||
}
|
||||
function parseCIDtoBytes(source, base) {
|
||||
switch (source[0]) {
|
||||
// CIDv0 is parsed differently
|
||||
case 'Q': {
|
||||
const decoder = base ?? base58btc;
|
||||
return [
|
||||
base58btc.prefix,
|
||||
decoder.decode(`${base58btc.prefix}${source}`)
|
||||
];
|
||||
}
|
||||
case base58btc.prefix: {
|
||||
const decoder = base ?? base58btc;
|
||||
return [base58btc.prefix, decoder.decode(source)];
|
||||
}
|
||||
case base32.prefix: {
|
||||
const decoder = base ?? base32;
|
||||
return [base32.prefix, decoder.decode(source)];
|
||||
}
|
||||
default: {
|
||||
if (base == null) {
|
||||
throw Error('To parse non base32 or base58btc encoded CID multibase decoder must be provided');
|
||||
}
|
||||
return [source[0], base.decode(source)];
|
||||
}
|
||||
}
|
||||
}
|
||||
function toStringV0(bytes, cache, base) {
|
||||
const { prefix } = base;
|
||||
if (prefix !== base58btc.prefix) {
|
||||
throw Error(`Cannot string encode V0 in ${base.name} encoding`);
|
||||
}
|
||||
const cid = cache.get(prefix);
|
||||
if (cid == null) {
|
||||
const cid = base.encode(bytes).slice(1);
|
||||
cache.set(prefix, cid);
|
||||
return cid;
|
||||
}
|
||||
else {
|
||||
return cid;
|
||||
}
|
||||
}
|
||||
function toStringV1(bytes, cache, base) {
|
||||
const { prefix } = base;
|
||||
const cid = cache.get(prefix);
|
||||
if (cid == null) {
|
||||
const cid = base.encode(bytes);
|
||||
cache.set(prefix, cid);
|
||||
return cid;
|
||||
}
|
||||
else {
|
||||
return cid;
|
||||
}
|
||||
}
|
||||
const DAG_PB_CODE = 0x70;
|
||||
const SHA_256_CODE = 0x12;
|
||||
function encodeCID(version, code, multihash) {
|
||||
const codeOffset = varint.encodingLength(version);
|
||||
const hashOffset = codeOffset + varint.encodingLength(code);
|
||||
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
||||
varint.encodeTo(version, bytes, 0);
|
||||
varint.encodeTo(code, bytes, codeOffset);
|
||||
bytes.set(multihash, hashOffset);
|
||||
return bytes;
|
||||
}
|
||||
const cidSymbol = Symbol.for('@ipld/js-cid/CID');
|
||||
//# sourceMappingURL=cid.js.map
|
1
node_modules/multiformats/dist/src/cid.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/cid.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
23
node_modules/multiformats/dist/src/codecs/interface.d.ts
generated
vendored
Normal file
23
node_modules/multiformats/dist/src/codecs/interface.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import type { ArrayBufferView, ByteView } from '../block/interface.js';
|
||||
/**
|
||||
* IPLD encoder part of the codec.
|
||||
*/
|
||||
export interface BlockEncoder<Code extends number, T> {
|
||||
name: string;
|
||||
code: Code;
|
||||
encode(data: T): ByteView<T>;
|
||||
}
|
||||
/**
|
||||
* IPLD decoder part of the codec.
|
||||
*/
|
||||
export interface BlockDecoder<Code extends number, T> {
|
||||
code: Code;
|
||||
decode(bytes: ByteView<T> | ArrayBufferView<T>): T;
|
||||
}
|
||||
/**
|
||||
* An IPLD codec is a combination of both encoder and decoder.
|
||||
*/
|
||||
export interface BlockCodec<Code extends number, T> extends BlockEncoder<Code, T>, BlockDecoder<Code, T> {
|
||||
}
|
||||
export type { ArrayBufferView, ByteView };
|
||||
//# sourceMappingURL=interface.d.ts.map
|
1
node_modules/multiformats/dist/src/codecs/interface.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/codecs/interface.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/codecs/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEtE;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC;IAClD,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,CAAE,SAAQ,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;CAAG;AAE3G,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAA"}
|
2
node_modules/multiformats/dist/src/codecs/interface.js
generated
vendored
Normal file
2
node_modules/multiformats/dist/src/codecs/interface.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=interface.js.map
|
1
node_modules/multiformats/dist/src/codecs/interface.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/codecs/interface.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/codecs/interface.ts"],"names":[],"mappings":""}
|
6
node_modules/multiformats/dist/src/codecs/json.d.ts
generated
vendored
Normal file
6
node_modules/multiformats/dist/src/codecs/json.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import type { ArrayBufferView, ByteView } from './interface.js';
|
||||
export declare const name = "json";
|
||||
export declare const code = 512;
|
||||
export declare function encode<T>(node: T): ByteView<T>;
|
||||
export declare function decode<T>(data: ByteView<T> | ArrayBufferView<T>): T;
|
||||
//# sourceMappingURL=json.d.ts.map
|
1
node_modules/multiformats/dist/src/codecs/json.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/codecs/json.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/codecs/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAK/D,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,eAAO,MAAM,IAAI,MAAS,CAAA;AAE1B,wBAAgB,MAAM,CAAE,CAAC,EAAG,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAEhD;AAED,wBAAgB,MAAM,CAAE,CAAC,EAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAErE"}
|
11
node_modules/multiformats/dist/src/codecs/json.js
generated
vendored
Normal file
11
node_modules/multiformats/dist/src/codecs/json.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
const textEncoder = new TextEncoder();
|
||||
const textDecoder = new TextDecoder();
|
||||
export const name = 'json';
|
||||
export const code = 0x0200;
|
||||
export function encode(node) {
|
||||
return textEncoder.encode(JSON.stringify(node));
|
||||
}
|
||||
export function decode(data) {
|
||||
return JSON.parse(textDecoder.decode(data));
|
||||
}
|
||||
//# sourceMappingURL=json.js.map
|
1
node_modules/multiformats/dist/src/codecs/json.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/codecs/json.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/codecs/json.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;AACrC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAA;AAErC,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAC1B,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAA;AAE1B,MAAM,UAAU,MAAM,CAAM,IAAO;IACjC,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,MAAM,CAAM,IAAsC;IAChE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;AAC7C,CAAC"}
|
6
node_modules/multiformats/dist/src/codecs/raw.d.ts
generated
vendored
Normal file
6
node_modules/multiformats/dist/src/codecs/raw.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import type { ArrayBufferView, ByteView } from './interface.js';
|
||||
export declare const name = "raw";
|
||||
export declare const code = 85;
|
||||
export declare function encode(node: Uint8Array): ByteView<Uint8Array>;
|
||||
export declare function decode(data: ByteView<Uint8Array> | ArrayBufferView<Uint8Array>): Uint8Array;
|
||||
//# sourceMappingURL=raw.d.ts.map
|
1
node_modules/multiformats/dist/src/codecs/raw.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/codecs/raw.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../../src/codecs/raw.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE/D,eAAO,MAAM,IAAI,QAAQ,CAAA;AACzB,eAAO,MAAM,IAAI,KAAO,CAAA;AAExB,wBAAgB,MAAM,CAAE,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,CAE9D;AAED,wBAAgB,MAAM,CAAE,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,UAAU,CAE5F"}
|
10
node_modules/multiformats/dist/src/codecs/raw.js
generated
vendored
Normal file
10
node_modules/multiformats/dist/src/codecs/raw.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { coerce } from '../bytes.js';
|
||||
export const name = 'raw';
|
||||
export const code = 0x55;
|
||||
export function encode(node) {
|
||||
return coerce(node);
|
||||
}
|
||||
export function decode(data) {
|
||||
return coerce(data);
|
||||
}
|
||||
//# sourceMappingURL=raw.js.map
|
1
node_modules/multiformats/dist/src/codecs/raw.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/codecs/raw.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"raw.js","sourceRoot":"","sources":["../../../src/codecs/raw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGpC,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAA;AACzB,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAA;AAExB,MAAM,UAAU,MAAM,CAAE,IAAgB;IACtC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,MAAM,CAAE,IAAwD;IAC9E,OAAO,MAAM,CAAC,IAAI,CAAC,CAAA;AACrB,CAAC"}
|
25
node_modules/multiformats/dist/src/hashes/digest.d.ts
generated
vendored
Normal file
25
node_modules/multiformats/dist/src/hashes/digest.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import type { MultihashDigest } from './interface.js';
|
||||
/**
|
||||
* Creates a multihash digest.
|
||||
*/
|
||||
export declare function create<Code extends number>(code: Code, digest: Uint8Array): Digest<Code, number>;
|
||||
/**
|
||||
* Turns bytes representation of multihash digest into an instance.
|
||||
*/
|
||||
export declare function decode(multihash: Uint8Array): MultihashDigest;
|
||||
export declare function equals(a: MultihashDigest, b: unknown): b is MultihashDigest;
|
||||
/**
|
||||
* Represents a multihash digest which carries information about the
|
||||
* hashing algorithm and an actual hash digest.
|
||||
*/
|
||||
export declare class Digest<Code extends number, Size extends number> implements MultihashDigest {
|
||||
readonly code: Code;
|
||||
readonly size: Size;
|
||||
readonly digest: Uint8Array;
|
||||
readonly bytes: Uint8Array;
|
||||
/**
|
||||
* Creates a multihash digest.
|
||||
*/
|
||||
constructor(code: Code, size: Size, digest: Uint8Array, bytes: Uint8Array);
|
||||
}
|
||||
//# sourceMappingURL=digest.d.ts.map
|
1
node_modules/multiformats/dist/src/hashes/digest.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/hashes/digest.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../src/hashes/digest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD;;GAEG;AACH,wBAAgB,MAAM,CAAE,IAAI,SAAS,MAAM,EAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAWlG;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAE,SAAS,EAAE,UAAU,GAAG,eAAe,CAW9D;AAED,wBAAgB,MAAM,CAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CAa5E;AAED;;;GAGG;AACH,qBAAa,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,CAAE,YAAW,eAAe;IACtF,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAE1B;;OAEG;gBACU,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;CAM3E"}
|
60
node_modules/multiformats/dist/src/hashes/digest.js
generated
vendored
Normal file
60
node_modules/multiformats/dist/src/hashes/digest.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
import { coerce, equals as equalBytes } from '../bytes.js';
|
||||
import * as varint from '../varint.js';
|
||||
/**
|
||||
* Creates a multihash digest.
|
||||
*/
|
||||
export function create(code, digest) {
|
||||
const size = digest.byteLength;
|
||||
const sizeOffset = varint.encodingLength(code);
|
||||
const digestOffset = sizeOffset + varint.encodingLength(size);
|
||||
const bytes = new Uint8Array(digestOffset + size);
|
||||
varint.encodeTo(code, bytes, 0);
|
||||
varint.encodeTo(size, bytes, sizeOffset);
|
||||
bytes.set(digest, digestOffset);
|
||||
return new Digest(code, size, digest, bytes);
|
||||
}
|
||||
/**
|
||||
* Turns bytes representation of multihash digest into an instance.
|
||||
*/
|
||||
export function decode(multihash) {
|
||||
const bytes = coerce(multihash);
|
||||
const [code, sizeOffset] = varint.decode(bytes);
|
||||
const [size, digestOffset] = varint.decode(bytes.subarray(sizeOffset));
|
||||
const digest = bytes.subarray(sizeOffset + digestOffset);
|
||||
if (digest.byteLength !== size) {
|
||||
throw new Error('Incorrect length');
|
||||
}
|
||||
return new Digest(code, size, digest, bytes);
|
||||
}
|
||||
export function equals(a, b) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
const data = b;
|
||||
return (a.code === data.code &&
|
||||
a.size === data.size &&
|
||||
data.bytes instanceof Uint8Array &&
|
||||
equalBytes(a.bytes, data.bytes));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Represents a multihash digest which carries information about the
|
||||
* hashing algorithm and an actual hash digest.
|
||||
*/
|
||||
export class Digest {
|
||||
code;
|
||||
size;
|
||||
digest;
|
||||
bytes;
|
||||
/**
|
||||
* Creates a multihash digest.
|
||||
*/
|
||||
constructor(code, size, digest, bytes) {
|
||||
this.code = code;
|
||||
this.size = size;
|
||||
this.digest = digest;
|
||||
this.bytes = bytes;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=digest.js.map
|
1
node_modules/multiformats/dist/src/hashes/digest.js.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/hashes/digest.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"digest.js","sourceRoot":"","sources":["../../../src/hashes/digest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAA;AA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AAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAC9C,CAAC;AAED,MAAM,UAAU,MAAM,CAAE,CAAkB,EAAE,CAAU;IACpD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,GAAG,CAAwD,CAAA;QAErE,OAAO,CACL,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;YACpB,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI;YACpB,IAAI,CAAC,KAAK,YAAY,UAAU;YAChC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAChC,CAAA;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,MAAM;IACR,IAAI,CAAM;IACV,IAAI,CAAM;IACV,MAAM,CAAY;IAClB,KAAK,CAAY;IAE1B;;OAEG;IACH,YAAa,IAAU,EAAE,IAAU,EAAE,MAAkB,EAAE,KAAiB;QACxE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF"}
|
21
node_modules/multiformats/dist/src/hashes/hasher.d.ts
generated
vendored
Normal file
21
node_modules/multiformats/dist/src/hashes/hasher.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import * as Digest from './digest.js';
|
||||
import type { MultihashHasher } from './interface.js';
|
||||
type Await<T> = Promise<T> | T;
|
||||
export declare function from<Name extends string, Code extends number>({ name, code, encode }: {
|
||||
name: Name;
|
||||
code: Code;
|
||||
encode(input: Uint8Array): Await<Uint8Array>;
|
||||
}): Hasher<Name, Code>;
|
||||
/**
|
||||
* Hasher represents a hashing algorithm implementation that produces as
|
||||
* `MultihashDigest`.
|
||||
*/
|
||||
export declare class Hasher<Name extends string, Code extends number> implements MultihashHasher<Code> {
|
||||
readonly name: Name;
|
||||
readonly code: Code;
|
||||
readonly encode: (input: Uint8Array) => Await<Uint8Array>;
|
||||
constructor(name: Name, code: Code, encode: (input: Uint8Array) => Await<Uint8Array>);
|
||||
digest(input: Uint8Array): Await<Digest.Digest<Code, number>>;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=hasher.d.ts.map
|
1
node_modules/multiformats/dist/src/hashes/hasher.d.ts.map
generated
vendored
Normal file
1
node_modules/multiformats/dist/src/hashes/hasher.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../../src/hashes/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,KAAK,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE9B,wBAAgB,IAAI,CAAE,IAAI,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,EAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAErL;AAED;;;GAGG;AACH,qBAAa,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,CAAE,YAAW,eAAe,CAAC,IAAI,CAAC;IAC5F,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC,CAAA;gBAE5C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC;IAMrF,MAAM,CAAE,KAAK,EAAE,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;CAY/D"}
|
32
node_modules/multiformats/dist/src/hashes/hasher.js
generated
vendored
Normal file
32
node_modules/multiformats/dist/src/hashes/hasher.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
import * as Digest from './digest.js';
|
||||
export function from({ name, code, encode }) {
|
||||
return new Hasher(name, code, encode);
|
||||
}
|
||||
/**
|
||||
* Hasher represents a hashing algorithm implementation that produces as
|
||||
* `MultihashDigest`.
|
||||
*/
|
||||
export class Hasher {
|
||||
name;
|
||||
code;
|
||||
encode;
|
||||
constructor(name, code, encode) {
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
this.encode = encode;
|
||||
}
|
||||
digest(input) {
|
||||
if (input instanceof Uint8Array) {
|
||||
const result = this.encode(input);
|
||||
return result instanceof Uint8Array
|
||||
? Digest.create(this.code, result)
|
||||
/* c8 ignore next 1 */
|
||||
: result.then(digest => Digest.create(this.code, digest));
|
||||
}
|
||||
else {
|
||||
throw Error('Unknown type, must be binary type');
|
||||
/* c8 ignore next 1 */
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=hasher.js.map
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user