Example #1
1
File: client.go Project: gaku/1pass
func createNewVault(path string, lowSecurity bool) {
	if !strings.HasSuffix(path, ".agilekeychain") {
		path += ".agilekeychain"
	}
	fmt.Printf("Creating new vault in %s\n", path)
	fmt.Printf("Enter master password: "******"\nRe-enter master password: "******"Passwords do not match")
	}

	security := onepass.VaultSecurity{MasterPwd: string(masterPwd)}
	if lowSecurity {
		// use fewer PBKDF2 iterations to speed up
		// master key decryption
		security.Iterations = 10
	}

	_, err = onepass.NewVault(path, security)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to create new vault: %v", err)
	}
}
Example #2
0
func newTestVault(t *testing.T) *onepass.Vault {
	path := os.TempDir() + "/vault.agilekeychain"
	err := os.RemoveAll(path)
	if err != nil {
		t.Fatalf("Failed to create test dir")
	}
	security := onepass.VaultSecurity{
		MasterPwd:  ClientTestPwd,
		Iterations: 100,
	}
	vault, err := onepass.NewVault(path, security)
	if err != nil {
		t.Fatalf("Unable to create test vault")
	}
	return &vault
}