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/index.mjs
CHANGED
|
@@ -734,9 +734,14 @@ var getWallets2 = () => {
|
|
|
734
734
|
options
|
|
735
735
|
);
|
|
736
736
|
};
|
|
737
|
-
const walletControllerStartPasskeyAuthentication2 = (id, options) => {
|
|
737
|
+
const walletControllerStartPasskeyAuthentication2 = (id, startPasskeyAuthenticationDto, options) => {
|
|
738
738
|
return customInstance(
|
|
739
|
-
{
|
|
739
|
+
{
|
|
740
|
+
url: `/wallets/${id}/signers/passkey/authenticate`,
|
|
741
|
+
method: "POST",
|
|
742
|
+
headers: { "Content-Type": "application/json" },
|
|
743
|
+
data: startPasskeyAuthenticationDto
|
|
744
|
+
},
|
|
740
745
|
options
|
|
741
746
|
);
|
|
742
747
|
};
|
|
@@ -2730,7 +2735,6 @@ __export(helpers_exports, {
|
|
|
2730
2735
|
deleteDeviceKey: () => deleteDeviceKey,
|
|
2731
2736
|
deriveSignerKeypair: () => deriveSignerKeypair,
|
|
2732
2737
|
detectWallets: () => detectWallets,
|
|
2733
|
-
ensureBase64URLCredentialId: () => ensureBase64URLCredentialId,
|
|
2734
2738
|
exportToSPKI: () => exportToSPKI,
|
|
2735
2739
|
findAndValidateDeviceKey: () => findAndValidateDeviceKey,
|
|
2736
2740
|
findDeviceKeyByPublicKey: () => findDeviceKeyByPublicKey,
|
|
@@ -5824,31 +5828,73 @@ function platformAuthenticatorIsAvailable() {
|
|
|
5824
5828
|
}
|
|
5825
5829
|
|
|
5826
5830
|
// src/signers/passkeyHelpers.ts
|
|
5827
|
-
function
|
|
5828
|
-
if (
|
|
5829
|
-
|
|
5831
|
+
function toBase64URL(value) {
|
|
5832
|
+
if (typeof value === "string") {
|
|
5833
|
+
if (value.includes("+") || value.includes("/") || value.includes("=")) {
|
|
5834
|
+
return value.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
5835
|
+
}
|
|
5836
|
+
return value;
|
|
5837
|
+
}
|
|
5838
|
+
let uint8Array;
|
|
5839
|
+
if (Array.isArray(value)) {
|
|
5840
|
+
uint8Array = new Uint8Array(value);
|
|
5841
|
+
} else if (value instanceof ArrayBuffer) {
|
|
5842
|
+
uint8Array = new Uint8Array(value);
|
|
5843
|
+
} else {
|
|
5844
|
+
uint8Array = value;
|
|
5830
5845
|
}
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5846
|
+
const base64 = btoa(String.fromCharCode(...uint8Array));
|
|
5847
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
5848
|
+
}
|
|
5849
|
+
function isArrayBuffer(value) {
|
|
5850
|
+
if (Array.isArray(value))
|
|
5851
|
+
return true;
|
|
5852
|
+
if (value instanceof ArrayBuffer)
|
|
5853
|
+
return true;
|
|
5854
|
+
if (value instanceof Uint8Array)
|
|
5855
|
+
return true;
|
|
5856
|
+
return false;
|
|
5834
5857
|
}
|
|
5835
5858
|
function formatRegistrationResponse(response) {
|
|
5836
5859
|
const formatted = { ...response };
|
|
5837
5860
|
if (formatted.id) {
|
|
5838
|
-
formatted.id =
|
|
5861
|
+
formatted.id = toBase64URL(formatted.id);
|
|
5839
5862
|
}
|
|
5840
5863
|
if (formatted.rawId) {
|
|
5841
|
-
formatted.rawId =
|
|
5864
|
+
formatted.rawId = toBase64URL(formatted.rawId);
|
|
5865
|
+
}
|
|
5866
|
+
if (formatted.response) {
|
|
5867
|
+
const formattedResponse = { ...formatted.response };
|
|
5868
|
+
if (isArrayBuffer(formattedResponse.clientDataJSON)) {
|
|
5869
|
+
formattedResponse.clientDataJSON = toBase64URL(formattedResponse.clientDataJSON);
|
|
5870
|
+
}
|
|
5871
|
+
if (isArrayBuffer(formattedResponse.attestationObject)) {
|
|
5872
|
+
formattedResponse.attestationObject = toBase64URL(formattedResponse.attestationObject);
|
|
5873
|
+
}
|
|
5874
|
+
formatted.response = formattedResponse;
|
|
5842
5875
|
}
|
|
5843
5876
|
return formatted;
|
|
5844
5877
|
}
|
|
5845
5878
|
function formatAuthenticationResponse(response) {
|
|
5846
5879
|
const formatted = { ...response };
|
|
5847
5880
|
if (formatted.id) {
|
|
5848
|
-
formatted.id =
|
|
5881
|
+
formatted.id = toBase64URL(formatted.id);
|
|
5849
5882
|
}
|
|
5850
5883
|
if (formatted.rawId) {
|
|
5851
|
-
formatted.rawId =
|
|
5884
|
+
formatted.rawId = toBase64URL(formatted.rawId);
|
|
5885
|
+
}
|
|
5886
|
+
if (formatted.response) {
|
|
5887
|
+
const formattedResponse = { ...formatted.response };
|
|
5888
|
+
if (isArrayBuffer(formattedResponse.clientDataJSON)) {
|
|
5889
|
+
formattedResponse.clientDataJSON = toBase64URL(formattedResponse.clientDataJSON);
|
|
5890
|
+
}
|
|
5891
|
+
if (isArrayBuffer(formattedResponse.authenticatorData)) {
|
|
5892
|
+
formattedResponse.authenticatorData = toBase64URL(formattedResponse.authenticatorData);
|
|
5893
|
+
}
|
|
5894
|
+
if (isArrayBuffer(formattedResponse.signature)) {
|
|
5895
|
+
formattedResponse.signature = toBase64URL(formattedResponse.signature);
|
|
5896
|
+
}
|
|
5897
|
+
formatted.response = formattedResponse;
|
|
5852
5898
|
}
|
|
5853
5899
|
return formatted;
|
|
5854
5900
|
}
|