Class Sigchain

Hierarchy

  • CreateDestroyStartStop
    • Sigchain

Constructors

  • Parameters

    • __namedParameters: {
          db: DB;
          keyRing: KeyRing;
          logger: Logger;
      }
      • db: DB
      • keyRing: KeyRing
      • logger: Logger

    Returns Sigchain

Properties

[initLock]: RWLockWriter
db: DB
dbClaimsPath: readonly (string | Buffer)[] = ...
dbLastClaimIdPath: readonly (string | Buffer)[] = ...

Maintain last ClaimId to preserve monotonicity across process restarts. The ClaimId provides a globally unique ID that is time-sortable. Sigchain/lastClaimId -> {raw(ClaimId)}

dbLastSequenceNumberPath: readonly (string | Buffer)[] = ...

Maintain last sequence number to preserve monotonicity across process restarts. The sequence number provides cardinal and ordinal information regarding a claim. Sigchain/lastSequenceNumber -> {SequenceNumber}}

dbPath: readonly (string | Buffer)[] = ...
dbSignaturesPath: readonly (string | Buffer)[] = ...
generateClaimId: (() => ClaimId)

Type declaration

generateSequenceNumber: (() => number)

Type declaration

    • (): number
    • Returns number

keyRing: KeyRing
logger: Logger

Accessors

  • get [destroyed](): boolean
  • Returns boolean

  • get [eventHandled](): ReadonlyWeakSet<Event>
  • Returns ReadonlyWeakSet<Event>

  • get [eventHandlers](): ReadonlyMap<string, Set<EventHandlerInfo>>
  • Returns ReadonlyMap<string, Set<EventHandlerInfo>>

  • get [eventTarget](): EventTarget
  • Returns EventTarget

  • get [handleEventError](): ((evt) => void)
  • Returns ((evt) => void)

      • (evt): void
      • Parameters

        • evt: EventError

        Returns void

  • get [running](): boolean
  • Returns boolean

  • get [statusP](): Promise<Status>
  • Returns Promise<Status>

  • get [status](): Status
  • Returns Status

Methods

  • Appends a claim (of any type) to the sigchain. For ClaimInput, it will be JSON encoded. Remember that undefined properties are deleted. While undefined values in arrays are converted to null.

    Parameters

    Returns Promise<[ClaimId, SignedClaim]>

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Parameters

    • event: Event

    Returns boolean

  • Get claims

    Parameters

    • __namedParameters: {
          limit?: number;
          order?: "asc" | "desc";
          seek?: ClaimId;
      } = {}
      • Optional limit?: number
      • Optional order?: "asc" | "desc"
      • Optional seek?: ClaimId
    • Optional tran: DBTransaction

    Returns AsyncGenerator<[ClaimId, Claim], any, unknown>

  • Gets the last claim ID for preserving monotonicity over restarts

    Parameters

    • Optional tran: DBTransaction

    Returns Promise<undefined | ClaimId>

  • Gets the last sequence number for preserving monotonicity over restarts

    Parameters

    • Optional tran: DBTransaction

    Returns Promise<undefined | number>

  • Get signed claims

    Parameters

    • __namedParameters: {
          limit?: number;
          order?: "asc" | "desc";
          seek?: ClaimId;
      } = {}
      • Optional limit?: number
      • Optional order?: "asc" | "desc"
      • Optional seek?: ClaimId
    • Optional tran: DBTransaction

    Returns AsyncGenerator<[ClaimId, SignedClaim], any, unknown>

  • Mutually exclude the last claim ID. Use this to ensure claim appending is serialised.

    Parameters

    • tran: DBTransaction

    Returns Promise<void>

  • Call this method when the KeyRing changes This should be replaced with rxjs later

    Returns Promise<void>

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

  • Parameters

    • __namedParameters: {
          fresh?: boolean;
      } = {}
      • Optional fresh?: boolean

    Returns Promise<void>

  • Parameters

    • __namedParameters: {
          db: DB;
          fresh?: boolean;
          keyRing: KeyRing;
          logger?: Logger;
      }
      • db: DB
      • Optional fresh?: boolean
      • keyRing: KeyRing
      • Optional logger?: Logger

    Returns Promise<Sigchain>

Generated using TypeDoc