ipfs

package
v0.0.0-...-a26e058 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ChainName = "Ipfs"

Variables

This section is empty.

Functions

func CreateRepo

func CreateRepo() (string, error)

CreateRepo Create a Temporary Repo

func NewChainAdaptor

func NewChainAdaptor(conf *config.Config) (blockchain.KeyAdaptor, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, networkNode []string, repoPath string) (*Client, error)

func (*Client) AddFile

func (c *Client) AddFile(ctx context.Context, file []byte) (string, error)

AddFile 添加文件,返回cid

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, cidStr string) ([]byte, error)

GetFile get file from local and network

type KeyAdaptor

type KeyAdaptor struct {
	fallback.KeyAdaptor
	// contains filtered or unexported fields
}

func (*KeyAdaptor) GetSocialKey

GetSocialKey 1. req.uuid 取到链上的存储 req.key 的文件, 2. 解密返回就行

func (*KeyAdaptor) GetSupportChain

func (a *KeyAdaptor) GetSupportChain(req *keylocker.SupportChainReq) (*keylocker.SupportChainRep, error)

func (*KeyAdaptor) SetSocialKey

SetSocialKey 1. 如果对应 uuid(req.uuid) 没有 rsa 密钥对,生成 rsa 密钥对,生成 RSA 密钥对处理,私钥,用用户密码(req.password)进行 AES 加密存储, 公钥明文存储, 如果有直接使用 2. 用 rsa 私钥对 key(req.key 是用户上传的一个私钥) 加密,加密 key 调用 ipfs 上传 3. 返回加密的 RSA 的私钥和明文的 RSA 公钥匙, 加密方式,IPFS 对应的 CID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL