Skip to content

Commit

Permalink
fix(RAMF): Break up validate() method into two types (overloading) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea authored Aug 3, 2022
1 parent 7048cfe commit 3049bbb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/lib/messages/RAMFMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,18 @@ export default abstract class RAMFMessage<Payload extends PayloadPlaintext> {
/**
* Report whether the message is valid.
*
* @param trustedCertificates? If present, will check that the sender is authorized to send
* the message based on the trusted certificates.
* @return The certification path from the sender to one of the `trustedCertificates` (if present)
* This doesn't check whether the sender is authorised.
*/
public async validate(): Promise<null>;
/**
* Report whether the message is valid and the sender was authorised by one of the
* `trustedCertificates`.
*
* @return The certification path from the sender to one of the `trustedCertificates`
*/
public async validate(
trustedCertificates: readonly Certificate[],
): Promise<readonly Certificate[]>;
public async validate(
trustedCertificates?: readonly Certificate[],
): Promise<readonly Certificate[] | null> {
Expand Down

0 comments on commit 3049bbb

Please sign in to comment.