@calimero-network/mero-js 29.7.4 → 29.7.5

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/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 page = container[method];
1731
- try {
1732
- return await page.call(container, options);
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 stuck(error) {
1740
- return /request is already pending/i.test(
1741
- error?.message?.toString() ?? ""
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))