Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/origin

src/auth.ts

30 lines · 788 B · TypeScript
import {
	listOriginInstallations,
	mintInstallationAccessTokenInternal,
	resolveOriginAppId,
	resolveOriginInstallationId,
	signOriginAppJwt,
} from './token.ts'
import { type OriginAccountInput } from './types.ts'

export {
	listOriginInstallations,
	resolveOriginAppId,
	resolveOriginInstallationId,
	signOriginAppJwt,
}

/**
 * Mint an installation access token. The raw `oit_…` value is not returned.
 */
export async function mintInstallationAccessToken(
	input: OriginAccountInput & { scopes?: Array<string> } = {},
): Promise<{ installationId: string; expiresAt: string | null }> {
	const minted = await mintInstallationAccessTokenInternal(input)
	return {
		installationId: minted.installationId,
		expiresAt: minted.expiresAt,
	}
}

export default mintInstallationAccessToken