-
Notifications
You must be signed in to change notification settings - Fork 0
/
did_method.ts
39 lines (36 loc) · 1007 Bytes
/
did_method.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
import * as identityEntitiesProto from "../../bridge/proto/identity_entities";
/**
* Represents the type of method did.
*/
export enum DidMethod {
/**
* Represents the polygon id method did.
*/
PolygonID,
/**
* Represents the polygon id test method did.
*/
PolygonIDTest,
}
export namespace DidMethod {
export function toProto(method: DidMethod): identityEntitiesProto.DidMethod {
switch (method) {
case DidMethod.PolygonID:
return identityEntitiesProto.DidMethod.POLYGON_ID
case DidMethod.PolygonIDTest:
return identityEntitiesProto.DidMethod.POLYGON_ID_TEST
}
}
export function fromProto(
method: identityEntitiesProto.DidMethod | undefined
): DidMethod {
switch (method) {
case identityEntitiesProto.DidMethod.POLYGON_ID:
return DidMethod.PolygonID;
case identityEntitiesProto.DidMethod.POLYGON_ID_TEST:
return DidMethod.PolygonIDTest;
default:
return DidMethod.PolygonID;
}
}
}