@calimero-network/mero-js 29.7.4 → 29.7.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/cloud-v2/client.js +18 -10
- package/dist/cloud-v2/passkey.d.ts +24 -5
- package/dist/cloud-v2/passkey.js +17 -14
- package/dist/index.browser.mjs +3 -3
- package/dist/index.browser.mjs.map +3 -3
- package/dist/index.cjs +16 -19
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +16 -19
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1727,19 +1727,13 @@ function cancelled(message) {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
async function ask(method, options) {
|
|
1729
1729
|
const container = navigator.credentials;
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
} catch (error) {
|
|
1734
|
-
const own = globalThis.CredentialsContainer?.prototype?.[method];
|
|
1735
|
-
if (!own || own === page || !stuck(error)) throw error;
|
|
1736
|
-
return own.call(container, options);
|
|
1737
|
-
}
|
|
1730
|
+
const own = globalThis.CredentialsContainer?.prototype?.[method];
|
|
1731
|
+
const call = own ?? container[method];
|
|
1732
|
+
return call.call(container, options);
|
|
1738
1733
|
}
|
|
1739
|
-
function
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
);
|
|
1734
|
+
function es256First(params) {
|
|
1735
|
+
const es256 = params.filter((p) => p.alg === -7);
|
|
1736
|
+
return es256.length ? es256 : params;
|
|
1743
1737
|
}
|
|
1744
1738
|
function browserPasskey() {
|
|
1745
1739
|
return {
|
|
@@ -1750,7 +1744,7 @@ function browserPasskey() {
|
|
|
1750
1744
|
challenge: buf(fromB64url(o.challenge)),
|
|
1751
1745
|
rp: o.rp,
|
|
1752
1746
|
user: { ...o.user, id: buf(fromB64url(o.user.id)) },
|
|
1753
|
-
pubKeyCredParams: o.pubKeyCredParams,
|
|
1747
|
+
pubKeyCredParams: es256First(o.pubKeyCredParams),
|
|
1754
1748
|
excludeCredentials: (o.excludeCredentials ?? []).map((c) => ({
|
|
1755
1749
|
type: c.type,
|
|
1756
1750
|
id: buf(fromB64url(c.id))
|
|
@@ -1996,8 +1990,8 @@ function pageDeployment(href) {
|
|
|
1996
1990
|
return null;
|
|
1997
1991
|
}
|
|
1998
1992
|
}
|
|
1999
|
-
function userVerificationOf(named) {
|
|
2000
|
-
return named === "required" || named === "preferred" || named === "discouraged" ? named :
|
|
1993
|
+
function userVerificationOf(named, fallback) {
|
|
1994
|
+
return named === "required" || named === "preferred" || named === "discouraged" ? named : fallback;
|
|
2001
1995
|
}
|
|
2002
1996
|
function promptFailure(error) {
|
|
2003
1997
|
const e = error;
|
|
@@ -2384,10 +2378,13 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
2384
2378
|
origin
|
|
2385
2379
|
);
|
|
2386
2380
|
const registration = await passkey.create(begin.options);
|
|
2387
|
-
const session = await this.
|
|
2381
|
+
const session = await this.confirmed(
|
|
2382
|
+
"POST",
|
|
2388
2383
|
"auth/passkey/register/finish",
|
|
2389
2384
|
{ challengeId: begin.challengeId, registration, ...invite },
|
|
2390
|
-
passkey
|
|
2385
|
+
passkey,
|
|
2386
|
+
void 0,
|
|
2387
|
+
"preferred"
|
|
2391
2388
|
);
|
|
2392
2389
|
this.useSession(session);
|
|
2393
2390
|
return session;
|
|
@@ -2778,7 +2775,7 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
2778
2775
|
deleteConfirmed(path, passkey, body = {}) {
|
|
2779
2776
|
return this.confirmed("DELETE", path, body, passkey);
|
|
2780
2777
|
}
|
|
2781
|
-
async confirmed(method, path, body, passkey, send = (b) => this.json(method, path, b)) {
|
|
2778
|
+
async confirmed(method, path, body, passkey, send = (b) => this.json(method, path, b), userVerification = "required") {
|
|
2782
2779
|
try {
|
|
2783
2780
|
return await send(body);
|
|
2784
2781
|
} catch (error) {
|
|
@@ -2787,7 +2784,7 @@ var CalimeroClient = class _CalimeroClient {
|
|
|
2787
2784
|
let assertion;
|
|
2788
2785
|
try {
|
|
2789
2786
|
assertion = await passkey.get(fromB64url(d.challenge), d.rpId, d.allowCredentials, {
|
|
2790
|
-
userVerification: userVerificationOf(d.userVerification)
|
|
2787
|
+
userVerification: userVerificationOf(d.userVerification, userVerification)
|
|
2791
2788
|
});
|
|
2792
2789
|
} catch (declined) {
|
|
2793
2790
|
throw promptFailure(declined);
|