# TimeStampProvider

## Content

# Class: TimeStampProvider

Generates a timestamp token by sending a time-stamp request to a Time Stamping Authority (TSA) server.

## Implements

- [`TimeStampProviderBase`](../interfaces/TimeStampProviderBase)

## Constructors

### Constructor

```ts
new TimeStampProvider(serverUrl, externalResourcesOptions?): TimeStampProvider;
```

Creates a new TimeStampProvider.

#### Parameters

##### serverUrl

`string`

The uniform resource identifier for the Time Stamping Authority (TSA) server providing the time-stamp.

##### externalResourcesOptions?

[`ExternalResourcesOptions`](../interfaces/ExternalResourcesOptions)

#### Returns

`TimeStampProvider`

## Accessors

### externalResourcesOptions

#### Get Signature

```ts
get externalResourcesOptions(): ExternalResourcesOptions;
```

Gets configuration options used to retrieve external TSA response.

##### Returns

[`ExternalResourcesOptions`](../interfaces/ExternalResourcesOptions)

The current external resources configuration, or `undefined`
if default behavior is used.

#### Set Signature

```ts
set externalResourcesOptions(value): void;
```

Sets configuration options used to retrieve external TSA response.

##### Parameters

###### value

[`ExternalResourcesOptions`](../interfaces/ExternalResourcesOptions)

The external resources configuration to apply,
or `undefined` to use the default behavior.

##### Returns

`void`

***

### hashAlgorithmOID

#### Get Signature

```ts
get hashAlgorithmOID(): string;
```

Gets the object identifier (OID) of hash algorithm used to encode the time-stamp request,
default is <b>SHA-256</b>.
Note! The list of supported algorithms defined by the TSA server used.

##### Returns

`string`

#### Set Signature

```ts
set hashAlgorithmOID(value): void;
```

Sets the object identifier (OID) of hash algorithm used to encode the time-stamp request,
default is <b>SHA-256</b>.
Note! The list of supported algorithms defined by the TSA server used.

##### Parameters

###### value

`string`

##### Returns

`void`

***

### serverUrl

#### Get Signature

```ts
get serverUrl(): string;
```

Gets the uniform resource identifier for the Time Stamping Authority (TSA) server providing the time-stamp.

##### Returns

`string`

#### Set Signature

```ts
set serverUrl(value): void;
```

Sets the uniform resource identifier for the Time Stamping Authority (TSA) server providing the time-stamp.

##### Parameters

###### value

`string`

##### Returns

`void`

## Methods

### buildTimeStampToken()

```ts
buildTimeStampToken(dataHash, _): Promise<Uint8Array<ArrayBufferLike>>;
```

Generates a timestamp token (RFC 3161) for the provided data hash.

#### Parameters

##### dataHash

`Uint8Array`

The data hash to be timestamped.

##### \_

[`TimeStampParams`](../type-aliases/TimeStampParams)

#### Returns

`Promise`&lt;`Uint8Array`&lt;`ArrayBufferLike`&gt;&gt;

A promise that resolves to a DER-encoded timestamp token.

#### Implementation of

[`TimeStampProviderBase`](../interfaces/TimeStampProviderBase).[`buildTimeStampToken`](../interfaces/TimeStampProviderBase#buildtimestamptoken)

***

### getTimeStampParams()

```ts
getTimeStampParams(): Promise<TimeStampParams>;
```

Prepares parameters required for the first stage of the timestamping process.

This method performs validation, initializes timestamping-related data,
and collects all inputs required for building the final timestamp container.
It corresponds to the "preparation stage" of timestamping.

#### Returns

`Promise`&lt;[`TimeStampParams`](../type-aliases/TimeStampParams)&gt;

A [TimeStampParams](../type-aliases/TimeStampParams) object containing parameters required for timestamp generation

#### Throws

If the configured timestamp format is invalid or unsupported.

#### Implementation of

[`TimeStampProviderBase`](../interfaces/TimeStampProviderBase).[`getTimeStampParams`](../interfaces/TimeStampProviderBase#gettimestampparams)
