Skip to content
API reference

keys

Import
import * as api from "@fungi.computer/oyster/keys";
Kind Export Description
type alias OysterKeyCapability Every capability an Oyster key may carry.
type alias OysterKeyRecord One key’s durable record, in the shape a host’s own App reads.
type alias OysterKeyPrincipal One key’s live, authenticated principal.
type alias OysterKeyScope One key’s authority, as defineGrants canonicalizes it.
type alias OysterKeyStore The Ear Tag store’s own interface, closed over Oyster’s capability vocabulary.
type alias LiveOysterKey The minimal live facts OysterHost’s keys.live port returns: enough to gate one call, never the key’s name or timestamps. null for an unknown, revoked, expired or suspended key – the same closed set keyAppAccess and keyAllowsComputerUse already treat as no authority.
constant oysterKeyVocabulary apps.use also reaches apps.read (one level, per defineGrants’s own implies): a key that may change an App’s data may also read it. computer.use has no narrower capability under it; the Computer is on or off, host-wide. agents.use selects Agent ids independently of App grants. machine.enroll admits enrollment only; it implies no App or Computer access. The enrollment owner, not this vocabulary, owns one-use consumption.
constant computerUseGrant The grant that turns on the Computer for a key, host-wide; there is no narrower target.
function allInstallations() A grant reaching every current and future installation for capability.
function keyAppAccess() One live key’s access to one installation: write when its grants admit apps.use there, read when they admit apps.read, otherwise null – including for an installation added after the key was issued, unless the key holds “All Apps” (targets: {kind: "all"}). The same shape as an Agent’s stored AppToolPolicy; its caller adds bindingName (which varies by caller: the plain installation id for the gate, the uppercased binding name for MCP) to reach the full AppToolAccess.
function keyAgentAccess() Agent access is scoped to the granted Agent ids, never inferred from App grants.
function keyAllowsComputerUse() Whether a live key’s own grants turn its Computer access on. Off by default.
function keyAllowsMachineEnroll() Whether a live key’s grants permit a one-use device enrollment.

OysterKeyCapabilitytype alias

Section titled “OysterKeyCapability”
Signature
type OysterKeyCapability =
"apps.read" | "apps.use" | "agents.use" | "computer.use" | "machine.enroll";

Every capability an Oyster key may carry.


OysterKeyRecordtype alias

Section titled “OysterKeyRecord”
Signature
type OysterKeyRecord = KeyRecord<OysterKeyCapability>;

One key’s durable record, in the shape a host’s own App reads.


OysterKeyPrincipaltype alias

Section titled “OysterKeyPrincipal”
Signature
type OysterKeyPrincipal = KeyPrincipal<OysterKeyCapability>;

One key’s live, authenticated principal.


OysterKeyScopetype alias

Section titled “OysterKeyScope”
Signature
type OysterKeyScope = Scope<OysterKeyCapability>;

One key’s authority, as defineGrants canonicalizes it.


OysterKeyStoretype alias

Section titled “OysterKeyStore”
Signature
type OysterKeyStore = KeyStore<OysterKeyCapability>;

The Ear Tag store’s own interface, closed over Oyster’s capability vocabulary.


LiveOysterKeytype alias

Section titled “LiveOysterKey”
Signature
type LiveOysterKey = Readonly<{
keyId: string;
owner: string;
grantVersion: number;
grants: readonly Grant<OysterKeyCapability>[];
}>;

The minimal live facts OysterHost’s keys.live port returns: enough to gate one call, never the key’s name or timestamps. null for an unknown, revoked, expired or suspended key – the same closed set keyAppAccess and keyAllowsComputerUse already treat as no authority.

oysterKeyVocabularyconstant

Section titled “oysterKeyVocabulary”
Signature
const oysterKeyVocabulary: GrantVocabulary<OysterKeyCapability>;

apps.use also reaches apps.read (one level, per defineGrants’s own implies): a key that may change an App’s data may also read it. computer.use has no narrower capability under it; the Computer is on or off, host-wide. agents.use selects Agent ids independently of App grants. machine.enroll admits enrollment only; it implies no App or Computer access. The enrollment owner, not this vocabulary, owns one-use consumption.


computerUseGrantconstant

Section titled “computerUseGrant”
Signature
const computerUseGrant: Grant<OysterKeyCapability>;

The grant that turns on the Computer for a key, host-wide; there is no narrower target.

allInstallations()function

Section titled “allInstallations()”
Signature
function allInstallations(capability): Grant<OysterKeyCapability>;

A grant reaching every current and future installation for capability.

Parameter Type
capability "apps.read" | "apps.use"

Grant<OysterKeyCapability>


keyAppAccess()function

Section titled “keyAppAccess()”
Signature
function keyAppAccess(
key,
installationId,
): {
level: "read" | "write";
revision: string;
grantedBy: string;
} | null;

One live key’s access to one installation: write when its grants admit apps.use there, read when they admit apps.read, otherwise null – including for an installation added after the key was issued, unless the key holds “All Apps” (targets: {kind: "all"}). The same shape as an Agent’s stored AppToolPolicy; its caller adds bindingName (which varies by caller: the plain installation id for the gate, the uppercased binding name for MCP) to reach the full AppToolAccess.

Parameter Type
key LiveOysterKey
installationId string

| { level: "read" | "write"; revision: string; grantedBy: string; } | null


keyAgentAccess()function

Section titled “keyAgentAccess()”
Signature
function keyAgentAccess(key, agentId): boolean;

Agent access is scoped to the granted Agent ids, never inferred from App grants.

Parameter Type
key LiveOysterKey
agentId string

boolean


keyAllowsComputerUse()function

Section titled “keyAllowsComputerUse()”
Signature
function keyAllowsComputerUse(key): boolean;

Whether a live key’s own grants turn its Computer access on. Off by default.

Parameter Type
key LiveOysterKey

boolean


keyAllowsMachineEnroll()function

Section titled “keyAllowsMachineEnroll()”
Signature
function keyAllowsMachineEnroll(key): boolean;

Whether a live key’s grants permit a one-use device enrollment.

Parameter Type
key LiveOysterKey

boolean