|
1 |
| -# Requirements Document - Dendrite |
2 |
| - |
3 |
| -## Introduction |
| 1 | +# Dendrite |
4 | 2 |
|
5 | 3 | Dendrite is a tool designed for the retrieval and validation of the SEP-001 standard. Its main goal is to provide a user-friendly and easy-to-use interface to interact with the standard.
|
6 | 4 |
|
7 |
| -## Technical Requirements |
| 5 | +## Key features |
8 | 6 |
|
9 |
| -1. Initialization of the library with the CID corresponding to the standard: |
10 |
| - - The tool should allow the initialization of the library by providing the CID corresponding to the SEP-001 standard. |
| 7 | +* Fetches metadata from the Meta Lake (IPFS). |
| 8 | +* Automatically detects the serialization format of the metadata and applies the appropriate strategy to fetch and decode it. |
| 9 | +* Validates the metadata's signature to ensure its authenticity and integrity. |
| 10 | +* Verifies that the retrieved metadata adheres to the defined schema, ensuring its correctness and compliance with standards. |
| 11 | +* Provides a standardized interface for interacting with the metadata, allowing users to: |
| 12 | + * Validate the fingerprint of the metadata. |
| 13 | + * Determine the type of multimedia represented by the metadata. |
| 14 | + * Handle and manage the results of the payload recovered from the metadata. |
11 | 15 |
|
12 |
| -2. Retrieval of the CID from the IPFS network: |
13 |
| - - The tool should be capable of retrieving the CID from the IPFS network using the DAG or Block services. |
| 16 | +## Install |
14 | 17 |
|
15 |
| -3. Determination of the serialization type using the multiformat codec: |
16 |
| - - The tool should be capable of determining the serialization type (e.g., dag-jose, raw) using the multiformat codec. |
| 18 | +Dendrite is available as a NPM package. |
17 | 19 |
|
18 |
| -4. Implementation of modules for each serialization type: |
19 |
| - - For each serialization type, a module should be implemented, each one implementing an interface (e.g., "Serialization", "Codec", etc.). |
20 |
| - - The interface should specify methods/properties that facilitate the navigation through the content of the "claims" in the SEP-001 standard. |
21 |
| - - Each module should be capable of validating the schema of the SEP-001 standard, including the "claims", data types, etc. |
22 |
| - - Each module should be capable of validating the signature in the serialization format. If the token does not contain a signature, it should be considered invalid. |
23 |
| - - If a public key is not detected in the serialization, the validation method should require passing the public key as a parameter. |
| 20 | +`npm install dendritejs` |
24 | 21 |
|
25 |
| -5. Client interface based on serialization and deserialization results: |
26 |
| - - A client interface should be implemented to provide a user-friendly and easy-to-use interface. |
27 |
| - - The client interface should be based on the detected serialization and the results obtained from the deserialization process. |
28 | 22 |
|
29 |
| -## Expected Deliverables |
| 23 | +## Usage |
30 | 24 |
|
31 |
| -- The library should be compatible with browser and node. |
32 |
| -- Clean and well-documented source code in TypeScript and Node.js (github repo). |
33 |
| -- Technical documentation describing the architecture and functionality of the tool, including details on the implementation of SEP-001 and any integration with Multiformats and IPFS. |
34 |
| -- Unit and integration tests demonstrating the functionality and validity of the tool. |
| 25 | +```typescript |
| 26 | +import {create} from 'ipfs-core' |
| 27 | +import dendrite from 'dendritejs' |
35 | 28 |
|
36 |
| -## References |
| 29 | +const node = await create() |
| 30 | +const decoder = dendrite(node) |
| 31 | + |
| 32 | +const dagJose = 'bagcqcerann63enqn2vssm6gko624gojakrswyppm56rao7m6e6vfnvtcxzha' |
| 33 | +const decoded = await decoder(dagJose) |
37 | 34 |
|
38 |
| -- [Multiformats JS Library](https://github.com/multiformats/js-multiformats) |
39 |
| -- [DAG Service Documentation](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md) |
40 |
| -- [Block Service Documentation](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md) |
| 35 | +// ... |
| 36 | +const mediaType = decoded.type() |
| 37 | +const payload = decoded.metadata() |
| 38 | + |
| 39 | +// fingerprint verification with shared fingerprint |
| 40 | +const expectedFingerprint = 'aba44a9673c452de6183c82919de2cdb8b830615e9ac684841502ba7173ee00a' |
| 41 | +const validFingerprint = decoded.validate(expectedFingerprint) |
| 42 | + |
| 43 | +``` |
| 44 | +## References |
41 | 45 |
|
42 |
| -This requirements document defines the key technical aspects of the Dendrite tool, providing a guide for the development and implementation of the software. \ |
| 46 | +* [Multiformats JS Library](https://github.com/multiformats/js-multiformats) |
| 47 | +* [DAG Service Documentation](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md) |
| 48 | +* [Block Service Documentation](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md) |
0 commit comments