UnENVerse 0.42.6
Local-first desktop secrets manager — TypeScript frontend
Loading...
Searching...
No Matches
permex.ts File Reference

Client-side mirror of the permission expression language. More...

import type;
Include dependency graph for permex.ts:

Functions

function export globMatches (pattern:string, value:string)
 Same wildcard semantics as glob_matches in vault-core.
 
function export parse(src:string) if (pos !==toks.length) throw new Error('trailing input after the end of the expression')
 Parses an expression.
 

Variables

const UNIVERSAL = 'Universal'
 
export type Field = 'vault' | 'project' | 'category' | 'tag' | 'env' | 'type'
 
const FIELD_ALIASES
 
export const FIELDS
 
export const project
 
export const category
 
export const tag
 
export const env
 
export const type
 
export type Expr
 
type Tok
 
return expr
 

Detailed Description

Client-side mirror of the permission expression language.

Advisory only. This exists so the permission editor can validate syntax as you type and show "matches N of M entries" without a round trip. Enforcement lives in vault-core/src/permex.rs and is the only thing that decides real access — a browser can always lie about what it evaluated.

Semantics are kept deliberately identical to the Rust implementation: precedence NOT > AND > OR, field:* is unconditional, and a specific project predicate is never satisfied by the Universal catch-all.

Function Documentation

◆ globMatches()

function export globMatches (   pattern:string,
  value:string 
)

Same wildcard semantics as glob_matches in vault-core.

◆ if()

function export parse(src:string) if ( pos !  pos ! = =toks.length)
new

Parses an expression.

Throws with a readable message on malformed input.

Variable Documentation

◆ UNIVERSAL

const UNIVERSAL = 'Universal'

◆ Field

const Field = 'vault' | 'project' | 'category' | 'tag' | 'env' | 'type'

◆ FIELD_ALIASES

const FIELD_ALIASES

◆ FIELDS

export const FIELDS

◆ project

export const project

◆ category

export const category

◆ tag

export const tag

◆ env

export const env

◆ type

export const type

◆ Expr

export type Expr
Initial value:
=
| { kind: 'pred'; field: Field; glob: string }
| { kind: 'and'; a: Expr; b: Expr }
| { kind: 'or'; a: Expr; b: Expr }
| { kind: 'not'; a: Expr }
let kind
Definition bundle-import.ts:196
export type Field
Definition permex.ts:19
export type Expr
Definition permex.ts:36
const a
Definition utils.ts:282

◆ Tok

type Tok
Initial value:
=
| { t: 'pred'; field: Field; glob: string }
| { t: 'and' }
| { t: 'or' }
| { t: 'not' }
| { t: '(' }
| { t: ')' }

◆ expr

return expr