@medialane/sdk 0.114.0 → 0.116.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/starknet/index.cjs
CHANGED
|
@@ -11912,25 +11912,6 @@ async function deriveAesKey(prfSecret, hkdfInfo) {
|
|
|
11912
11912
|
["encrypt", "decrypt"]
|
|
11913
11913
|
);
|
|
11914
11914
|
}
|
|
11915
|
-
var STARK_KEY_INFO = new TextEncoder().encode("medialane/passkey/stark-key/v1");
|
|
11916
|
-
var DERIVE_BITS = 384;
|
|
11917
|
-
function bytesToBigInt(bytes) {
|
|
11918
|
-
let value = 0n;
|
|
11919
|
-
for (const byte of bytes) value = value << 8n | BigInt(byte);
|
|
11920
|
-
return value;
|
|
11921
|
-
}
|
|
11922
|
-
async function deriveStarkKeyPair(prfSecret) {
|
|
11923
|
-
const hkdf = await crypto.subtle.importKey("raw", prfSecret, "HKDF", false, ["deriveBits"]);
|
|
11924
|
-
const bits = await crypto.subtle.deriveBits(
|
|
11925
|
-
{ name: "HKDF", hash: "SHA-256", salt: new Uint8Array(0), info: STARK_KEY_INFO },
|
|
11926
|
-
hkdf,
|
|
11927
|
-
DERIVE_BITS
|
|
11928
|
-
);
|
|
11929
|
-
const order = starknet.ec.starkCurve.CURVE.n;
|
|
11930
|
-
const value = bytesToBigInt(new Uint8Array(bits)) % (order - 1n) + 1n;
|
|
11931
|
-
const privateKeyHex = "0x" + value.toString(16).padStart(64, "0");
|
|
11932
|
-
return { privateKeyHex, publicKeyHex: starknet.ec.starkCurve.getStarkKey(privateKeyHex) };
|
|
11933
|
-
}
|
|
11934
11915
|
function generateStarkKeyPair() {
|
|
11935
11916
|
const privateKeyHex = "0x" + Array.from(starknet.ec.starkCurve.utils.randomPrivateKey()).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
11936
11917
|
return { privateKeyHex, publicKeyHex: starknet.ec.starkCurve.getStarkKey(privateKeyHex) };
|
|
@@ -12035,7 +12016,6 @@ exports.decodeEscapeAndStatus = decodeEscapeAndStatus;
|
|
|
12035
12016
|
exports.decodeGuardiansInfo = decodeGuardiansInfo;
|
|
12036
12017
|
exports.deriveAesKey = deriveAesKey;
|
|
12037
12018
|
exports.deriveOwnerKeyPair = deriveOwnerKeyPair;
|
|
12038
|
-
exports.deriveStarkKeyPair = deriveStarkKeyPair;
|
|
12039
12019
|
exports.encodeAdminHeaders = encodeAdminHeaders;
|
|
12040
12020
|
exports.encodeByteArray = encodeByteArray;
|
|
12041
12021
|
exports.executeIntent = executeIntent;
|