@medialane/sdk 0.141.0 → 0.142.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/{errors-CMjZp66y.d.cts → errors-BRCRmVep.d.cts} +15 -3
- package/dist/{errors-CtXjdRsL.d.ts → errors-DP-VnOWP.d.ts} +15 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +35 -10
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +3 -5
- package/dist/starknet/index.d.ts +3 -5
- package/dist/starknet/index.js +33 -10
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -12721,13 +12721,39 @@ function parseAccountAddress(input) {
|
|
|
12721
12721
|
}
|
|
12722
12722
|
|
|
12723
12723
|
// src/wallet/recovery-key.ts
|
|
12724
|
-
|
|
12724
|
+
var PREFIX = "medialane-recovery:v1:";
|
|
12725
|
+
var ADDRESS = /^0x[0-9a-fA-F]{1,64}$/;
|
|
12726
|
+
var InvalidRecoveryKeyError = class extends Error {
|
|
12727
|
+
constructor(message = "This is not a valid recovery key.") {
|
|
12728
|
+
super(message);
|
|
12729
|
+
this.name = "InvalidRecoveryKeyError";
|
|
12730
|
+
}
|
|
12731
|
+
};
|
|
12732
|
+
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
12733
|
+
function keyPair(privateKey) {
|
|
12725
12734
|
try {
|
|
12726
|
-
return
|
|
12735
|
+
return starkKeyPairFromPrivateKey(privateKey);
|
|
12727
12736
|
} catch {
|
|
12728
|
-
|
|
12737
|
+
throw new InvalidRecoveryKeyError();
|
|
12729
12738
|
}
|
|
12730
12739
|
}
|
|
12740
|
+
function encodeRecoveryKey(key) {
|
|
12741
|
+
if (!ADDRESS.test(key.walletAddress) || BigInt(key.walletAddress) === 0n) throw new InvalidRecoveryKeyError();
|
|
12742
|
+
return `${PREFIX}${canonicalAddress(key.walletAddress)}:${keyPair(key.privateKey).privateKeyHex}`;
|
|
12743
|
+
}
|
|
12744
|
+
function parseRecoveryKey(input) {
|
|
12745
|
+
const trimmed = input.trim();
|
|
12746
|
+
if (!trimmed.startsWith(PREFIX)) {
|
|
12747
|
+
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
12748
|
+
return { walletAddress: computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
12749
|
+
}
|
|
12750
|
+
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
12751
|
+
const [walletAddress, privateKey] = parts;
|
|
12752
|
+
if (parts.length !== 2 || !walletAddress || !privateKey || !ADDRESS.test(walletAddress) || BigInt(walletAddress) === 0n) {
|
|
12753
|
+
throw new InvalidRecoveryKeyError();
|
|
12754
|
+
}
|
|
12755
|
+
return { walletAddress: canonicalAddress(walletAddress), privateKey: keyPair(privateKey).privateKeyHex };
|
|
12756
|
+
}
|
|
12731
12757
|
|
|
12732
12758
|
// src/wallet/guardian-status.ts
|
|
12733
12759
|
function describeGuardianStatus(guardians) {
|
|
@@ -12894,21 +12920,18 @@ function createPasskeyOwner(config) {
|
|
|
12894
12920
|
const aes = await deriveAesKey(secret, config.hkdfInfo);
|
|
12895
12921
|
return unsealPrivateKey(aes, decodeBase64(sealed.iv), decodeBase64(sealed.ciphertext));
|
|
12896
12922
|
},
|
|
12897
|
-
async sealImportedOwnerKey(
|
|
12898
|
-
const { privateKeyHex, publicKeyHex } = starkKeyPairFromPrivateKey(
|
|
12923
|
+
async sealImportedOwnerKey(recovery) {
|
|
12924
|
+
const { privateKeyHex, publicKeyHex } = starkKeyPairFromPrivateKey(recovery.privateKey);
|
|
12899
12925
|
const registration = await registerPasskey();
|
|
12900
12926
|
const secret = await secretFromRegistration(registration);
|
|
12901
12927
|
const { iv, ciphertext } = await seal(secret, privateKeyHex);
|
|
12902
12928
|
return {
|
|
12903
12929
|
credentialId: registration.credentialId,
|
|
12904
12930
|
ownerPubKey: publicKeyHex,
|
|
12905
|
-
address:
|
|
12931
|
+
address: recovery.walletAddress,
|
|
12906
12932
|
iv,
|
|
12907
12933
|
ciphertext
|
|
12908
12934
|
};
|
|
12909
|
-
},
|
|
12910
|
-
walletAddressForPrivateKey(privateKeyInput) {
|
|
12911
|
-
return computeAccountAddress(starkKeyPairFromPrivateKey(privateKeyInput).publicKeyHex, 0);
|
|
12912
12935
|
}
|
|
12913
12936
|
};
|
|
12914
12937
|
}
|
|
@@ -13222,6 +13245,7 @@ exports.IPSponsorshipABI = IPSponsorshipABI;
|
|
|
13222
13245
|
exports.IPTicketCollectionABI = IPTicketCollectionABI;
|
|
13223
13246
|
exports.IPTicketCollectionFactoryABI = IPTicketCollectionFactoryABI;
|
|
13224
13247
|
exports.InvalidPairingPayloadError = InvalidPairingPayloadError;
|
|
13248
|
+
exports.InvalidRecoveryKeyError = InvalidRecoveryKeyError;
|
|
13225
13249
|
exports.InvalidStarkPrivateKeyError = InvalidStarkPrivateKeyError;
|
|
13226
13250
|
exports.MAX_HOLDERS_AT_LAUNCH = MAX_HOLDERS_AT_LAUNCH;
|
|
13227
13251
|
exports.MAX_TEAM_ALLOCATION_PERCENT = MAX_TEAM_ALLOCATION_PERCENT;
|
|
@@ -13287,6 +13311,7 @@ exports.describeRecoveryAction = describeRecoveryAction;
|
|
|
13287
13311
|
exports.encodeAdminHeaders = encodeAdminHeaders;
|
|
13288
13312
|
exports.encodeByteArray = encodeByteArray;
|
|
13289
13313
|
exports.encodePairingPayload = encodePairingPayload;
|
|
13314
|
+
exports.encodeRecoveryKey = encodeRecoveryKey;
|
|
13290
13315
|
exports.estimateSelfFundedFee = estimateSelfFundedFee;
|
|
13291
13316
|
exports.executeIntent = executeIntent;
|
|
13292
13317
|
exports.executeIntents = executeIntents;
|
|
@@ -13307,7 +13332,6 @@ exports.getOwners = getOwners;
|
|
|
13307
13332
|
exports.getSiwsStorageKey = getSiwsStorageKey;
|
|
13308
13333
|
exports.getStoredSiwsToken = getStoredSiwsToken;
|
|
13309
13334
|
exports.isDeployed = isDeployed;
|
|
13310
|
-
exports.isRecoveryKeyForWallet = isRecoveryKeyForWallet;
|
|
13311
13335
|
exports.isSiwsTokenValid = isSiwsTokenValid;
|
|
13312
13336
|
exports.isValidStarknetAddress = isValidStarknetAddress;
|
|
13313
13337
|
exports.mintedTokenIdFromReceipt = mintedTokenIdFromReceipt;
|
|
@@ -13319,6 +13343,7 @@ exports.parseAccountAddress = parseAccountAddress;
|
|
|
13319
13343
|
exports.parseAdminHeaders = parseAdminHeaders;
|
|
13320
13344
|
exports.parseCreatorCoinCreated = parseCreatorCoinCreated;
|
|
13321
13345
|
exports.parsePairingPayload = parsePairingPayload;
|
|
13346
|
+
exports.parseRecoveryKey = parseRecoveryKey;
|
|
13322
13347
|
exports.priceToEkuboParams = priceToEkuboParams;
|
|
13323
13348
|
exports.randomNonce = randomNonce;
|
|
13324
13349
|
exports.requestSiwsToken = requestSiwsToken;
|