UNPKG

@m-ld/gateway

Version:

m-ld gateway for services

36 lines (35 loc) 1.41 kB
import { fetchJson as defaultFetchJson } from '@m-ld/io-web-runtime/dist/server/fetch'; import { AccountOwnedId, AuthKey, GetAuthorisedTsIds, KeyDetail, KeyStore } from '../lib/index.js'; import { GatewayConfig } from '../server/index.js'; /** Auth key contains appid */ export interface AblyGatewayConfig extends GatewayConfig { /** * Control API access token * @see https://ably.com/docs/api/control-api#section/Authentication/bearer_auth */ ably: { apiKey: string; }; } export declare class AblyKeyStore implements KeyStore { private readonly fetchJson; private readonly domainName; constructor(cfg: GatewayConfig, fetchJson?: typeof defaultFetchJson); /** * @see https://ably.com/docs/api/control-api#tag/keys/paths/~1apps~1{app_id}~1keys/post */ mintKey(name: string): Promise<KeyDetail<AuthKey>>; /** * Note: this call works even if both name and capability are missing; and can * therefore be used to check if a keyid exists * * @see https://ably.com/docs/api/control-api#tag/keys/paths/~1apps~1{app_id}~1keys/post */ pingKey(keyid: string, getAuthorisedTsIds: GetAuthorisedTsIds): Promise<KeyDetail<AuthKey>>; ablyToAuthDetail({ key, name, status }: { key: string; name: string; status: 0 | 1; }): KeyDetail<AuthKey>; keyCapability(...tsIds: AccountOwnedId[]): any; }