Revoke a credential
You can revoke a credential from a users profile using the issuance token. This requires no interaction from the user and will automatically update the Yoti app. The user will no longer be able to share or use the Yoti credential.
const payload = new Payload({
issuance_token: attributeIssuanceDetails.getToken(),
name: 'com.example.someAttribute',
});
const request = new RequestBuilder()
.withBaseUrl('https://api.yoti.com/api/v1/attribute-registry')
.withEndpoint('/attribute/revoke')
.withPemString('PEM_CONTENT')
.withHeader('X-Yoti-Auth-Id', 'CLIENT_SDK_ID')
.withMethod('PUT')
.withPayload(payload)
.build();
const response = await request.execute();
byte[] payload = ...; // Payload is JSON converted to byte array
SignedRequest signedRequest = SignedRequestBuilderFactory.create()
.withKeyPair("PEM_CONTENT")
.withBaseUrl("https://api.yoti.com/api/v1/attribute-registry")
.withEndpoint("/attribute/revoke")
.withHttpMethod("PUT")
.withHeader("X-Yoti-Auth-Id", "CLIENT_SDK_ID")
.withPayload(payload)
.build();
// 'SomeModel' is a POJO that has been defined by the user and is
// used to map JSON response as the SDK doesn't have any built in
// classes to support this
SomeModel someModel = signedRequest.execute(SomeModel.class);
/**
* SignedRequest.execute() uses built in Java HTTP connectivity.
* To use another framework if required (e.g. apache), you can get
* all of the pieces of the Yoti signed request off the SignedRequest
<?php
use Yoti\Http\Payload;
use Yoti\Http\RequestBuilder;
$payload = Payload::fromJsonData((object) [
'issuance_token' => $attributeIssuanceDetails->getToken(),
'name' => 'com.example.someAttribute',
]);
$request = (new RequestBuilder())
->withBaseUrl('https://api.yoti.com/api/v1/attribute-registry')
->withEndpoint("/attribute/revoke")
->withPemFilePath('/path/to/key.pem')
->withHeader('X-Yoti-Auth-Id', 'CLIENT_SDK_ID')
->withMethod('PUT')
->withPayload($payload)
->build();
$response = $request->execute();
// Note:
// - Use RequestBuilder::withPemFile() to provide a `\Yoti\Util\PemFile`
// - Use RequestBuilder::withPemString() to provide PEM string
import json
from yoti_python_sdk.http import SignedRequest
payload_data = {
"issuance_token": attribute_issuance_details.token,
"name": 'com.example.someAttribute',
}
payload_string = json.dumps(payload_data).encode()
signed_request = (
SignedRequest
.builder()
.with_pem_file("/path/to/key.pem")
.with_base_url("https://api.yoti.com/api/v1/attribute-registry")
.with_endpoint("/attribute/revoke")
.with_http_method("PUT")
.with_header("X-Yoti-Auth-Id", "CLIENT_SDK_ID")
.with_payload(payload_string)
.build()
)
response = signed_request.execute()
var dynamicScenarioBuilder = new DynamicScenarioBuilder();
var dynamicPolicyBuilder = new DynamicPolicyBuilder();
string json = JsonConvert.SerializeObject(new
{
issuance_token = _issuanceToken,
name = _thirdPartyAttributeName
});
byte[] httpContent = System.Text.Encoding.UTF8.GetBytes(json);
var signedRequest = new RequestBuilder()
.WithBaseUri(new Uri("https://api.yoti.com/api/v1/attribute-registry"))
.WithEndpoint("/attribute/revoke")
.WithHttpMethod(HttpMethod.Put)
.WithHeader("X-Yoti-Auth-Id", _clientSdkId)
.WithKeyPair(_keyPair)
.WithContent(httpContent)
.Build();
var result = signedRequest.Execute(_httpClient).Result;
type Payload struct {
Token string `json:"issuance_token"`
Name string `json:"name"`
}
body, err := json.Marshal(Payload{
Token: issuingAttributes.Token(),
Name: "com.example.someAttribute",
})
if err != nil {
panic(err)
}
headers := map[string][]string{
"X-Yoti-Auth-Id": {"CLIENT_SDK_ID"},
}
decodedKey, err := cryptoutil.ParseRSAKey(key)
if err != nil {
panic(err)
}
request, err := requests.SignedRequest{
Key: decodedKey,
HTTPMethod: http.MethodPut,
BaseURL: "https://api.yoti.com/api/v1/attribute-registry",
Endpoint: "/attribute/revoke",
Headers: headers,
Body: body,
payload = {
issuance_token: attribute_issuance_details.token,
name: 'com.example.someAttribute'
}
request = Yoti::Request
.builder
.with_base_url('https://api.yoti.com/api/v1/attribute-registry')
.with_http_method('PUT')
.with_endpoint('attribute/revoke')
.with_payload(payload)
.with_header('X-Yoti-Auth-Id', Yoti.configuration.client_sdk_id)
.build
response = request.execute
Last updated on
Was this page helpful?
Next to read:
Display configurationGot a question? Contact us here.
Welcome
Digital ID Match