@medialane/sdk 0.85.8 → 0.85.9
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/starknet/index.cjs
CHANGED
|
@@ -11673,6 +11673,35 @@ async function getEscapeSecurityPeriod(provider, address) {
|
|
|
11673
11673
|
});
|
|
11674
11674
|
return Number(res[0]);
|
|
11675
11675
|
}
|
|
11676
|
+
async function deriveAesKey(prfSecret, hkdfInfo) {
|
|
11677
|
+
const hkdf = await crypto.subtle.importKey("raw", prfSecret, "HKDF", false, ["deriveKey"]);
|
|
11678
|
+
return crypto.subtle.deriveKey(
|
|
11679
|
+
{ name: "HKDF", hash: "SHA-256", salt: new Uint8Array(0), info: hkdfInfo },
|
|
11680
|
+
hkdf,
|
|
11681
|
+
{ name: "AES-GCM", length: 256 },
|
|
11682
|
+
false,
|
|
11683
|
+
["encrypt", "decrypt"]
|
|
11684
|
+
);
|
|
11685
|
+
}
|
|
11686
|
+
function generateStarkKeyPair() {
|
|
11687
|
+
const privateKeyHex = "0x" + Array.from(starknet.ec.starkCurve.utils.randomPrivateKey()).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
11688
|
+
return { privateKeyHex, publicKeyHex: starknet.ec.starkCurve.getStarkKey(privateKeyHex) };
|
|
11689
|
+
}
|
|
11690
|
+
async function sealPrivateKey(aesKey, iv, privateKeyHex) {
|
|
11691
|
+
return crypto.subtle.encrypt(
|
|
11692
|
+
{ name: "AES-GCM", iv },
|
|
11693
|
+
aesKey,
|
|
11694
|
+
new TextEncoder().encode(privateKeyHex)
|
|
11695
|
+
);
|
|
11696
|
+
}
|
|
11697
|
+
async function unsealPrivateKey(aesKey, iv, ciphertext) {
|
|
11698
|
+
const buf = await crypto.subtle.decrypt({ name: "AES-GCM", iv }, aesKey, ciphertext);
|
|
11699
|
+
return new TextDecoder().decode(buf);
|
|
11700
|
+
}
|
|
11701
|
+
function signWithPrivateKey(privateKeyHex, msgHash) {
|
|
11702
|
+
const sig = starknet.ec.starkCurve.sign(msgHash, privateKeyHex);
|
|
11703
|
+
return [starknet.num.toHex(sig.r), starknet.num.toHex(sig.s)];
|
|
11704
|
+
}
|
|
11676
11705
|
|
|
11677
11706
|
exports.ADMIN_HEADERS = ADMIN_HEADERS;
|
|
11678
11707
|
exports.ADMIN_SCOPE = ADMIN_SCOPE;
|
|
@@ -11729,10 +11758,12 @@ exports.computeOwnerGuid = computeOwnerGuid;
|
|
|
11729
11758
|
exports.createAdminSessionGrant = createAdminSessionGrant;
|
|
11730
11759
|
exports.decodeEscapeAndStatus = decodeEscapeAndStatus;
|
|
11731
11760
|
exports.decodeGuardiansInfo = decodeGuardiansInfo;
|
|
11761
|
+
exports.deriveAesKey = deriveAesKey;
|
|
11732
11762
|
exports.deriveOwnerKeyPair = deriveOwnerKeyPair;
|
|
11733
11763
|
exports.encodeAdminHeaders = encodeAdminHeaders;
|
|
11734
11764
|
exports.encodeByteArray = encodeByteArray;
|
|
11735
11765
|
exports.fdvHuman = fdvHuman;
|
|
11766
|
+
exports.generateStarkKeyPair = generateStarkKeyPair;
|
|
11736
11767
|
exports.getCounter = getCounter;
|
|
11737
11768
|
exports.getCounter1155 = getCounter1155;
|
|
11738
11769
|
exports.getCreatorCoinPrice = getCreatorCoinPrice;
|
|
@@ -11751,11 +11782,14 @@ exports.parseCreatorCoinCreated = parseCreatorCoinCreated;
|
|
|
11751
11782
|
exports.priceToEkuboParams = priceToEkuboParams;
|
|
11752
11783
|
exports.randomNonce = randomNonce;
|
|
11753
11784
|
exports.requestSiwsToken = requestSiwsToken;
|
|
11785
|
+
exports.sealPrivateKey = sealPrivateKey;
|
|
11754
11786
|
exports.sessionKeyHashOf = sessionKeyHashOf;
|
|
11755
11787
|
exports.signAdminRequest = signAdminRequest;
|
|
11788
|
+
exports.signWithPrivateKey = signWithPrivateKey;
|
|
11756
11789
|
exports.storeSiwsToken = storeSiwsToken;
|
|
11757
11790
|
exports.teamCoinsRaw = teamCoinsRaw;
|
|
11758
11791
|
exports.toDropContractConditions = toContractConditions;
|
|
11792
|
+
exports.unsealPrivateKey = unsealPrivateKey;
|
|
11759
11793
|
exports.validateCoinName = validateName;
|
|
11760
11794
|
exports.validateCoinSupply = validateSupply;
|
|
11761
11795
|
exports.validateCoinSymbol = validateSymbol;
|