@veridex/sdk 1.1.5 → 1.1.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/{EVMClient-Bmy9czkE.d.mts → EVMClient-CTOtNY8I.d.mts} +1 -1
- package/dist/auth/prepareAuth.d.mts +1 -1
- package/dist/auth/prepareAuth.js +86 -7
- package/dist/auth/prepareAuth.js.map +1 -1
- package/dist/auth/prepareAuth.mjs +1 -1
- package/dist/chains/aptos/index.d.mts +1 -1
- package/dist/chains/avalanche/index.d.mts +2 -2
- package/dist/chains/evm/index.d.mts +5 -4
- package/dist/chains/solana/index.d.mts +1 -1
- package/dist/chains/stacks/index.d.mts +1 -1
- package/dist/chains/starknet/index.d.mts +1 -1
- package/dist/chains/stellar/index.d.mts +2 -1
- package/dist/chains/sui/index.d.mts +1 -1
- package/dist/{chunk-BJH5HJL5.mjs → chunk-2CALEUER.mjs} +87 -8
- package/dist/chunk-2CALEUER.mjs.map +1 -0
- package/dist/{index-CKKUV4J7.d.mts → index-9ercn1sa.d.mts} +2 -2
- package/dist/index.d.mts +7 -6
- package/dist/index.js +94 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/dist/passkey-fh8bo2w-.d.mts +241 -0
- package/dist/passkey.d.mts +2 -182
- package/dist/passkey.js +86 -7
- package/dist/passkey.js.map +1 -1
- package/dist/passkey.mjs +1 -1
- package/dist/{types-DP2CQT8p.d.mts → types-DQ5dtU9x.d.mts} +1 -0
- package/dist/types.d.mts +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BJH5HJL5.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RegisterSessionParams, SessionValidationResult, RevokeSessionParams, SessionKey, IdentityState } from './types.mjs';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult } from './types-
|
|
3
|
+
import { C as ChainClient, a as ChainConfig, T as TransferParams, E as ExecuteParams, B as BridgeParams, W as WebAuthnSignature, D as DispatchResult, V as VaultCreationResult } from './types-DQ5dtU9x.mjs';
|
|
4
4
|
|
|
5
5
|
interface EVMClientConfig {
|
|
6
6
|
chainId: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PasskeyCredential, T as TransferParams, E as ExecuteParams, B as BridgeParams } from '../types-
|
|
1
|
+
import { P as PasskeyCredential, T as TransferParams, E as ExecuteParams, B as BridgeParams } from '../types-DQ5dtU9x.mjs';
|
|
2
2
|
|
|
3
3
|
type AuthenticateAndPrepareParams = {
|
|
4
4
|
credential: PasskeyCredential;
|
package/dist/auth/prepareAuth.js
CHANGED
|
@@ -499,7 +499,8 @@ var PasskeyManager = class _PasskeyManager {
|
|
|
499
499
|
credentialId: response.id,
|
|
500
500
|
publicKeyX: publicKey.x,
|
|
501
501
|
publicKeyY: publicKey.y,
|
|
502
|
-
keyHash
|
|
502
|
+
keyHash,
|
|
503
|
+
assurance: _PasskeyManager.assuranceFromRegistration(response) ?? void 0
|
|
503
504
|
};
|
|
504
505
|
return this.credential;
|
|
505
506
|
}
|
|
@@ -878,7 +879,8 @@ var PasskeyManager = class _PasskeyManager {
|
|
|
878
879
|
credentialId: response.id,
|
|
879
880
|
publicKeyX: publicKey.x,
|
|
880
881
|
publicKeyY: publicKey.y,
|
|
881
|
-
keyHash
|
|
882
|
+
keyHash,
|
|
883
|
+
assurance: _PasskeyManager.assuranceFromRegistration(response) ?? void 0
|
|
882
884
|
};
|
|
883
885
|
this.addCredentialToStorage(backupCredential);
|
|
884
886
|
return backupCredential;
|
|
@@ -895,17 +897,94 @@ var PasskeyManager = class _PasskeyManager {
|
|
|
895
897
|
*/
|
|
896
898
|
static parseBackupFlags(authenticatorData) {
|
|
897
899
|
try {
|
|
898
|
-
const
|
|
899
|
-
if (
|
|
900
|
-
const flags = data[32];
|
|
900
|
+
const assurance = _PasskeyManager.deriveAssurance(import_ethers2.ethers.getBytes(authenticatorData));
|
|
901
|
+
if (!assurance) return null;
|
|
901
902
|
return {
|
|
902
|
-
backupEligible:
|
|
903
|
-
backupState:
|
|
903
|
+
backupEligible: assurance.backupEligible,
|
|
904
|
+
backupState: assurance.backupState
|
|
904
905
|
};
|
|
905
906
|
} catch {
|
|
906
907
|
return null;
|
|
907
908
|
}
|
|
908
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* Derive credential assurance from raw WebAuthn authenticator data.
|
|
912
|
+
*
|
|
913
|
+
* authData layout:
|
|
914
|
+
* rpIdHash (32) | flags (1) | signCount (4) | [attestedCredentialData: aaguid (16) | ...]
|
|
915
|
+
*
|
|
916
|
+
* Flags byte: UP 0x01 | UV 0x04 | BE 0x08 | BS 0x10 | AT 0x40 | ED 0x80
|
|
917
|
+
*
|
|
918
|
+
* BE is the authoritative signal for whether a credential is device-bound or
|
|
919
|
+
* syncable. It is set by the authenticator itself — unlike a platform/user-agent
|
|
920
|
+
* guess, it correctly identifies a hardware key used on a syncing platform.
|
|
921
|
+
*
|
|
922
|
+
* @returns Assurance, or `null` if authData is too short to be valid.
|
|
923
|
+
*/
|
|
924
|
+
static deriveAssurance(authData) {
|
|
925
|
+
if (authData.length < 37) return null;
|
|
926
|
+
const flags = authData[32];
|
|
927
|
+
const backupEligible = (flags & 8) !== 0;
|
|
928
|
+
const attestedCredentialData = (flags & 64) !== 0;
|
|
929
|
+
let aaguid;
|
|
930
|
+
if (attestedCredentialData && authData.length >= 53) {
|
|
931
|
+
aaguid = import_ethers2.ethers.hexlify(authData.slice(37, 53));
|
|
932
|
+
}
|
|
933
|
+
return {
|
|
934
|
+
backupEligible,
|
|
935
|
+
backupState: (flags & 16) !== 0,
|
|
936
|
+
userVerified: (flags & 4) !== 0,
|
|
937
|
+
level: backupEligible ? "synced" : "device-bound",
|
|
938
|
+
aaguid
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Extract raw authenticator data from a registration response.
|
|
943
|
+
*
|
|
944
|
+
* Prefers the `authenticatorData` field when the authenticator provides it,
|
|
945
|
+
* and otherwise locates the `authData` byte string inside the CBOR
|
|
946
|
+
* attestation object.
|
|
947
|
+
*/
|
|
948
|
+
static extractAuthData(response) {
|
|
949
|
+
const direct = response.response.authenticatorData;
|
|
950
|
+
if (direct) {
|
|
951
|
+
try {
|
|
952
|
+
return base64URLDecode(direct);
|
|
953
|
+
} catch {
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
try {
|
|
957
|
+
const attestationObject = base64URLDecode(response.response.attestationObject);
|
|
958
|
+
let offset = 0;
|
|
959
|
+
if (attestationObject[offset] >= 160 && attestationObject[offset] <= 191) {
|
|
960
|
+
offset++;
|
|
961
|
+
}
|
|
962
|
+
const key = [104, 97, 117, 116, 104, 68, 97, 116, 97];
|
|
963
|
+
let found = false;
|
|
964
|
+
while (offset < attestationObject.length - 37) {
|
|
965
|
+
if (key.every((byte, i) => attestationObject[offset + i] === byte)) {
|
|
966
|
+
offset += key.length;
|
|
967
|
+
found = true;
|
|
968
|
+
break;
|
|
969
|
+
}
|
|
970
|
+
offset++;
|
|
971
|
+
}
|
|
972
|
+
if (!found) return null;
|
|
973
|
+
if (attestationObject[offset] === 88) {
|
|
974
|
+
offset += 2;
|
|
975
|
+
} else if (attestationObject[offset] === 89) {
|
|
976
|
+
offset += 3;
|
|
977
|
+
}
|
|
978
|
+
return attestationObject.slice(offset);
|
|
979
|
+
} catch {
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
/** Derive assurance directly from a registration response. */
|
|
984
|
+
static assuranceFromRegistration(response) {
|
|
985
|
+
const authData = _PasskeyManager.extractAuthData(response);
|
|
986
|
+
return authData ? _PasskeyManager.deriveAssurance(authData) : null;
|
|
987
|
+
}
|
|
909
988
|
/**
|
|
910
989
|
* Get the number of credentials stored locally.
|
|
911
990
|
*/
|