keys
Import
Section titled “Import”import * as api from "@fungi.computer/oyster/keys";Exports
Section titled “Exports”| 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”type OysterKeyCapability = "apps.read" | "apps.use" | "agents.use" | "computer.use" | "machine.enroll";Every capability an Oyster key may carry.
OysterKeyRecordtype alias
Section titled “OysterKeyRecord”type OysterKeyRecord = KeyRecord<OysterKeyCapability>;One key’s durable record, in the shape a host’s own App reads.
OysterKeyPrincipaltype alias
Section titled “OysterKeyPrincipal”type OysterKeyPrincipal = KeyPrincipal<OysterKeyCapability>;One key’s live, authenticated principal.
OysterKeyScopetype alias
Section titled “OysterKeyScope”type OysterKeyScope = Scope<OysterKeyCapability>;One key’s authority, as defineGrants canonicalizes it.
OysterKeyStoretype alias
Section titled “OysterKeyStore”type OysterKeyStore = KeyStore<OysterKeyCapability>;The Ear Tag store’s own interface, closed over Oyster’s capability vocabulary.
LiveOysterKeytype alias
Section titled “LiveOysterKey”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”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”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()”function allInstallations(capability): Grant<OysterKeyCapability>;A grant reaching every current and future installation for capability.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
capability |
"apps.read" | "apps.use" |
Returns
Section titled “Returns”Grant<OysterKeyCapability>
keyAppAccess()function
Section titled “keyAppAccess()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
LiveOysterKey |
installationId |
string |
Returns
Section titled “Returns”| { level: "read" | "write"; revision: string; grantedBy:
string; } | null
keyAgentAccess()function
Section titled “keyAgentAccess()”function keyAgentAccess(key, agentId): boolean;Agent access is scoped to the granted Agent ids, never inferred from App grants.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
LiveOysterKey |
agentId |
string |
Returns
Section titled “Returns”boolean
keyAllowsComputerUse()function
Section titled “keyAllowsComputerUse()”function keyAllowsComputerUse(key): boolean;Whether a live key’s own grants turn its Computer access on. Off by default.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
LiveOysterKey |
Returns
Section titled “Returns”boolean
keyAllowsMachineEnroll()function
Section titled “keyAllowsMachineEnroll()”function keyAllowsMachineEnroll(key): boolean;Whether a live key’s grants permit a one-use device enrollment.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
LiveOysterKey |
Returns
Section titled “Returns”boolean