| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System.Text.Json; |
| | 5 | |
|
| | 6 | | namespace Azure.Security.KeyVault.Secrets |
| | 7 | | { |
| | 8 | | internal class SecretBackup : IJsonDeserializable, IJsonSerializable |
| | 9 | | { |
| 16 | 10 | | public byte[] Value { get; set; } |
| | 11 | |
|
| | 12 | | void IJsonDeserializable.ReadProperties(JsonElement json) |
| | 13 | | { |
| 4 | 14 | | if (json.TryGetProperty("value", out JsonElement value)) |
| | 15 | | { |
| 4 | 16 | | Value = Base64Url.Decode(value.GetString()); |
| | 17 | | } |
| 4 | 18 | | } |
| | 19 | |
|
| | 20 | | void IJsonSerializable.WriteProperties(Utf8JsonWriter json) |
| | 21 | | { |
| 4 | 22 | | json.WriteString("value", Base64Url.Encode(Value)); |
| 4 | 23 | | } |
| | 24 | | } |
| | 25 | | } |