Managing Permissions

Types

type InviteLevel = 'read' | 'write' | 'admin' | 'block'

// 'admin' allows read + write + admin
// 'write' allows read + write
// 'read' allows only read

Methods

These can only be done by the Tome owner.

setPermissions

store.setPermissions(permissions: Perm)

Params: the new permissions to set.

Returns: Promise<void>

Update a store's permissions after initialization.

// store is one of: KeyValueStore, LogStore, or FeedStore
await store.setPermissions({
    read: 'our',
    write: 'our'
    admin: 'our'
})

inviteShip

store.inviteShip(ship: string, level: InviteLevel)

Params: the ship to set permissions for and the level to set to.

Returns: Promise<void>

Set permissions for a specific ship. Invites take precedence over bucket-level permissions.

// store is one of: KeyValueStore, LogStore, or FeedStore
await store.inviteShip('timluc-miptev', 'admin')

blockShip

store.blockShip(ship: string)

Params: the ship to block.

Returns: Promise<void>

An alias for inviteShip(ship, 'block').

await store.blockShip('sorreg-namtyv')

Last updated