Beispiel #1
0
func createTestSafe() (*Safe, error) {
	err := ioutil.WriteFile(testSafeName, []byte(testSafeContent), 0600)
	if err != nil {
		return nil, err
	}

	backendConfig := backends.Config{
		Type: backends.ConfigTypeFile,
		Settings: map[string]interface{}{
			"path": testSafeName,
		},
	}
	backendClient, err := backends.New(&backendConfig)
	if err != nil {
		return nil, err
	}

	cryptoConfig := crypto.Config{
		Type: crypto.ConfigTypeOpenPGP,
		OpenPGPSettings: &crypto.OpenPGPSettings{
			Cipher:   "aes128",
			S2KCount: 1024,
		},
	}

	cryptoClient, err := crypto.New(&cryptoConfig)
	if err != nil {
		return nil, err
	}

	config := &config.Config{
		Encryption: cryptoConfig,
		Storage:    backendConfig,
		Version:    "1.2.3 test",
	}

	return Load(
		testSafePassword,
		backendClient,
		cryptoClient,
		config,
	)
}
Beispiel #2
0
Datei: util.go Projekt: bndw/pick
func newBackendClient() (backends.Client, error) {
	return backends.New(&config.Storage)
}