-
Notifications
You must be signed in to change notification settings - Fork 7
/
didRegistry.validation.ts
52 lines (49 loc) · 1.46 KB
/
didRegistry.validation.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
import {
DIDAttribute,
Encoding,
PubKeyType,
} from '@ew-did-registry/did-resolver-interface';
import { KeyType } from '@ew-did-registry/keys';
import { createCheckers, iface, enumtype } from 'ts-interface-checker';
const IS_REQ_STRING = 'string';
export const { UpdateServicePoint, UpdateDelegate, UpdatePublicKey } =
createCheckers({
UpdateServicePoint: iface([], {
did: IS_REQ_STRING,
didAttribute: enumtype({ ServicePoint: DIDAttribute.ServicePoint }),
data: iface([], {
type: enumtype({ ServicePoint: DIDAttribute.ServicePoint }),
value: iface([], {
id: IS_REQ_STRING,
hash: IS_REQ_STRING,
hashAlg: IS_REQ_STRING,
}),
}),
}),
UpdateDelegate: iface([], {
did: IS_REQ_STRING,
didAttribute: enumtype({ Authenticate: DIDAttribute.Authenticate }),
data: iface([], {
type: enumtype(PubKeyType),
value: iface([], {
id: IS_REQ_STRING,
hash: IS_REQ_STRING,
hashAlg: IS_REQ_STRING,
}),
delegate: IS_REQ_STRING,
}),
}),
UpdatePublicKey: iface([], {
did: IS_REQ_STRING,
didAttribute: enumtype({ PublicKey: DIDAttribute.PublicKey }),
data: iface([], {
type: enumtype(PubKeyType),
algo: enumtype(KeyType),
encoding: enumtype(Encoding),
value: iface([], {
publicKey: IS_REQ_STRING,
tag: IS_REQ_STRING,
}),
}),
}),
});