/
storedAttestationPolicy.ts
50 lines (43 loc) · 1.33 KB
/
storedAttestationPolicy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
*/
import { stringToBytes } from "../utils/utf8";
import { TypeDeserializer } from "../utils/typeDeserializer";
import * as Mappers from "../generated/models/mappers";
/**
* Represents a stored attestation policy sent to the attestation service.
*/
export class StoredAttestationPolicy {
constructor(value: string) {
this.attestationPolicy = stringToBytes(value);
}
/**
* Serializes a StoredAttestationPolicy object to a JSON encoded string.
*
* @returns The serialized JSON policy.
*/
serialize(): string {
return TypeDeserializer.serialize(this, Mappers.StoredAttestationPolicy);
}
/**
* Deserializes a stored attestation policy object returned from the attestation service.
*
* @param value - Raw JSON object from service to serialize as an attestation policy.
* @returns Stored attestation policy.
*/
static deserialize(value: unknown): StoredAttestationPolicy {
return TypeDeserializer.deserialize(
value,
{ StoredAttestationPolicy: Mappers.StoredAttestationPolicy },
"StoredAttestationPolicy"
) as StoredAttestationPolicy;
}
/**
* Stored attestation policy, utf8 encoded.
*/
attestationPolicy: Uint8Array;
}