getCredPublicKey

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

version(GIT_SSH)
getCredPublicKey
(
ubyte[] publicKey
,,
void* signData
)

Examples

1 auto cred = getCredPublicKey([], null, null);
2 
3 switch (cred.credType) with (GitCredType)
4 {
5     case publickey:
6     {
7         // throw when trying to cast to an inappropriate type
8         assertThrown!GitException(cred.get!plaintext);
9 
10         // ditto
11         assertThrown!GitException(cred.get!GitCred_PlainText);
12 
13         // use enum for the get template
14         auto cred1 = cred.get!publickey;
15         assert(cred1.publicKey == []);
16         assert(cred1.signCallback is null);
17         assert(cred1.signData is null);
18 
19         // or use a type
20         auto cred2 = cred.get!GitCred_PublicKey;
21         assert(cred2.publicKey == []);
22         assert(cred2.signCallback is null);
23         assert(cred2.signData is null);
24 
25         break;
26     }
27 
28     default: assert(0, text(cred.credType));
29 }

Meta