capsule-corp-ternoa / ternoa-js

Ternoa JavaScript SDK to build on top of the Ternoa Chain ⚙️
https://docs.ternoa.network
Apache License 2.0
24 stars 10 forks source link

Epic: Secret NFTs 🔐 #126

Closed ipapandinas closed 1 year ago

ipapandinas commented 1 year ago

This issue specifies the design choices took for the Secret NFTs pallet implementation in the SDK. Feel free to comment on certain misunderstandings and new suggestions are warm welcomed.

The 2 main sections are:

Minting

Flow

        graph TD;
        A[Init API]-->B;
      B[Create Keyring]-->F;
      B-->W;

      C[Create PGP Key Pair] -- public PGP Key -->D;
      C -- secret PGP Key --> V;
      D[Encrypt Secret] --> E;
      E[IPFS upload: Secret + Public PGP Key] --> F;
      F[On Chain: Mint Secret NFT] --> W;

      V[Generate SSS] --> W;
      W[Format Payload: Data + Signature] --> Y;
      X[Get Enclaves] --> Y[SGX Upload];

      style A fill:#fff,stroke:#333,color: #000,stroke-dasharray: 5,stroke-width:2px
      style B fill:#fff,stroke:#333,color: #000,stroke-dasharray: 5,stroke-width:2px

Sub tasks

Viewing

Flow

        graph TD;
        Z[Init API]-->Y;
      Y[Create Keyring]-->X;
      X[SGX get: SSS]-->W;
      W[Construct PGP Private Key] --> F;

      V[NFT ID] --> X
      V --> C

      C[Chain storage get: Secret Offchain Data] -- IPFS hash --> D;
      D[IPFS get: Secret Metadata] -- IPFS hash --> E;
      E[IPFS get: Encrypted Secret File] --> F;
      F[Decrypt Secret File]

      style Z fill:#fff,stroke:#333,color: #000,stroke-dasharray: 5,stroke-width:2px
      style Y fill:#fff,stroke:#333,color: #000,stroke-dasharray: 5,stroke-width:2px
      style V fill:#fff,stroke:#333,color: #000,stroke-dasharray: 5,stroke-width:2px

Sub tasks

Production ready

Notes

Lifecycle states

Secret NFTs will have the following lifecycle associated with them: Pending Mint -> Minted -> Burned.

Glossary:

References