migrate

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package migrate packs accounts into an encrypted bundle for moving them between machines. The bundle is useless without the one-time code.

Index

Constants

View Source
const (
	BeginPrefix = "-----BEGIN CCSWAP BUNDLE v"
	EndLine     = "-----END CCSWAP BUNDLE-----"
)

BeginPrefix starts the first line of a bundle, before its version; EndLine is its last line. A reader keeps what lies between them, whatever text surrounds them.

Variables

View Source
var (
	ErrNotBundle    = errors.New("not a ccswap bundle")
	ErrNewerVersion = errors.New("bundle made by a newer ccswap")
	ErrCodeFormat   = errors.New("malformed code")
	ErrBadCode      = errors.New("wrong code or damaged bundle")
)

Functions

func Check

func Check(bundle []byte) error

Check validates the armor and version without a code.

func ParseCode

func ParseCode(s string) ([]byte, error)

ParseCode accepts a code in any case, with spaces or dashes (or neither), and returns its 20 bytes.

func Seal

func Seal(accts []Account) (bundle []byte, code string, err error)

Seal encrypts accts under a fresh random code. The code is returned in display form (8 groups of 4) and is not stored anywhere in the bundle.

Types

type Account

type Account struct {
	Name            string          `json:"name"`
	Email           string          `json:"email"`
	Priority        int             `json:"priority"`
	Enabled         bool            `json:"enabled"`
	OAuthAccount    json.RawMessage `json:"oauth_account,omitempty"`
	Credentials     json.RawMessage `json:"credentials"`
	WeeklyThreshold float64         `json:"weekly_threshold,omitempty"`
}

Account is one migrated account. Credentials is the vault form {"claudeAiOauth":{...}}, preserved semantically (JSON is compacted).

func Open

func Open(bundle []byte, code string) ([]Account, error)

Open decrypts a bundle. A wrong code and a damaged body are indistinguishable by design.

Jump to

Keyboard shortcuts

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