@tinycloud/node-sdk 3.9.0-beta.4 → 3.9.0-beta.6
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/credential-pending-store.cjs.map +1 -1
- package/dist/credential-pending-store.d.cts +1 -1
- package/dist/credential-pending-store.d.ts +1 -1
- package/dist/credential-pending-store.js.map +1 -1
- package/dist/credentials.cjs +7 -3
- package/dist/credentials.cjs.map +1 -1
- package/dist/credentials.d.cts +1 -1
- package/dist/credentials.d.ts +1 -1
- package/dist/credentials.js +7 -3
- package/dist/credentials.js.map +1 -1
- package/dist/{email-proof-BaOqVlB-.d.cts → email-proof-B4DRizIL.d.cts} +3 -2
- package/dist/{email-proof-BaOqVlB-.d.ts → email-proof-B4DRizIL.d.ts} +3 -2
- package/dist/share-receive.cjs +7 -3
- package/dist/share-receive.cjs.map +1 -1
- package/dist/share-receive.d.cts +1 -1
- package/dist/share-receive.d.ts +1 -1
- package/dist/share-receive.js +7 -3
- package/dist/share-receive.js.map +1 -1
- package/package.json +3 -3
|
@@ -23,7 +23,7 @@ type EmailProofStep = "request" | "code" | "credential" | "session";
|
|
|
23
23
|
* | RATE_LIMITED | witness | witness `recoverable` flag decides (defaults to true); retryAfterMs set |
|
|
24
24
|
* | ISSUER_UNAVAILABLE | true | transient issuer outage (503); witness flag is honoured |
|
|
25
25
|
* | NETWORK | true | transport failure or step timeout; pending kept |
|
|
26
|
-
* | PROFILE_UNAVAILABLE | false | catalog or descriptor does not match the pinned profile |
|
|
26
|
+
* | PROFILE_UNAVAILABLE | false | catalog or descriptor does not match the pinned profile, or (local, no witness contacted) the profile is not enabled |
|
|
27
27
|
* | CODE_REJECTED | true | wrong code; witness flag decides whether another attempt is allowed |
|
|
28
28
|
* | CODE_ATTEMPTS_EXHAUSTED | false | witness proof-attempt budget spent; pending is dead |
|
|
29
29
|
* | SIGNATURE_REJECTED | true | holder binding rejected; same pending may be retried |
|
|
@@ -42,7 +42,8 @@ declare class EmailProofError extends Error {
|
|
|
42
42
|
readonly code: EmailProofErrorCode;
|
|
43
43
|
readonly retryAfterMs: number | undefined;
|
|
44
44
|
readonly recoverable: boolean;
|
|
45
|
-
|
|
45
|
+
/** `message` overrides the code's text for one refusal whose cause the shared text would misdescribe. It never carries request data. */
|
|
46
|
+
constructor(step: EmailProofStep, code: EmailProofErrorCode, retryAfterMs?: number, recoverable?: boolean, message?: string);
|
|
46
47
|
}
|
|
47
48
|
type HolderAlgorithm = "EdDSA" | "EIP191";
|
|
48
49
|
/**
|
|
@@ -23,7 +23,7 @@ type EmailProofStep = "request" | "code" | "credential" | "session";
|
|
|
23
23
|
* | RATE_LIMITED | witness | witness `recoverable` flag decides (defaults to true); retryAfterMs set |
|
|
24
24
|
* | ISSUER_UNAVAILABLE | true | transient issuer outage (503); witness flag is honoured |
|
|
25
25
|
* | NETWORK | true | transport failure or step timeout; pending kept |
|
|
26
|
-
* | PROFILE_UNAVAILABLE | false | catalog or descriptor does not match the pinned profile |
|
|
26
|
+
* | PROFILE_UNAVAILABLE | false | catalog or descriptor does not match the pinned profile, or (local, no witness contacted) the profile is not enabled |
|
|
27
27
|
* | CODE_REJECTED | true | wrong code; witness flag decides whether another attempt is allowed |
|
|
28
28
|
* | CODE_ATTEMPTS_EXHAUSTED | false | witness proof-attempt budget spent; pending is dead |
|
|
29
29
|
* | SIGNATURE_REJECTED | true | holder binding rejected; same pending may be retried |
|
|
@@ -42,7 +42,8 @@ declare class EmailProofError extends Error {
|
|
|
42
42
|
readonly code: EmailProofErrorCode;
|
|
43
43
|
readonly retryAfterMs: number | undefined;
|
|
44
44
|
readonly recoverable: boolean;
|
|
45
|
-
|
|
45
|
+
/** `message` overrides the code's text for one refusal whose cause the shared text would misdescribe. It never carries request data. */
|
|
46
|
+
constructor(step: EmailProofStep, code: EmailProofErrorCode, retryAfterMs?: number, recoverable?: boolean, message?: string);
|
|
46
47
|
}
|
|
47
48
|
type HolderAlgorithm = "EdDSA" | "EIP191";
|
|
48
49
|
/**
|
package/dist/share-receive.cjs
CHANGED
|
@@ -452,6 +452,7 @@ var MESSAGES = {
|
|
|
452
452
|
CANCELED: "Email verification was canceled.",
|
|
453
453
|
FAILED: "Email verification failed."
|
|
454
454
|
};
|
|
455
|
+
var LOCAL_PROFILE_UNAVAILABLE = "This SDK build doesn't enable the email verification profile.";
|
|
455
456
|
function rateLimitMessage(retryAfterMs) {
|
|
456
457
|
const head = "Too many codes were requested for this address.";
|
|
457
458
|
if (retryAfterMs === void 0 || !Number.isFinite(retryAfterMs) || retryAfterMs <= 0) return `${head} Try again in about an hour.`;
|
|
@@ -459,8 +460,9 @@ function rateLimitMessage(retryAfterMs) {
|
|
|
459
460
|
return `${head} Try again in ${minutes} ${minutes === 1 ? "minute" : "minutes"}.`;
|
|
460
461
|
}
|
|
461
462
|
var EmailProofError = class extends Error {
|
|
462
|
-
|
|
463
|
-
|
|
463
|
+
/** `message` overrides the code's text for one refusal whose cause the shared text would misdescribe. It never carries request data. */
|
|
464
|
+
constructor(step, code, retryAfterMs, recoverable = RECOVERABILITY[code], message) {
|
|
465
|
+
super(message ?? (code === "RATE_LIMITED" ? rateLimitMessage(retryAfterMs) : MESSAGES[code]));
|
|
464
466
|
this.name = "EmailProofError";
|
|
465
467
|
this.step = step;
|
|
466
468
|
this.code = code;
|
|
@@ -676,7 +678,9 @@ function assertHolder(holder, step, profile) {
|
|
|
676
678
|
}
|
|
677
679
|
function profilePin(profile, step, allowHeld) {
|
|
678
680
|
const entry = Object.prototype.hasOwnProperty.call(PROFILE_PINS, profile) ? PROFILE_PINS[profile] : void 0;
|
|
679
|
-
if (!entry || !entry.enabled && !(allowHeld === true && profile === HELD_PROFILE))
|
|
681
|
+
if (!entry || !entry.enabled && !(allowHeld === true && profile === HELD_PROFILE)) {
|
|
682
|
+
throw new EmailProofError(step, "PROFILE_UNAVAILABLE", void 0, void 0, LOCAL_PROFILE_UNAVAILABLE);
|
|
683
|
+
}
|
|
680
684
|
return entry;
|
|
681
685
|
}
|
|
682
686
|
function emailRequirement(address, profile) {
|