diff --git a/ui/src/gear/docket/types.ts b/ui/src/gear/docket/types.ts index c35399b5..eb3fd7f8 100644 --- a/ui/src/gear/docket/types.ts +++ b/ui/src/gear/docket/types.ts @@ -1,4 +1,5 @@ import { Cass } from '../hood'; +import { Seal } from '../permissions'; export type DeskStatus = 'active' | 'suspended'; export type DocketHref = DocketHrefSite | DocketHrefGlob; @@ -54,6 +55,8 @@ export interface Treaty extends Docket { desk: string; cass: Cass; hash: string; + bill: string[]; + seal: Seal; } export interface Charges { diff --git a/ui/src/gear/index.ts b/ui/src/gear/index.ts index 9e87d9af..32fc330a 100644 --- a/ui/src/gear/index.ts +++ b/ui/src/gear/index.ts @@ -12,7 +12,5 @@ export * as docket from './docket'; export * from './docket'; export * as utils from './utils'; export * from './utils'; - -// TODO: Userspace Permissions -// export * from './permissions'; -// export * as permissions from './permissions'; +export * from './permissions'; +export * as permissions from './permissions'; diff --git a/ui/src/gear/permissions/index.ts b/ui/src/gear/permissions/index.ts new file mode 100644 index 00000000..e06143cf --- /dev/null +++ b/ui/src/gear/permissions/index.ts @@ -0,0 +1,2 @@ +export * from './lib'; +export * from './types'; diff --git a/ui/src/gear/permissions/lib.ts b/ui/src/gear/permissions/lib.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/ui/src/gear/permissions/lib.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/ui/src/gear/permissions/types.ts b/ui/src/gear/permissions/types.ts new file mode 100644 index 00000000..1af1631c --- /dev/null +++ b/ui/src/gear/permissions/types.ts @@ -0,0 +1,78 @@ + +type PermType = "super" | "watch" | "write" | "reads" | "press"; + +type Vane = 'ames' | 'behn' | 'clay' | 'dill' | 'eyre' | 'gall' | 'iris' | 'jael' | 'khan'; + +type Tail = { + jump?: boolean; + care?: string | null; + desk?: string | null; + dude?: string | null; + path?: string | null; + ship?: string | null; + spur?: string | null; + vane?: string | null; +} | null; + + +export interface Perm { + name: PermType; + vane: Vane | null; + tail: Tail; +} + +export type Seal = Perm[]; + +export interface PermSummary { + desc: string; + // TODO: per tinnus, "have" is meant to say whether the app already has all / + // any of / none of the perms in question but currently it doesn't, it just + // always says nil. + have: "nil" + pers: Perm[]; + warn: string | null; +} + +/** + * A passport-formatted permission + */ +export interface PassportPerm { + kind: { + nom: string; + pes: PermSummary[] + } +} + +export interface AppPerm { + pes: { + node: PermSummary[] + }; + app: string; +} + +/** + * Per lib/perms.hoon, Passport is intended for consumption by permission + * management frontends. + */ +export interface Passport { + /** + * Categorized perms + */ + rad: PassportPerm[]; + /** + * Dangerous perms + */ + sys: PassportPerm[]; + /** + * All apps perms + */ + any: PassportPerm[]; + /** + * Unknown app perms + */ + new: PassportPerm[]; + /** + * Specific app perms + */ + app: AppPerm[]; +}