Options
All
  • Public
  • Public/Protected
  • All
Menu

LSAT-JS

Index

Type Aliases

SatisfyFinal: ((caveat: Caveat, options?: any) => boolean)

Type declaration

    • (caveat: Caveat, options?: any): boolean
    • description

      A satisfier function to evaluate if a caveat has been satisfied

      Parameters

      • caveat: Caveat

        caveat to evaluate

      • Optional options: any

        optional object to be used to make evaluation, e.g. a request object in a server

      Returns boolean

      boolean

SatisfyPrevious: ((prev: Caveat, curr: Caveat, options?: any) => boolean)

Type declaration

    • description

      A satisfier function for comparing two caveats to ensure increasing restrictiveness.

      Parameters

      • prev: Caveat

        preceding caveat

      • curr: Caveat

        current caveat

      • Optional options: any

        optional object to be used to make evaluation, e.g. a request object in a server

      Returns boolean

Variables

LATEST_VERSION: 0 = 0
SERVICES_CAVEAT_CONDITION: "services" = 'services'
SERVICE_CAPABILITIES_SUFFIX: "_capabilities" = '_capabilities'
TOKEN_ID_SIZE: 32 = 32
expirationSatisfier: Satisfier = ...
description

A satisfier for validating expiration caveats on macaroon. Used in the exported boltwallConfig TIME_CAVEAT_CONFIGS

Functions

  • createCapabilitiesSatisfier(service: string, targetCapability: string): Satisfier
  • createNewCapabilitiesCaveat(serviceName: string, _capabilities?: string | string[]): Caveat
  • createServicesSatisfier(targetService: string): Satisfier
  • decodeCapabilitiesValue(value: string): string[]
  • decodeIdentifierFromMacaroon(raw: string): string
  • decodeServicesCaveat(s: string): Error | Service[]
  • Parameters

    • s: string

      raw services string of format name:tier,name:tier

    Returns Error | Service[]

    array of Service objects or throws an error

  • encodeServicesCaveatValue(services: Service[]): string | Error
  • getCaveatsFromMacaroon(rawMac: string): Caveat[]
  • description

    utility function to get an array of caveat instances from a raw macaroon.

    Parameters

    • rawMac: string

    Returns Caveat[]

    array of caveats on the macaroon

  • A convenience wrapper for getting a base64 encoded string. We unfortunately can't use the built in tool Macaroon#bytesToBase64 because it only supports url safe base64 encoding which isn't compatible with aperture

    Parameters

    • mac: MacaroonClass

      MacaroonClass - a macaroon to convert to raw base64

    • urlSafe: boolean = false

    Returns string

    base64 string

  • description

    hasCaveat will take a macaroon and a caveat and evaluate whether or not that caveat exists on the macaroon

    Parameters

    • rawMac: string

      raw macaroon to determine caveats from

    • c: string | Caveat

      Caveat to test against macaroon

    Returns string | boolean | ErrInvalidCaveat

  • parseChallengePart(challenge: string): string
  • Helpers

    Parameters

    • challenge: string

    Returns string

  • description

    A function that verifies the caveats on a macaroon. The functionality mimics that of loop's lsat utilities.

    Parameters

    • caveats: Caveat[]

      a list of caveats to verify

    • Optional satisfiers: Satisfier | Satisfier[]

      a single satisfier or list of satisfiers used to verify caveats

    • options: object = {}

    Returns boolean

  • verifyMacaroonCaveats(rawMac: string, secret: string, satisfiers?: Satisfier | Satisfier[], options?: any): boolean
  • description

    verifyMacaroonCaveats will check if a macaroon is valid or not based on a set of satisfiers to pass as general caveat verifiers. This will also run against caveat.verifyCaveats to ensure that satisfyPrevious will validate

    Parameters

    • rawMac: string
    • secret: string

      The secret key used to sign the macaroon

    • Optional satisfiers: Satisfier | Satisfier[]

      a single satisfier or list of satisfiers used to verify caveats

    • options: any = {}

    Returns boolean

Generated using TypeDoc