root.d.ts 996 B

1234567891011121314151617181920212223242526272829
  1. import { MetadataKind, Signed, SignedOptions } from './base';
  2. import { Key } from './key';
  3. import { Role } from './role';
  4. import { JSONObject } from './utils';
  5. type KeyMap = Record<string, Key>;
  6. type RoleMap = Record<string, Role>;
  7. export interface RootOptions extends SignedOptions {
  8. keys?: Record<string, Key>;
  9. roles?: Record<string, Role>;
  10. consistentSnapshot?: boolean;
  11. }
  12. /**
  13. * A container for the signed part of root metadata.
  14. *
  15. * The top-level role and metadata file signed by the root keys.
  16. * This role specifies trusted keys for all other top-level roles, which may further delegate trust.
  17. */
  18. export declare class Root extends Signed {
  19. readonly type = MetadataKind.Root;
  20. readonly keys: KeyMap;
  21. readonly roles: RoleMap;
  22. readonly consistentSnapshot: boolean;
  23. constructor(options: RootOptions);
  24. addKey(key: Key, role: string): void;
  25. equals(other: Root): boolean;
  26. toJSON(): JSONObject;
  27. static fromJSON(data: JSONObject): Root;
  28. }
  29. export {};