sic

package module
v0.0.0-...-bdc0968 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 12 Imported by: 0

README

contributions welcome GoDoc License Go Report Build Status

SafeInCloud Golang Decryption

Provides decryption of a SafeInCloud database in Golang.

Example

package main

import (
    "fmt"
    "log"
    "os"

    "github.com/mxschmitt/golang-safe-in-cloud"
)

func main() {
    file, err := os.Open("SafeInCloud.db")
    if err != nil {
        log.Fatalf("could not read file: %v", err)
    }
    raw, err := sic.Decrypt(file, "foobar")
    if err != nil {
        log.Fatalf("could not decrypt: %v", err)
    }
    fmt.Println(string(raw))
    x, err := sic.Unmarshal(raw)
    if err != nil {
        log.Fatalf("could not unmarshal: %v", err)
    }
    fmt.Printf("data: %+v\n", x)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectPassword = errors.New("Incorrect credentials")

ErrIncorrectPassword means that the credentials are incorrect

Functions

func Decrypt

func Decrypt(file io.Reader, password string) ([]byte, error)

Decrypt decrypts a SafeInCloud database by a given file (e.g. os.Open) and a password

Types

type Card

type Card struct {
	ID          string  `xml:"id,attr"`
	Symbol      string  `xml:"symbol,attr"`
	Template    string  `xml:"template,attr"`
	Type        string  `xml:"type,attr"`
	WebsiteIcon string  `xml:"website_icon,attr"`
	TimeStamp   string  `xml:"time_stamp,attr"`
	Deleted     string  `xml:"deleted,attr"`
	Title       string  `xml:"title,attr"`
	Color       string  `xml:"color,attr"`
	Star        string  `xml:"star,attr"`
	Field       []Field `xml:"field"`
}

type Database

type Database struct {
	Notes   []string `xml:"notes"`
	LabelID []string `xml:"label_id"`
	File    [][]File `xml:"file"`
	Ghost   []Ghost  `xml:"ghost"`
	Label   []Label  `xml:"label"`
	Card    []Card   `xml:"card"`
}

func Unmarshal

func Unmarshal(raw []byte) (*Database, error)

Unmarshal converts the xml in []byte into a Go struct

type Field

type Field struct {
	Hash    string `xml:"hash,attr"`
	History string `xml:"history,attr"`
	Name    string `xml:"name,attr"`
	Type    string `xml:"type,attr"`
	Text    string `xml:",chardata"`
	Score   string `xml:"score,attr"`
}

type File

type File struct {
	Name string `xml:"name,attr"`
	Text string `xml:",chardata"`
}

type Ghost

type Ghost struct {
	ID        string `xml:"id,attr"`
	TimeStamp string `xml:"time_stamp,attr"`
}

type Label

type Label struct {
	Type      string `xml:"type,attr"`
	TimeStamp string `xml:"time_stamp,attr"`
	ID        string `xml:"id,attr"`
	Name      string `xml:"name,attr"`
}

Jump to

Keyboard shortcuts

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