delegations.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import { Key } from './key';
  2. import { DelegatedRole, SuccinctRoles } from './role';
  3. import { JSONObject, JSONValue } from './utils';
  4. type DelegatedRoleMap = Record<string, DelegatedRole>;
  5. type KeyMap = Record<string, Key>;
  6. interface DelegationsOptions {
  7. keys: KeyMap;
  8. roles?: DelegatedRoleMap;
  9. succinctRoles?: SuccinctRoles;
  10. unrecognizedFields?: Record<string, JSONValue>;
  11. }
  12. /**
  13. * A container object storing information about all delegations.
  14. *
  15. * Targets roles that are trusted to provide signed metadata files
  16. * describing targets with designated pathnames and/or further delegations.
  17. */
  18. export declare class Delegations {
  19. readonly keys: KeyMap;
  20. readonly roles?: DelegatedRoleMap;
  21. readonly unrecognizedFields?: Record<string, JSONValue>;
  22. readonly succinctRoles?: SuccinctRoles;
  23. constructor(options: DelegationsOptions);
  24. equals(other: Delegations): boolean;
  25. rolesForTarget(targetPath: string): Generator<{
  26. role: string;
  27. terminating: boolean;
  28. }>;
  29. toJSON(): JSONObject;
  30. static fromJSON(data: JSONObject): Delegations;
  31. }
  32. export {};