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.cjs
CHANGED
|
@@ -809,9 +809,14 @@ var getWallets2 = () => {
|
|
|
809
809
|
options
|
|
810
810
|
);
|
|
811
811
|
};
|
|
812
|
-
const walletControllerStartPasskeyAuthentication2 = (id, options) => {
|
|
812
|
+
const walletControllerStartPasskeyAuthentication2 = (id, startPasskeyAuthenticationDto, options) => {
|
|
813
813
|
return customInstance(
|
|
814
|
-
{
|
|
814
|
+
{
|
|
815
|
+
url: `/wallets/${id}/signers/passkey/authenticate`,
|
|
816
|
+
method: "POST",
|
|
817
|
+
headers: { "Content-Type": "application/json" },
|
|
818
|
+
data: startPasskeyAuthenticationDto
|
|
819
|
+
},
|
|
815
820
|
options
|
|
816
821
|
);
|
|
817
822
|
};
|
|
@@ -2805,7 +2810,6 @@ __export(helpers_exports, {
|
|
|
2805
2810
|
deleteDeviceKey: () => deleteDeviceKey,
|
|
2806
2811
|
deriveSignerKeypair: () => deriveSignerKeypair,
|
|
2807
2812
|
detectWallets: () => detectWallets,
|
|
2808
|
-
ensureBase64URLCredentialId: () => ensureBase64URLCredentialId,
|
|
2809
2813
|
exportToSPKI: () => exportToSPKI,
|
|
2810
2814
|
findAndValidateDeviceKey: () => findAndValidateDeviceKey,
|
|
2811
2815
|
findDeviceKeyByPublicKey: () => findDeviceKeyByPublicKey,
|
|
@@ -5899,31 +5903,73 @@ function platformAuthenticatorIsAvailable() {
|
|
|
5899
5903
|
}
|
|
5900
5904
|
|
|
5901
5905
|
// src/signers/passkeyHelpers.ts
|
|
5902
|
-
function
|
|
5903
|
-
if (
|
|
5904
|
-
|
|
5906
|
+
function toBase64URL(value) {
|
|
5907
|
+
if (typeof value === "string") {
|
|
5908
|
+
if (value.includes("+") || value.includes("/") || value.includes("=")) {
|
|
5909
|
+
return value.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
5910
|
+
}
|
|
5911
|
+
return value;
|
|
5912
|
+
}
|
|
5913
|
+
let uint8Array;
|
|
5914
|
+
if (Array.isArray(value)) {
|
|
5915
|
+
uint8Array = new Uint8Array(value);
|
|
5916
|
+
} else if (value instanceof ArrayBuffer) {
|
|
5917
|
+
uint8Array = new Uint8Array(value);
|
|
5918
|
+
} else {
|
|
5919
|
+
uint8Array = value;
|
|
5905
5920
|
}
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5921
|
+
const base64 = btoa(String.fromCharCode(...uint8Array));
|
|
5922
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
5923
|
+
}
|
|
5924
|
+
function isArrayBuffer(value) {
|
|
5925
|
+
if (Array.isArray(value))
|
|
5926
|
+
return true;
|
|
5927
|
+
if (value instanceof ArrayBuffer)
|
|
5928
|
+
return true;
|
|
5929
|
+
if (value instanceof Uint8Array)
|
|
5930
|
+
return true;
|
|
5931
|
+
return false;
|
|
5909
5932
|
}
|
|
5910
5933
|
function formatRegistrationResponse(response) {
|
|
5911
5934
|
const formatted = { ...response };
|
|
5912
5935
|
if (formatted.id) {
|
|
5913
|
-
formatted.id =
|
|
5936
|
+
formatted.id = toBase64URL(formatted.id);
|
|
5914
5937
|
}
|
|
5915
5938
|
if (formatted.rawId) {
|
|
5916
|
-
formatted.rawId =
|
|
5939
|
+
formatted.rawId = toBase64URL(formatted.rawId);
|
|
5940
|
+
}
|
|
5941
|
+
if (formatted.response) {
|
|
5942
|
+
const formattedResponse = { ...formatted.response };
|
|
5943
|
+
if (isArrayBuffer(formattedResponse.clientDataJSON)) {
|
|
5944
|
+
formattedResponse.clientDataJSON = toBase64URL(formattedResponse.clientDataJSON);
|
|
5945
|
+
}
|
|
5946
|
+
if (isArrayBuffer(formattedResponse.attestationObject)) {
|
|
5947
|
+
formattedResponse.attestationObject = toBase64URL(formattedResponse.attestationObject);
|
|
5948
|
+
}
|
|
5949
|
+
formatted.response = formattedResponse;
|
|
5917
5950
|
}
|
|
5918
5951
|
return formatted;
|
|
5919
5952
|
}
|
|
5920
5953
|
function formatAuthenticationResponse(response) {
|
|
5921
5954
|
const formatted = { ...response };
|
|
5922
5955
|
if (formatted.id) {
|
|
5923
|
-
formatted.id =
|
|
5956
|
+
formatted.id = toBase64URL(formatted.id);
|
|
5924
5957
|
}
|
|
5925
5958
|
if (formatted.rawId) {
|
|
5926
|
-
formatted.rawId =
|
|
5959
|
+
formatted.rawId = toBase64URL(formatted.rawId);
|
|
5960
|
+
}
|
|
5961
|
+
if (formatted.response) {
|
|
5962
|
+
const formattedResponse = { ...formatted.response };
|
|
5963
|
+
if (isArrayBuffer(formattedResponse.clientDataJSON)) {
|
|
5964
|
+
formattedResponse.clientDataJSON = toBase64URL(formattedResponse.clientDataJSON);
|
|
5965
|
+
}
|
|
5966
|
+
if (isArrayBuffer(formattedResponse.authenticatorData)) {
|
|
5967
|
+
formattedResponse.authenticatorData = toBase64URL(formattedResponse.authenticatorData);
|
|
5968
|
+
}
|
|
5969
|
+
if (isArrayBuffer(formattedResponse.signature)) {
|
|
5970
|
+
formattedResponse.signature = toBase64URL(formattedResponse.signature);
|
|
5971
|
+
}
|
|
5972
|
+
formatted.response = formattedResponse;
|
|
5927
5973
|
}
|
|
5928
5974
|
return formatted;
|
|
5929
5975
|
}
|