@calimero-network/mero-react 10.0.0 → 10.1.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 +6 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +6 -27
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -855,7 +855,6 @@ function AccountSignInPanel({
|
|
|
855
855
|
);
|
|
856
856
|
}
|
|
857
857
|
var DEVICE_KEY = "calimero.device";
|
|
858
|
-
var STATE_KEY = "calimero.enrol.state";
|
|
859
858
|
var HOSTED_WALLET = "https://wallet.cloud.calimero.network/account-enroll";
|
|
860
859
|
var hex = (b) => [...new Uint8Array(b)].map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
861
860
|
function executorOf(relay) {
|
|
@@ -961,28 +960,10 @@ function useAccountEnrolment({
|
|
|
961
960
|
(async () => {
|
|
962
961
|
try {
|
|
963
962
|
const keys = await deviceKeys();
|
|
964
|
-
const sent = (() => {
|
|
965
|
-
try {
|
|
966
|
-
return sessionStorage.getItem(STATE_KEY);
|
|
967
|
-
} catch {
|
|
968
|
-
return null;
|
|
969
|
-
}
|
|
970
|
-
})();
|
|
971
|
-
try {
|
|
972
|
-
sessionStorage.removeItem(STATE_KEY);
|
|
973
|
-
} catch {
|
|
974
|
-
}
|
|
975
|
-
if (!sent) {
|
|
976
|
-
setNote(
|
|
977
|
-
'This enrolment could not be verified as one this tab started, so it was not accepted. Start again from "Enrol with your account".'
|
|
978
|
-
);
|
|
979
|
-
return;
|
|
980
|
-
}
|
|
981
963
|
const enrolled = await meroJs.completeDeviceEnrolment({
|
|
982
964
|
...back,
|
|
983
965
|
devicePublicKey: keys.signPk,
|
|
984
|
-
kemPublicKey: keys.kemPk
|
|
985
|
-
expectState: sent
|
|
966
|
+
kemPublicKey: keys.kemPk
|
|
986
967
|
});
|
|
987
968
|
meroJs.saveDelegatedCredential({
|
|
988
969
|
account: enrolled.account,
|
|
@@ -1021,18 +1002,12 @@ function useAccountEnrolment({
|
|
|
1021
1002
|
setNote(e instanceof Error ? e.message : String(e));
|
|
1022
1003
|
return;
|
|
1023
1004
|
}
|
|
1024
|
-
const state = hex(crypto.getRandomValues(new Uint8Array(16)));
|
|
1025
|
-
try {
|
|
1026
|
-
sessionStorage.setItem(STATE_KEY, state);
|
|
1027
|
-
} catch {
|
|
1028
|
-
}
|
|
1029
1005
|
window.location.assign(
|
|
1030
1006
|
meroJs.deviceEnrolmentUrl({
|
|
1031
1007
|
walletUrl,
|
|
1032
1008
|
devicePublicKey: keys.signPk,
|
|
1033
1009
|
kemPublicKey: keys.kemPk,
|
|
1034
|
-
returnTo: window.location.origin + window.location.pathname
|
|
1035
|
-
state
|
|
1010
|
+
returnTo: window.location.origin + window.location.pathname
|
|
1036
1011
|
})
|
|
1037
1012
|
);
|
|
1038
1013
|
}, [walletUrl]);
|
|
@@ -4228,6 +4203,10 @@ function describeInviteFailure(reason, noun = "team") {
|
|
|
4228
4203
|
return "This invitation has expired. Ask for a new link.";
|
|
4229
4204
|
case "invalid":
|
|
4230
4205
|
return "This invitation link isn't valid. Ask for a new one.";
|
|
4206
|
+
case "already-used":
|
|
4207
|
+
return `You've already used this link to join this ${noun} once. Ask an admin for a new link.`;
|
|
4208
|
+
case "removed":
|
|
4209
|
+
return `An admin removed you from this ${noun}. A new link won't let you back in; ask an admin to add you again.`;
|
|
4231
4210
|
case "refused":
|
|
4232
4211
|
return `You can't join this ${noun} with this invitation. Ask an admin to invite you again.`;
|
|
4233
4212
|
case "signed-out":
|