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)); }
Creates a new ssh key file and passphrase credential object. The supplied credential parameter will be internally duplicated.