@orangecheck/auth-client 2.36.0 → 2.36.1

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.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var React4 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
+ var bip322 = require('@orangecheck/bip322');
5
6
  var browser = require('@simplewebauthn/browser');
6
7
 
7
8
  function _interopNamespace(e) {
@@ -1294,6 +1295,9 @@ var OcAddressInput = React4__namespace.forwardRef(
1294
1295
  );
1295
1296
  }
1296
1297
  );
1298
+ function addressInputValue(raw) {
1299
+ return bip322.normalizeAddress(raw) ?? raw;
1300
+ }
1297
1301
 
1298
1302
  // src/sudo.tsx
1299
1303
  function redirectToSudo(args = {}) {
@@ -1935,7 +1939,7 @@ function BtcLinkForm({
1935
1939
  "data-oca-field": "",
1936
1940
  type: "text",
1937
1941
  value: addr,
1938
- onChange: (e) => setAddr(e.target.value.trim()),
1942
+ onChange: (e) => setAddr(addressInputValue(e.target.value.trim())),
1939
1943
  placeholder: "bc1q\u2026",
1940
1944
  autoCapitalize: "none",
1941
1945
  spellCheck: false,
@@ -2291,7 +2295,8 @@ var BECH32_ADDRESS = /^(bc1|tb1|bcrt1)[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{8,87}$/
2291
2295
  var BASE58_ADDRESS = /^[123mn][1-9A-HJ-NP-Za-km-z]{25,34}$/;
2292
2296
  function looksLikeBitcoinAddress(input) {
2293
2297
  const s = input.trim();
2294
- return BECH32_ADDRESS.test(s) || BASE58_ADDRESS.test(s);
2298
+ if (BECH32_ADDRESS.test(s)) return s === s.toLowerCase() || s === s.toUpperCase();
2299
+ return BASE58_ADDRESS.test(s);
2295
2300
  }
2296
2301
  function OcSignIn({
2297
2302
  audience,
@@ -2995,7 +3000,7 @@ function WalletFlow({
2995
3000
  type: "text",
2996
3001
  value: address,
2997
3002
  onChange: (e) => {
2998
- setAddress(e.target.value);
3003
+ setAddress(addressInputValue(e.target.value));
2999
3004
  if (error) setError(null);
3000
3005
  },
3001
3006
  placeholder: "bc1q\u2026 \xB7 3\u2026 \xB7 1\u2026",
@@ -3799,7 +3804,7 @@ function BondForm({
3799
3804
  "aria-describedby": `${id}-advice`,
3800
3805
  style: inputStyle,
3801
3806
  value: address,
3802
- onChange: (e) => setAddress(e.target.value),
3807
+ onChange: (e) => setAddress(addressInputValue(e.target.value)),
3803
3808
  placeholder: "bc1q\u2026",
3804
3809
  spellCheck: false,
3805
3810
  autoComplete: "off",