コード例 #1
1
ファイル: client.go プロジェクト: 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)
	}
}
コード例 #2
0
ファイル: client_test.go プロジェクト: gaku/1pass
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
}