getCredKeyFilePassPhrase

Creates a new ssh key file and passphrase credential object. The supplied credential parameter will be internally duplicated.

version(GIT_SSH)
static if(targetLibGitVersion == VersionInfo(0, 19, 0))
getCredKeyFilePassPhrase
(
string publicKey
,
string privateKey
,
string passPhrase
)

Examples

auto cred = getCredKeyFilePassPhrase("public", "private", "passphrase");

switch (cred.credType) with (GitCredType)
{
    case passphrase:
    {
        // throw when trying to cast to an inappropriate type
        assertThrown!GitException(cred.get!plaintext);

        // ditto
        assertThrown!GitException(cred.get!GitCred_PlainText);

        // use enum for the get template
        auto cred1 = cred.get!passphrase;
        assert(cred1.publicKey == "public");
        assert(cred1.privateKey == "private");
        assert(cred1.passPhrase == "passphrase");

        // or use a type
        auto cred2 = cred.get!GitCred_KeyFilePassPhrase;
        assert(cred2.publicKey == "public");
        assert(cred2.privateKey == "private");
        assert(cred2.passPhrase == "passphrase");

        break;
    }

    default: assert(0, text(cred.credType));
}

Meta