decane-connect-kit 2.14.0 → 2.16.0
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 +27 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1475,7 +1475,7 @@ declare function useSignTypedData(): {
|
|
|
1475
1475
|
reset: () => void;
|
|
1476
1476
|
};
|
|
1477
1477
|
|
|
1478
|
-
declare const MIN_PASSWORD_LENGTH =
|
|
1478
|
+
declare const MIN_PASSWORD_LENGTH = 8;
|
|
1479
1479
|
declare class WeakPasswordError extends Error {
|
|
1480
1480
|
constructor(message: string);
|
|
1481
1481
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1475,7 +1475,7 @@ declare function useSignTypedData(): {
|
|
|
1475
1475
|
reset: () => void;
|
|
1476
1476
|
};
|
|
1477
1477
|
|
|
1478
|
-
declare const MIN_PASSWORD_LENGTH =
|
|
1478
|
+
declare const MIN_PASSWORD_LENGTH = 8;
|
|
1479
1479
|
declare class WeakPasswordError extends Error {
|
|
1480
1480
|
constructor(message: string);
|
|
1481
1481
|
}
|
package/dist/index.js
CHANGED
|
@@ -2805,7 +2805,7 @@ var PBKDF2_ITERATIONS = 6e5;
|
|
|
2805
2805
|
function buf2(u) {
|
|
2806
2806
|
return u.buffer.slice(u.byteOffset, u.byteOffset + u.byteLength);
|
|
2807
2807
|
}
|
|
2808
|
-
var MIN_PASSWORD_LENGTH =
|
|
2808
|
+
var MIN_PASSWORD_LENGTH = 8;
|
|
2809
2809
|
var TOO_PREDICTABLE = [
|
|
2810
2810
|
/^(.)\1+$/,
|
|
2811
2811
|
// one repeated character
|
|
@@ -3783,8 +3783,19 @@ async function createDecaneConnect(config) {
|
|
|
3783
3783
|
rpName,
|
|
3784
3784
|
prfSalt
|
|
3785
3785
|
});
|
|
3786
|
-
|
|
3787
|
-
|
|
3786
|
+
let key = prfOutput;
|
|
3787
|
+
if (!key) {
|
|
3788
|
+
try {
|
|
3789
|
+
key = await getPrfOutput({ rpId, credentialId, prfSalt });
|
|
3790
|
+
} catch (e) {
|
|
3791
|
+
console.warn(
|
|
3792
|
+
"decane-connect-kit: the new credential did not return a PRF output; it cannot wrap the share.",
|
|
3793
|
+
e
|
|
3794
|
+
);
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
if (!key) throw new WebAuthnNotSupportedError();
|
|
3798
|
+
const wrappingKey = await importAesKey(key);
|
|
3788
3799
|
const iv = generateRandomBytes(12);
|
|
3789
3800
|
const wrappedDeviceShare = await aesGcmEncrypt(wrappingKey, deviceShare, iv);
|
|
3790
3801
|
const existing = await storage.getShare(userId);
|
|
@@ -4495,8 +4506,19 @@ async function createDecaneConnect(config) {
|
|
|
4495
4506
|
if (!auth) throw new ReconnectRequiredError();
|
|
4496
4507
|
if (!isPasskeySupported()) throw new WebAuthnNotSupportedError();
|
|
4497
4508
|
const stored = await storage.getShare(auth.userId);
|
|
4498
|
-
if (
|
|
4499
|
-
if (stored
|
|
4509
|
+
if (stored?.unlockMethod === "passkey") return;
|
|
4510
|
+
if (!stored) {
|
|
4511
|
+
if (!serverAssistedRecovery) throw new NewDeviceError();
|
|
4512
|
+
const tee = new TeeClient(teeUrl);
|
|
4513
|
+
const provisioned = await tee.provisionDeviceShare(auth.jwt);
|
|
4514
|
+
if (!provisioned) throw new NewDeviceError();
|
|
4515
|
+
try {
|
|
4516
|
+
await registerPasskeyForDevice(auth.userId, auth.jwt, provisioned);
|
|
4517
|
+
} finally {
|
|
4518
|
+
zeroize(provisioned);
|
|
4519
|
+
}
|
|
4520
|
+
return;
|
|
4521
|
+
}
|
|
4500
4522
|
let deviceShare;
|
|
4501
4523
|
try {
|
|
4502
4524
|
deviceShare = await aesGcmDecrypt(
|