Global

Members

(constant) ORIGINAL_API

The API of the server used for https://mangrove.reviews

Source:

(constant) ORIGINAL_API

The API of the server used for https://mangrove.reviews

Source:

Methods

batchAggregate(query, apiopt) → {Promise.<(BatchReturn|null)>}

Retrieve aggregates for multiple subjects or issuers.

Parameters:
Name Type Attributes Default Description
query Object

Batch query listing identifiers to use for fetching.

Properties
Name Type Attributes Description
subs Array.<string> <optional>

A list of subject URIs to get aggregates for.

pems Array.<string> <optional>

A list of issuer PEM public keys to get aggregates for.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Batch aggregation data or null if no query params

Type
Promise.<(BatchReturn|null)>

batchAggregate(query, apiopt) → {Promise.<(BatchReturn|null)>}

Retrieve aggregates for multiple subjects or issuers.

Parameters:
Name Type Attributes Default Description
query Object

Batch query listing identifiers to use for fetching.

Properties
Name Type Attributes Description
subs Array.<string> <optional>

A list of subject URIs to get aggregates for.

pems Array.<string> <optional>

A list of issuer PEM public keys to get aggregates for.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Batch aggregation data or null if no query params

Type
Promise.<(BatchReturn|null)>

(async) deleteReview(keypair, reviewSignature, apiopt) → {Promise.<boolean>}

Delete an existing review.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair must be the same keypair used for the original review.

reviewSignature string

Signature of the review to delete.

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) deleteReview(keypair, reviewSignature, apiopt) → {Promise.<boolean>}

Delete an existing review.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair must be the same keypair used for the original review.

reviewSignature string

Signature of the review to delete.

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) editReview(keypair, reviewSignature, updates, apiopt) → {Promise.<boolean>}

Edit an existing review with updated content.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair must be the same keypair used for the original review.

reviewSignature string

Signature of the review to edit.

updates Object

Object containing fields to update (rating, opinion, images, metadata).

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) editReview(keypair, reviewSignature, updates, apiopt) → {Promise.<boolean>}

Edit an existing review with updated content.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair must be the same keypair used for the original review.

reviewSignature string

Signature of the review to edit.

updates Object

Object containing fields to update (rating, opinion, images, metadata).

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) generateKeypair() → {Promise.<Keypair>}

Generate a new user identity, which can be used for signing reviews and stored for later. WebCrypto key pair with privateKey and publicKey

Source:
Returns:

An ECDSA WebCrypto keypair

Type
Promise.<Keypair>

(async) generateKeypair() → {Promise.<Keypair>}

Generate a new user identity, which can be used for signing reviews and stored for later. WebCrypto key pair with privateKey and publicKey

Source:
Returns:

An ECDSA WebCrypto keypair

Type
Promise.<Keypair>

getIssuer(pem, apiopt) → {Promise.<Issuer>}

Get aggregate information about the reviewer.

Parameters:
Name Type Attributes Default Description
pem string

Reviewer public key in PEM format.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Issuer data

Type
Promise.<Issuer>

getIssuer(pem, apiopt) → {Promise.<Issuer>}

Get aggregate information about the reviewer.

Parameters:
Name Type Attributes Default Description
pem string

Reviewer public key in PEM format.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Issuer data

Type
Promise.<Issuer>

getReviews(query, apiopt) → {Promise.<Reviews>}

Retrieve reviews which fulfill the query.

Parameters:
Name Type Attributes Default Description
query Object

Query to be passed to API, see the API documentation for examples.

Properties
Name Type Attributes Description
q string <optional>

Search for reviews that have this string in sub or opinion field.

signature string <optional>

Review with this signature value.

kid string <optional>

Reviews by issuer with the following PEM public key.

iat number <optional>

Reviews issued at this UNIX time.

gt_iat number <optional>

Reviews with UNIX timestamp greater than this.

sub string <optional>

Reviews of the given subject URI.

rating number <optional>

Reviews with the given rating.

opinion string <optional>

Reviews with the given opinion.

limit number <optional>

Maximum number of reviews to be returned.

limit number <optional>

Maximum number of reviews to be returned.

latest_edits_only number <optional>

For edited reviews, return only the most recent version (true by default).

opinionated boolean <optional>

Get only reviews with opinion text.

examples boolean <optional>

Include reviews of example subjects.

issuers boolean <optional>

Include aggregate information about review issuers.

maresi_subjects boolean <optional>

Include aggregate information about reviews of returned reviews.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Reviews data

Type
Promise.<Reviews>

getReviews(query, apiopt) → {Promise.<Reviews>}

Retrieve reviews which fulfill the query.

Parameters:
Name Type Attributes Default Description
query Object

Query to be passed to API, see the API documentation for examples.

Properties
Name Type Attributes Description
q string <optional>

Search for reviews that have this string in sub or opinion field.

signature string <optional>

Review with this signature value.

kid string <optional>

Reviews by issuer with the following PEM public key.

iat number <optional>

Reviews issued at this UNIX time.

gt_iat number <optional>

Reviews with UNIX timestamp greater than this.

sub string <optional>

Reviews of the given subject URI.

rating number <optional>

Reviews with the given rating.

opinion string <optional>

Reviews with the given opinion.

limit number <optional>

Maximum number of reviews to be returned.

limit number <optional>

Maximum number of reviews to be returned.

latest_edits_only number <optional>

For edited reviews, return only the most recent version (true by default).

opinionated boolean <optional>

Get only reviews with opinion text.

examples boolean <optional>

Include reviews of example subjects.

issuers boolean <optional>

Include aggregate information about review issuers.

maresi_subjects boolean <optional>

Include aggregate information about reviews of returned reviews.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Reviews data

Type
Promise.<Reviews>

getSubject(uri, apiopt) → {Promise.<Subject>}

Get aggregate information about the review subject.

Parameters:
Name Type Attributes Default Description
uri string

URI of the review subject.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Subject data

Type
Promise.<Subject>

getSubject(uri, apiopt) → {Promise.<Subject>}

Get aggregate information about the review subject.

Parameters:
Name Type Attributes Default Description
uri string

URI of the review subject.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Subject data

Type
Promise.<Subject>

(async) jwkToKeypair(jwk) → {Promise.<{publicKey: CryptoKey, privateKey: CryptoKey}>}

Come back from JWK representation to representation which allows for signing. Import keys which were exported with keypairToJwk.

Parameters:
Name Type Description
jwk Object

Private JSON Web Key (JWK) to be converted in to a WebCrypto keypair.

Source:
Returns:

WebCrypto keypair

Type
Promise.<{publicKey: CryptoKey, privateKey: CryptoKey}>

(async) jwkToKeypair(jwk) → {Promise.<{publicKey: CryptoKey, privateKey: CryptoKey}>}

Come back from JWK representation to representation which allows for signing. Import keys which were exported with keypairToJwk.

Parameters:
Name Type Description
jwk Object

Private JSON Web Key (JWK) to be converted in to a WebCrypto keypair.

Source:
Returns:

WebCrypto keypair

Type
Promise.<{publicKey: CryptoKey, privateKey: CryptoKey}>

(async) keypairToJwk(keypair) → {Promise.<JsonWebKey>}

Exports a keypair to JSON Web Key (JWK) of the private key. JWK is a format that can be then used to stringify and store. You can later import it back with jwkToKeypair.

Parameters:
Name Type Description
keypair Keypair

WebCrypto key pair can be generated with generateKeypair.

Source:
Returns:

JWK representation of the keypair

Type
Promise.<JsonWebKey>

(async) keypairToJwk(keypair) → {Promise.<JsonWebKey>}

Exports a keypair to JSON Web Key (JWK) of the private key. JWK is a format that can be then used to stringify and store. You can later import it back with jwkToKeypair.

Parameters:
Name Type Description
keypair Keypair

WebCrypto key pair can be generated with generateKeypair.

Source:
Returns:

JWK representation of the keypair

Type
Promise.<JsonWebKey>

(async) pemToJwk(pemPrivateKey) → {Promise.<JsonWebKey>}

Convert a PEM private key to JWK format for use with Mangrove

Parameters:
Name Type Description
pemPrivateKey string

The private key in PEM format

Source:
Returns:

The private key in JWK format

Type
Promise.<JsonWebKey>

(async) pemToJwk(pemPrivateKey) → {Promise.<JsonWebKey>}

Convert a PEM private key to JWK format for use with Mangrove

Parameters:
Name Type Description
pemPrivateKey string

The private key in PEM format

Source:
Returns:

The private key in JWK format

Type
Promise.<JsonWebKey>

(async) privateToPem(key) → {Promise.<string>}

Get PEM represenation of the user "password".

Parameters:
Name Type Description
key CryptoKey

Private WebCrypto key to be exported.

Source:
Returns:

PEM format of the private key

Type
Promise.<string>

(async) privateToPem(key) → {Promise.<string>}

Get PEM represenation of the user "password".

Parameters:
Name Type Description
key CryptoKey

Private WebCrypto key to be exported.

Source:
Returns:

PEM format of the private key

Type
Promise.<string>

(async) publicToPem(key) → {Promise.<string>}

Get PEM representation of public reviewer identity. This format can be found in the kid field of a Mangrove Review Header.

Parameters:
Name Type Description
key CryptoKey

Public WebCrypto key to be exported.

Source:
Returns:

PEM format of the public key

Type
Promise.<string>

(async) publicToPem(key) → {Promise.<string>}

Get PEM representation of public reviewer identity. This format can be found in the kid field of a Mangrove Review Header.

Parameters:
Name Type Description
key CryptoKey

Public WebCrypto key to be exported.

Source:
Returns:

PEM format of the public key

Type
Promise.<string>

(async) rateReview(keypair, reviewSignature, rating, opinionopt, apiopt) → {Promise.<boolean>}

Rate an existing review.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair can be any valid keypair.

reviewSignature string

Signature of the review to rate.

rating number

Rating value between 0 and 100.

opinion string <optional>

Optional opinion text about the review.

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) rateReview(keypair, reviewSignature, rating, opinionopt, apiopt) → {Promise.<boolean>}

Rate an existing review.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair can be any valid keypair.

reviewSignature string

Signature of the review to rate.

rating number

Rating value between 0 and 100.

opinion string <optional>

Optional opinion text about the review.

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) reportAbuseReview(keypair, reviewSignature, reasonopt, apiopt) → {Promise.<boolean>}

Report abuse for an existing review.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair can be any valid keypair.

reviewSignature string

Signature of the review to report.

reason string <optional>

Optional reason for the abuse report.

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) reportAbuseReview(keypair, reviewSignature, reasonopt, apiopt) → {Promise.<boolean>}

Report abuse for an existing review.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair can be any valid keypair.

reviewSignature string

Signature of the review to report.

reason string <optional>

Optional reason for the abuse report.

api string <optional>
ORIGINAL_API

API endpoint used for the submission.

Source:
Returns:

Result of the submission.

Type
Promise.<boolean>

(async) signAndSubmitReview(keypair, payload, apiopt) → {Promise.<boolean>}

Composition of signReview and submitReview.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair can be generated with generateKeypair.

payload Payload

Base Payload to be cleaned, it will be mutated.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Result of the submission

Type
Promise.<boolean>

(async) signAndSubmitReview(keypair, payload, apiopt) → {Promise.<boolean>}

Composition of signReview and submitReview.

Parameters:
Name Type Attributes Default Description
keypair Keypair

WebCrypto keypair can be generated with generateKeypair.

payload Payload

Base Payload to be cleaned, it will be mutated.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Result of the submission

Type
Promise.<boolean>

(async) signReview(keypair, payload) → {Promise.<string>}

Assembles JWT from base payload, mutates the payload as needed.

Parameters:
Name Type Description
keypair Keypair

WebCrypto keypair, can be generated with generateKeypair.

payload Payload

Base Payload to be cleaned, it will be mutated.

Source:
Returns:

Mangrove Review encoded as JWT.

Type
Promise.<string>

(async) signReview(keypair, payload) → {Promise.<string>}

Assembles JWT from base payload, mutates the payload as needed.

Parameters:
Name Type Description
keypair Keypair

WebCrypto keypair, can be generated with generateKeypair.

payload Payload

Base Payload to be cleaned, it will be mutated.

Source:
Returns:

Mangrove Review encoded as JWT.

Type
Promise.<string>

submitReview(jwt, apiopt) → {Promise.<boolean>}

Submit a signed review to be stored in the database.

Parameters:
Name Type Attributes Default Description
jwt string

Signed review in JWT format.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Resolves to "true" in case of successful insertion or rejects with errors.

Type
Promise.<boolean>

submitReview(jwt, apiopt) → {Promise.<boolean>}

Submit a signed review to be stored in the database.

Parameters:
Name Type Attributes Default Description
jwt string

Signed review in JWT format.

api string <optional>
ORIGINAL_API

API endpoint used to fetch the data.

Source:
Returns:

Resolves to "true" in case of successful insertion or rejects with errors.

Type
Promise.<boolean>