getCredPublicKey

Creates a new ssh public key credential object. The supplied credential parameter will be internally duplicated.

version(GIT_SSH)
static if(targetLibGitVersion == VersionInfo(0, 19, 0))
getCredPublicKey
(
ubyte[] publicKey
,,
void* signData
)

Examples

auto cred = getCredPublicKey([], null, null);

switch (cred.credType) with (GitCredType)
{
    case publickey:
    {
        // 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!publickey;
        assert(cred1.publicKey == []);
        assert(cred1.signCallback is null);
        assert(cred1.signData is null);

        // or use a type
        auto cred2 = cred.get!GitCred_PublicKey;
        assert(cred2.publicKey == []);
        assert(cred2.signCallback is null);
        assert(cred2.signData is null);

        break;
    }

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

Meta