Skip to content

verifactu-sdk API


verifactu-sdk API / InMemoryHashStore

Class: InMemoryHashStore

Defined in: src/store/HashStore.ts:79

Default in-memory HashStore implementation.

Intended for tests, demos and short-lived CLI invocations. Production deployments should provide their own persistent store.

Example

ts
const client = new VerifactuClient({
  // ...
  hashStore: new InMemoryHashStore(),
});

Implements

Constructors

Constructor

new InMemoryHashStore(): InMemoryHashStore

Returns

InMemoryHashStore

Methods

getLast()

getLast(taxpayerNif): HashStoreEntry | null

Defined in: src/store/HashStore.ts:83

Return the last appended entry for the given taxpayer.

Parameters

taxpayerNif

string

NIF of the taxpayer whose chain is being read.

Returns

HashStoreEntry | null

The last entry, or null if the taxpayer has no previous record (i.e. the next submission must be marked PrimerRegistro='S').

Implementation of

HashStore.getLast


append()

append(taxpayerNif, entry): void

Defined in: src/store/HashStore.ts:88

Persist a freshly computed hash as the new tail of the chain.

Parameters

taxpayerNif

string

NIF of the taxpayer the chain belongs to.

entry

HashStoreEntry

The newly created record's identifier and hash.

Returns

void

Implementation of

HashStore.append

Released under the MIT license.