export function convertInvoker()

in src/common/encoding.ts [74:97]


export function convertInvoker(invoker: string | string[]): string[] {
  if (typeof invoker === 'string') {
    invoker = [invoker];
  }

  if (invoker.length === 0) {
    throw new Error('Invalid option for invoker: Must be a non-empty array.');
  }

  if (invoker.find((inv) => inv.length === 0)) {
    throw new Error('Invalid option for invoker: Must be a non-empty string.');
  }

  if (
    invoker.length > 1 &&
    invoker.find((inv) => inv === 'public' || inv === 'private')
  ) {
    throw new Error(
      "Invalid option for invoker: Cannot have 'public' or 'private' in an array of service accounts."
    );
  }

  return invoker;
}