-
Notifications
You must be signed in to change notification settings - Fork 0
/
managed_key_params.ts
53 lines (50 loc) · 1.29 KB
/
managed_key_params.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
51
52
53
import * as keysEntitiesProto from "../../bridge/proto/keys_entities";
import { KeyProtectionLevel } from "./key_protection_level";
import { KeyType } from "./key_type";
/**
* Represents the parameters for creating a managed key.
*/
export class ManagedKeyParams {
/**
* Is the name of the managed key.
*/
public name?: string;
/**
* Is the protection level for the key.
*/
public protection: KeyProtectionLevel;
/**
* Is the type of the key.
*/
public keyType: KeyType;
/**
* Is the timestamp indicating when the key expires.
*/
public expiration?: number;
/**
* Constructs a ManagedKeyParams object with the specified parameters.
* @param protection
* @param keyType
* @param name
* @param expiration
*/
constructor(
protection: KeyProtectionLevel,
keyType: KeyType,
name?: string,
expiration?: number
) {
this.protection = protection;
this.keyType = keyType;
this.name = name;
this.expiration = expiration;
}
public toProto(): keysEntitiesProto.ManagedKeyParams {
return keysEntitiesProto.ManagedKeyParams.fromPartial({
protection: KeyProtectionLevel.toProto(this.protection),
keyType: KeyType.toProto(this.keyType),
name: this.name,
expiration: this.expiration
});
}
}