@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.mjs CHANGED
@@ -1594,19 +1594,13 @@ function cancelled(message) {
1594
1594
  }
1595
1595
  async function ask(method, options) {
1596
1596
  const container = navigator.credentials;
1597
- const page = container[method];
1598
- try {
1599
- return await page.call(container, options);
1600
- } catch (error) {
1601
- const own = globalThis.CredentialsContainer?.prototype?.[method];
1602
- if (!own || own === page || !stuck(error)) throw error;
1603
- return own.call(container, options);
1604
- }
1597
+ const own = globalThis.CredentialsContainer?.prototype?.[method];
1598
+ const call = own ?? container[method];
1599
+ return call.call(container, options);
1605
1600
  }
1606
- function stuck(error) {
1607
- return /request is already pending/i.test(
1608
- error?.message?.toString() ?? ""
1609
- );
1601
+ function es256First(params) {
1602
+ const es256 = params.filter((p) => p.alg === -7);
1603
+ return es256.length ? es256 : params;
1610
1604
  }
1611
1605
  function browserPasskey() {
1612
1606
  return {
@@ -1617,7 +1611,7 @@ function browserPasskey() {
1617
1611
  challenge: buf(fromB64url(o.challenge)),
1618
1612
  rp: o.rp,
1619
1613
  user: { ...o.user, id: buf(fromB64url(o.user.id)) },
1620
- pubKeyCredParams: o.pubKeyCredParams,
1614
+ pubKeyCredParams: es256First(o.pubKeyCredParams),
1621
1615
  excludeCredentials: (o.excludeCredentials ?? []).map((c) => ({
1622
1616
  type: c.type,
1623
1617
  id: buf(fromB64url(c.id))