@atbash/sdk 0.10.5-dev.0 → 0.10.6-dev.0
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/dist/browser.mjs +158 -19
- package/dist/browser.mjs.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
package/dist/index.mjs
CHANGED
|
@@ -3446,11 +3446,15 @@ var Atbash = class _Atbash {
|
|
|
3446
3446
|
* response bytes via the Rust core's `verifySignature`.
|
|
3447
3447
|
*/
|
|
3448
3448
|
async judgeAction(action, context = "", options = {}) {
|
|
3449
|
-
return this.track(
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3449
|
+
return this.track("judgeAction", this.auth.pubkey, async () => {
|
|
3450
|
+
try {
|
|
3451
|
+
return await this._judgeAction(action, context, options);
|
|
3452
|
+
} catch (err) {
|
|
3453
|
+
if (!isEncryptionStateMismatch(err)) throw err;
|
|
3454
|
+
this._orgKeyFromChain = null;
|
|
3455
|
+
return await this._judgeAction(action, context, options);
|
|
3456
|
+
}
|
|
3457
|
+
});
|
|
3454
3458
|
}
|
|
3455
3459
|
async _judgeAction(action, context, options) {
|
|
3456
3460
|
if (!action?.trim()) {
|
|
@@ -4124,6 +4128,10 @@ async function safeText(resp) {
|
|
|
4124
4128
|
function errorMessage(err) {
|
|
4125
4129
|
return err instanceof Error ? err.message : String(err);
|
|
4126
4130
|
}
|
|
4131
|
+
function isEncryptionStateMismatch(err) {
|
|
4132
|
+
const msg = errorMessage(err);
|
|
4133
|
+
return msg.includes("must be a valid encryption envelope") || msg.includes("must be plaintext");
|
|
4134
|
+
}
|
|
4127
4135
|
function stringifyArgs(args) {
|
|
4128
4136
|
if (args === null || args === void 0) return "";
|
|
4129
4137
|
if (typeof args === "string") return args;
|