UNPKG

@livepeer/core

Version:

Livepeer UI Kit's core vanilla JS library.

43 lines (40 loc) 1.43 kB
type SignAccessJwtOptions = { /** * The private key used to sign the token. **This comes base64-encoded from the livepeer provider * - this should be kept as base64.** * * This can also be a CryptoKey if the key has already been imported on the client. */ privateKey: CryptoKey | string; /** * The public key corresponding to the public key. **This comes * base64-encoded from the livepeer provider - this should be kept as base64.** */ publicKey: string; /** * The playback ID which you would like to restrict access to (required). */ playbackId: string; /** * The issuer of the token. Usually a string or URL identifying your app. */ issuer: string; /** * The expiration of the token in seconds. Defaults to `86400` or one day in seconds. */ expiration?: number; /** * Custom properties added to the token. These can be used across your app to hold token state (user ID, etc). */ custom?: { [key: string]: unknown; }; }; /** * Signs a JSON Web Token which can be used to view access-restricted media. * * Throws if it cannot find SubtleCrypto in the environment. */ declare const signAccessJwt: (options: SignAccessJwtOptions) => Promise<string>; declare const importPKCS8: (pkcs8: string) => Promise<CryptoKey>; export { type SignAccessJwtOptions, importPKCS8, signAccessJwt };