-
Notifications
You must be signed in to change notification settings - Fork 12
/
types.ts
50 lines (40 loc) · 909 Bytes
/
types.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
import { SupportedEncodings } from "uint8arrays/util/bases"
export type Encodings = SupportedEncodings
export interface Keypair {
publicKey: Uint8Array
keyType: KeyType
sign: (msg: Uint8Array) => Promise<Uint8Array>
}
export interface Didable {
publicKeyStr: (format?: Encodings) => string
did: () => string
}
export interface ExportableKey {
export: (format?: Encodings) => Promise<string>
}
export type KeyType = 'rsa' | 'ed25519' | 'bls12-381'
export type Fact = Record<string, string>
export type Capability = {
[rsc: string]: string
cap: string
}
export type UcanHeader = {
alg: string
typ: string
ucv: string
}
export type UcanPayload = {
aud: string
exp: number
fct: Array<Fact>
iss: string
nbf: number
prf: string | null
att: Array<Capability>
nnc?: string
}
export type Ucan = {
header: UcanHeader
payload: UcanPayload
signature: string | null
}