cookieCloudSDK

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

CookieCloudSDK for Go

项目主要目的是为了方便使用Go语言开发的服务与CookieCloud进行交互,目前只写了解密部分,加密部分还没写,后续会尝试完善。

使用方法

1. 导入包
    go get -u github.com/yazzyk/cookieCloudSDK
2. 使用
func TestNewCookieCloudSDK(t *testing.T) {
    sdk, err := NewCookieCloudSDK("", "", "")
    if err != nil {
        t.Error(err)
        return
    }
    data, err := sdk.GetCookie()
    if err != nil {
        t.Error(err)
        return
    }
    t.Log(data)
}

本项目参考代码: aienvoy

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieCloudDecodeData

type CookieCloudDecodeData struct {
	CookieData       map[string][]CookieData     `json:"cookie_data"`
	LocalStorageData map[string]LocalStorageData `json:"local_storage_data"`
}

解密后的数据结构

type CookieCloudRs

type CookieCloudRs struct {
	Encrypted string `json:"encrypted"`
}

解密前的数据结构

type CookieCloudSDK

type CookieCloudSDK struct {
	Url      string // 服务器地址
	UUID     string // UUID 用户KEY
	Password string // 密码 端对端加密密码
}

func NewCookieCloudSDK

func NewCookieCloudSDK(host, uuid, password string) (*CookieCloudSDK, error)

func (*CookieCloudSDK) AesDecrypt

func (this *CookieCloudSDK) AesDecrypt(data, key, iv []byte) ([]byte, error)

func (*CookieCloudSDK) AesEncrypt

func (this *CookieCloudSDK) AesEncrypt(data, key, iv []byte) ([]byte, error)

func (*CookieCloudSDK) Decrypt

func (this *CookieCloudSDK) Decrypt(passphrase, encryptedData string) ([]byte, error)

Decrypt 解密

func (*CookieCloudSDK) GetCookie

func (this *CookieCloudSDK) GetCookie() (CookieCloudDecodeData, error)

GetCookie 获取解密后的数据

type CookieData

type CookieData struct {
	Domain         string  `json:"domain"`
	ExpirationDate float64 `json:"expirationDate"`
	HostOnly       bool    `json:"hostOnly"`
	HttpOnly       bool    `json:"httpOnly"`
	Name           string  `json:"name"`
	Path           string  `json:"path"`
	SameSite       string  `json:"sameSite"`
	Secure         bool    `json:"secure"`
	Session        bool    `json:"session"`
	StoreId        string  `json:"storeId"`
	Value          string  `json:"value"`
}

type LocalStorageData

type LocalStorageData struct {
	IsWhitelist string `json:"isWhitelist"`
}

Jump to

Keyboard shortcuts

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