cilantro-sdk 0.0.19 → 0.0.21
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/api/wallets/wallets.d.ts +2 -2
- package/dist/api/wallets/wallets.d.ts.map +1 -1
- package/dist/helpers.cjs +59 -14
- package/dist/helpers.cjs.map +2 -2
- package/dist/helpers.d.ts +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.mjs +59 -13
- package/dist/helpers.mjs.map +2 -2
- package/dist/index.cjs +59 -13
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +59 -13
- package/dist/index.mjs.map +2 -2
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/startPasskeyAuthenticationDto.d.ts +12 -0
- package/dist/models/startPasskeyAuthenticationDto.d.ts.map +1 -0
- package/dist/signers/index.d.ts +1 -1
- package/dist/signers/index.d.ts.map +1 -1
- package/dist/signers/passkeyHelpers.d.ts +8 -17
- package/dist/signers/passkeyHelpers.d.ts.map +1 -1
- package/dist/wallet.cjs +7 -2
- package/dist/wallet.cjs.map +2 -2
- package/dist/wallet.d.ts +2 -2
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.mjs +7 -2
- package/dist/wallet.mjs.map +2 -2
- package/package.json +1 -1
package/dist/helpers.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { createEmailSignerHelper, getEmailSignerKeypair, signWithEmailSigner, cl
|
|
|
10
10
|
export { createPhoneSignerHelper, getPhoneSignerKeypair, signWithPhoneSigner, clearPhoneSignerCache, getPhoneSignerByPhone, type PhoneSignerConfig, type PhoneSignerOptions } from './signers/phoneSigner';
|
|
11
11
|
export { getSignerDeviceKeys, validateDeviceKey, resolveDeviceKey, findAndValidateDeviceKey, getBestDeviceIdentity, type DeviceIdentity, type DeviceKeyValidationResult } from './signers/deviceKeyHelpers';
|
|
12
12
|
export { addDeviceIdentityToSigner, replaceDeviceIdentity, addNewDeviceToSigner, canAddDeviceToSigner, type AddDeviceIdentityOptions, type ReplaceDeviceIdentityOptions } from './signers/deviceIdentityHelpers';
|
|
13
|
-
export { isWebAuthnSupported, isPlatformAuthenticatorAvailable, registerPasskey, authenticateWithPasskey,
|
|
13
|
+
export { isWebAuthnSupported, isPlatformAuthenticatorAvailable, registerPasskey, authenticateWithPasskey, formatRegistrationResponse, formatAuthenticationResponse } from './signers/passkeyHelpers';
|
|
14
14
|
export { createSigner, revokeSigner, getSigners } from './signers/signerLifecycle';
|
|
15
15
|
export { addDevice, replaceDevice, getDevices, updateDevice } from './signers/multiDeviceManager';
|
|
16
16
|
export { isValidEmail, isValidPhone, isBrowserCompatible } from './signers/signerValidation';
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC/B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EAClC,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,eAAe,EACf,uBAAuB,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB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ACvB,6BAA6B,EAC7B,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC"}
|
package/dist/helpers.mjs
CHANGED
|
@@ -873,9 +873,14 @@ var getWallets = () => {
|
|
|
873
873
|
options
|
|
874
874
|
);
|
|
875
875
|
};
|
|
876
|
-
const walletControllerStartPasskeyAuthentication2 = (id, options) => {
|
|
876
|
+
const walletControllerStartPasskeyAuthentication2 = (id, startPasskeyAuthenticationDto, options) => {
|
|
877
877
|
return customInstance(
|
|
878
|
-
{
|
|
878
|
+
{
|
|
879
|
+
url: `/wallets/${id}/signers/passkey/authenticate`,
|
|
880
|
+
method: "POST",
|
|
881
|
+
headers: { "Content-Type": "application/json" },
|
|
882
|
+
data: startPasskeyAuthenticationDto
|
|
883
|
+
},
|
|
879
884
|
options
|
|
880
885
|
);
|
|
881
886
|
};
|
|
@@ -3604,31 +3609,73 @@ function platformAuthenticatorIsAvailable() {
|
|
|
3604
3609
|
}
|
|
3605
3610
|
|
|
3606
3611
|
// src/signers/passkeyHelpers.ts
|
|
3607
|
-
function
|
|
3608
|
-
if (
|
|
3609
|
-
|
|
3612
|
+
function toBase64URL(value) {
|
|
3613
|
+
if (typeof value === "string") {
|
|
3614
|
+
if (value.includes("+") || value.includes("/") || value.includes("=")) {
|
|
3615
|
+
return value.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
3616
|
+
}
|
|
3617
|
+
return value;
|
|
3618
|
+
}
|
|
3619
|
+
let uint8Array;
|
|
3620
|
+
if (Array.isArray(value)) {
|
|
3621
|
+
uint8Array = new Uint8Array(value);
|
|
3622
|
+
} else if (value instanceof ArrayBuffer) {
|
|
3623
|
+
uint8Array = new Uint8Array(value);
|
|
3624
|
+
} else {
|
|
3625
|
+
uint8Array = value;
|
|
3610
3626
|
}
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3627
|
+
const base64 = btoa(String.fromCharCode(...uint8Array));
|
|
3628
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
3629
|
+
}
|
|
3630
|
+
function isArrayBuffer(value) {
|
|
3631
|
+
if (Array.isArray(value))
|
|
3632
|
+
return true;
|
|
3633
|
+
if (value instanceof ArrayBuffer)
|
|
3634
|
+
return true;
|
|
3635
|
+
if (value instanceof Uint8Array)
|
|
3636
|
+
return true;
|
|
3637
|
+
return false;
|
|
3614
3638
|
}
|
|
3615
3639
|
function formatRegistrationResponse(response) {
|
|
3616
3640
|
const formatted = { ...response };
|
|
3617
3641
|
if (formatted.id) {
|
|
3618
|
-
formatted.id =
|
|
3642
|
+
formatted.id = toBase64URL(formatted.id);
|
|
3619
3643
|
}
|
|
3620
3644
|
if (formatted.rawId) {
|
|
3621
|
-
formatted.rawId =
|
|
3645
|
+
formatted.rawId = toBase64URL(formatted.rawId);
|
|
3646
|
+
}
|
|
3647
|
+
if (formatted.response) {
|
|
3648
|
+
const formattedResponse = { ...formatted.response };
|
|
3649
|
+
if (isArrayBuffer(formattedResponse.clientDataJSON)) {
|
|
3650
|
+
formattedResponse.clientDataJSON = toBase64URL(formattedResponse.clientDataJSON);
|
|
3651
|
+
}
|
|
3652
|
+
if (isArrayBuffer(formattedResponse.attestationObject)) {
|
|
3653
|
+
formattedResponse.attestationObject = toBase64URL(formattedResponse.attestationObject);
|
|
3654
|
+
}
|
|
3655
|
+
formatted.response = formattedResponse;
|
|
3622
3656
|
}
|
|
3623
3657
|
return formatted;
|
|
3624
3658
|
}
|
|
3625
3659
|
function formatAuthenticationResponse(response) {
|
|
3626
3660
|
const formatted = { ...response };
|
|
3627
3661
|
if (formatted.id) {
|
|
3628
|
-
formatted.id =
|
|
3662
|
+
formatted.id = toBase64URL(formatted.id);
|
|
3629
3663
|
}
|
|
3630
3664
|
if (formatted.rawId) {
|
|
3631
|
-
formatted.rawId =
|
|
3665
|
+
formatted.rawId = toBase64URL(formatted.rawId);
|
|
3666
|
+
}
|
|
3667
|
+
if (formatted.response) {
|
|
3668
|
+
const formattedResponse = { ...formatted.response };
|
|
3669
|
+
if (isArrayBuffer(formattedResponse.clientDataJSON)) {
|
|
3670
|
+
formattedResponse.clientDataJSON = toBase64URL(formattedResponse.clientDataJSON);
|
|
3671
|
+
}
|
|
3672
|
+
if (isArrayBuffer(formattedResponse.authenticatorData)) {
|
|
3673
|
+
formattedResponse.authenticatorData = toBase64URL(formattedResponse.authenticatorData);
|
|
3674
|
+
}
|
|
3675
|
+
if (isArrayBuffer(formattedResponse.signature)) {
|
|
3676
|
+
formattedResponse.signature = toBase64URL(formattedResponse.signature);
|
|
3677
|
+
}
|
|
3678
|
+
formatted.response = formattedResponse;
|
|
3632
3679
|
}
|
|
3633
3680
|
return formatted;
|
|
3634
3681
|
}
|
|
@@ -3901,7 +3948,6 @@ export {
|
|
|
3901
3948
|
deleteDeviceKey,
|
|
3902
3949
|
deriveSignerKeypair,
|
|
3903
3950
|
detectWallets,
|
|
3904
|
-
ensureBase64URLCredentialId,
|
|
3905
3951
|
exportToSPKI,
|
|
3906
3952
|
findAndValidateDeviceKey,
|
|
3907
3953
|
findDeviceKeyByPublicKey,
|