Members
(constant) ORIGINAL_API
The API of the server used for https://mangrove.reviews
(constant) ORIGINAL_API
The API of the server used for https://mangrove.reviews
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
|
||||||||||||||
api |
string |
<optional> |
ORIGINAL_API | API endpoint used to fetch the data. |
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
|
||||||||||||||
api |
string |
<optional> |
ORIGINAL_API | API endpoint used to fetch the data. |
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. |
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. |
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. |
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. |
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
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
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. |
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. |
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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
api |
string |
<optional> |
ORIGINAL_API | API endpoint used to fetch the data. |
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
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
api |
string |
<optional> |
ORIGINAL_API | API endpoint used to fetch the data. |
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. |
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. |
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. |
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. |
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 |
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 |
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 |
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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 |
||
payload |
Payload | Base Payload to be cleaned, it will be mutated. |
||
api |
string |
<optional> |
ORIGINAL_API | API endpoint used to fetch the data. |
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 |
||
payload |
Payload | Base Payload to be cleaned, it will be mutated. |
||
api |
string |
<optional> |
ORIGINAL_API | API endpoint used to fetch the data. |
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 |
payload |
Payload | Base Payload to be cleaned, it will be mutated. |
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 |
payload |
Payload | Base Payload to be cleaned, it will be mutated. |
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. |
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. |
Returns:
Resolves to "true" in case of successful insertion or rejects with errors.
- Type
- Promise.<boolean>