Skip to content

Commit

Permalink
refactor(RAMFMessage): Use setMilliseconds() from data-fns
Browse files Browse the repository at this point in the history
Instead of custom function.
  • Loading branch information
gnarea committed Aug 5, 2022
1 parent 23144c4 commit f87e3eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions src/lib/_utils.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/lib/messages/RAMFMessage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import bufferToArray from 'buffer-to-arraybuffer';
import { setMilliseconds } from 'date-fns';
import uuid4 from 'uuid4';

import { makeDateWithSecondPrecision } from '../_utils';
import { EnvelopedData, SessionEnvelopedData } from '../crypto_wrappers/cms/envelopedData';
import { SignatureOptions } from '../crypto_wrappers/cms/SignatureOptions';
import Certificate from '../crypto_wrappers/x509/Certificate';
Expand Down Expand Up @@ -42,7 +42,7 @@ export default abstract class RAMFMessage<Payload extends PayloadPlaintext> {
options: Partial<MessageOptions> = {},
) {
this.id = options.id || uuid4();
this.creationDate = makeDateWithSecondPrecision(options.creationDate);
this.creationDate = setMilliseconds(options.creationDate ?? new Date(), 0);
this.ttl = options.ttl !== undefined ? options.ttl : DEFAULT_TTL_SECONDS;

this.senderCaCertificateChain =
Expand Down

0 comments on commit f87e3eb

Please sign in to comment.