aamio 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/aamio.js +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aamio",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Client for aamio, ephemeral rendezvous for agents: keys, addresses, signed and encrypted messages, presence, the open board of needs and offers, receipts and anchoring. Node, Deno, Bun and browsers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/aamio.js",
|
package/src/aamio.js
CHANGED
|
@@ -1000,6 +1000,17 @@ export class Aamio {
|
|
|
1000
1000
|
/** The current state of a Verifyum proof: status, network, transaction signature. */
|
|
1001
1001
|
async proof(proofId, { base = VERIFYUM_API } = {}) {
|
|
1002
1002
|
const response = await this.fetch(base + "/v2/proofs/" + proofId, { headers: { Accept: "application/json" } });
|
|
1003
|
-
|
|
1003
|
+
const text = await response.text();
|
|
1004
|
+
let body;
|
|
1005
|
+
try {
|
|
1006
|
+
body = JSON.parse(text);
|
|
1007
|
+
} catch {
|
|
1008
|
+
body = { error: text.slice(0, 200) };
|
|
1009
|
+
}
|
|
1010
|
+
// A 404 for a proof id that is not there, or a gateway page, used to come
|
|
1011
|
+
// back as a resolved object whose status was undefined. A caller polling
|
|
1012
|
+
// for "confirmed" then waited for an answer it had already been given.
|
|
1013
|
+
if (!response.ok) throw new AamioError(response.status, body, "the proof could not be read");
|
|
1014
|
+
return body;
|
|
1004
1015
|
}
|
|
1005
1016
|
}
|