Options
All
  • Public
  • Public/Protected
  • All
Menu

Meeco SDK Documentation

Index

Type aliases

DecryptedItems

DecryptedItems: Pick<ItemsResponse, "meta" | "next_page_after"> & { items: DecryptedItem[] }

DecryptedItems together with response metadata if needed for paging etc.

KeystoreAPIFactory

KeystoreAPIFactory: (userAuth: IKeystoreToken, headers?: IHeaders) => KeystoreAPIFactoryInstance

Convenience for the various headers and parameters that need to be setup when constructing an API.

It avoids a lot of boilerplate in constructing arguments for an api (api keys, subscription keys etc.)

Basically, instead of

new Keystore.EncryptionSpaceApi({
 baseApi: environment.api.url,
  apiKey: (key: string) => {
   if(key === 'Meeco-Subscription-Key') return environment.keystore.subscription_key;
   if(key === 'Authorization) return user.keystore_access_token
  }
}).someMethod();

you can create a factory that returns these instances for you:

const factory = keystoreAPIFactory(environment);
const forUser = factory(userAuth);
forUser.EncryptionSpaceApi.getItems();
forUser.KeypairApi.getConnections();
// etc...

Type declaration

KeystoreAPIFactoryInstance

KeystoreAPIFactoryInstance: {[ key in KeystoreAPIName]: InstanceType<typeof Keystore[key]> }

MinimalSlot

MinimalSlot: { label?: string; name: string } | { label: string; name?: string }

Every Slot must have either a non-empty name or label

NewSlot

SDKDecryptedSlot

SDKDecryptedSlot: Omit<Slot, "encrypted_value" | "encrypted_value_verification_key"> & { value: string | null; value_verification_key: SymmetricKey | null }

After decryption all encrypted_X props are replaced with X props. In particular encrypted_value becomes value.

SlotAttributes

SlotAttributes: Omit<NestedSlotAttributes, "name" | "label">

Optional attributes which can be specified when creating a new Slot

VaultAPIFactory

VaultAPIFactory: (userAuth: IVaultToken, headers?: IHeaders) => VaultAPIFactoryInstance

Convenience for the various headers and parameters that need to be setup when constructing an API.

It avoids a lot of boilerplate in constructing arguments for an api (api keys, subscription keys etc.)

Basically, instead of

new Vault.ItemApi({
 baseApi: environment.api.url,
  apiKey: (key: string) => {
   if(key === 'Meeco-Subscription-Key') return environment.vault.subscription_key;
   if(key === 'Authorization) return user.vault_access_token
  }
}).someMethod();

you can create a factory that returns these instances for you:

const factory = vaultAPIFactory(environment);
const forUser = factory(userAuth);
forUser.ItemsAPI.getItems();
forUser.ConnectionAPI.getConnections();
// etc...

Type declaration

VaultAPIFactoryInstance

VaultAPIFactoryInstance: {[ key in VaultAPIName]: InstanceType<typeof Vault[key]> }

Variables

Const ERROR_CODES

ERROR_CODES: { InvalidSecretFormat: string; LoginFailed: string } = ...

Type declaration

  • InvalidSecretFormat: string
  • LoginFailed: string

Const SYMMETRIC_KEY_LENGTH

SYMMETRIC_KEY_LENGTH: 32 = 32

Const VALUE_VERIFICATION_KEY_LENGTH

VALUE_VERIFICATION_KEY_LENGTH: 64 = 64

Const _cryppoService

_cryppoService: __module = ...

Const mockableFactories

mockableFactories: { keystoreAPIFactory: (environment: Environment) => (userAuth: IKeystoreToken, headers?: IHeaders) => KeystoreAPIFactoryInstance; vaultAPIFactory: (Environment: any) => (UserAuth: any, IHeaders?: any) => VaultAPIFactoryInstance } = ...

Type declaration

Functions

Const configureFetch

  • configureFetch(_fetch: any): any

fetchConnectionWithId

  • fetchConnectionWithId(user: AuthData, connectionId: string, environment: Environment, log: (message: string) => void): Promise<Connection>

findConnectionBetween

  • findConnectionBetween(fromUser: AuthData, toUser: AuthData, environment: Environment, log: (message: string) => void): Promise<{ fromUserConnection: Connection; toUserConnection: Connection }>

getAllPaged

  • getAllPaged<T>(apiMethod: (cursor: NextPageSpec) => Promise<T>): Promise<T[]>
  • Sequentially get all pages in this collection. This may take a long time, as the cursor is not known until the current query has finished. If you want to stop partway, use pagedToGenerator. If the response is an object of arrays, use reducePages to flatten the result.

    Type parameters

    • T: IPagedResponse

    Parameters

    • apiMethod: (cursor: NextPageSpec) => Promise<T>

      Partially applied API method to collect pages from.

        • (cursor: NextPageSpec): Promise<T>
        • Parameters

          • cursor: NextPageSpec

          Returns Promise<T>

    Returns Promise<T[]>

indexSlotsByName

  • indexSlotsByName<S, T>(slots: S[], transform?: (_: S) => T): Record<string, S | T>
  • Index an array of Slot-like objects by their name (or label if name is missing).

    Type parameters

    Parameters

    • slots: S[]
    • Optional transform: (_: S) => T

      Optionally transform the values in the resulting map. By default returns the Slot itself.

        • (_: S): T
        • Parameters

          • _: S

          Returns T

    Returns Record<string, S | T>

Const keystoreAPIFactory

newValueVerificationKey

pagedToGenerator

  • pagedToGenerator<T>(apiMethod: (cursor: NextPageSpec) => Promise<T>): Generator<Promise<T>>
  • Returns all API calls required to visit all pages in this collection. Use this if you need to process the individual responses before proceeding with the query, e.g. when searching.

    Type parameters

    • T: IPagedResponse

    Parameters

    • apiMethod: (cursor: NextPageSpec) => Promise<T>

      Partially applied API method to collect pages from.

        • (cursor: NextPageSpec): Promise<T>
        • Parameters

          • cursor: NextPageSpec

          Returns Promise<T>

    Returns Generator<Promise<T>>

reducePages

  • reducePages<T>(pages: T[]): T
  • Join responses by appending individual components. Any object-valued properties with raise an error. Primitive-typed properties will take the last value.

    Type parameters

    • T

    Parameters

    • pages: T[]

    Returns T

reducePagesTakeLast

  • reducePagesTakeLast<T>(pages: T[]): T
  • Join responses by appending individual components. Any non-array properties will have the value of the last response.

    Type parameters

    • T

    Parameters

    • pages: T[]

    Returns T

reportIfTruncated

  • reportIfTruncated<T>(log: SimpleLogger): (pagedResult: T) => T
  • Type parameters

    • T: IPagedResponse

    Parameters

    • log: SimpleLogger

    Returns (pagedResult: T) => T

      • (pagedResult: T): T
      • Parameters

        • pagedResult: T

        Returns T

resultHasNext

  • resultHasNext(r: IPagedResponse): boolean

slotToNewSlot

  • slotToNewSlot(slot: Slot): NewSlot

toNestedClassificationNode

  • toNestedClassificationNode(node: ClassificationNode): ClassificationNodeAttributes

toNestedSlot

  • toNestedSlot(slot: Slot, classificationNodes?: ClassificationNodeAttributes[]): NestedSlotAttributes

valueVerificationHash

  • valueVerificationHash(verificationKey: SymmetricKey, value: string): string

Const vaultAPIFactory

verifyHashedValue

  • verifyHashedValue(verificationKey: SymmetricKey, value: string, hash: string): boolean

Generated using TypeDoc