Skip to main content

Vault | C# SDK | JWT Endpoints

JWT Endpoints

JWT Sign

VaultClient.JWTSign(string, string)

Sign a JSON Web Token (JWT) using a key.

required parameters

string

The key ID to sign the payload.

string

The JWT payload (in JSON).

Response Object

Task<Response<JWTSignResult>>

The response containing the signed JWT.

string payload = "{\"sub\": \"1234567890\",\"name\": \"John Doe\",\"admin\": true}";
var response = await client
    .JWTSign("pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5", payload);

JWT Verify

VaultClient.JWTVerify(JWTVerifyRequest)

Verify the signature of a JSON Web Token (JWT).

required parameters

JWTVerifyRequest

The request containing the JWT signature to verify.

Response Object

Task<Response<JWTVerifyResult>>

The response containing the verification result.

var request = new JWTVerifyRequest
    ("ewogICJhbGciO...")
    ;
var verifyResponse = await client.JWTVerify(request);

JWT Retrieve

VaultClient.JWKGet(JWKGetRequest)

Retrieve a key in JWK format.

required parameters

JWKGetRequest

The request containing the item ID and version to retrieve.

Response Object

Task<Response<JWKGetResult>>

The response containing the JWK key.

var request = new JWKGetRequest
    ("jwkid")
    .WithVersion("2")
    ;
var response = await client.JWKGet(request)