Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cartridge/controller

Package Overview
Dependencies
Maintainers
3
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cartridge/controller - npm Package Compare versions

Comparing version 0.1.64 to 0.1.65

3

lib/index.d.ts

@@ -0,1 +1,2 @@

/// <reference types="node" />
import { AccountInterface } from "starknet";

@@ -26,3 +27,3 @@ import { Session, Policy } from "./types";

rpId?: string;
hashExt?: string;
challengeExt?: Buffer;
}): Promise<{

@@ -29,0 +30,0 @@ assertion: import("./webauthn").Assertion;

@@ -48,3 +48,2 @@ "use strict";

const webauthn_1 = __importStar(require("./webauthn"));
const constants_1 = require("starknet/dist/constants");
const hash_1 = require("starknet/dist/utils/hash");

@@ -142,5 +141,4 @@ const transaction_1 = require("starknet/dist/utils/transaction");

const nonce = yield account.getNonce();
let maxFee = constants_1.ZERO;
const { suggestedMaxFee } = yield account.estimateInvokeFee(calls, { nonce });
maxFee = suggestedMaxFee.toString();
const maxFee = suggestedMaxFee.toString();
const version = (0, number_1.toBN)(hash_1.transactionVersion);

@@ -150,6 +148,7 @@ const chainId = yield account.getChainId();

let msgHash = (0, hash_1.calculateTransactionHash)(account.address, version, calldata, maxFee, chainId, nonce);
if (options.hashExt) {
msgHash += options.hashExt;
let challenge = Buffer.from(msgHash.slice(2).padStart(64, "0").slice(0, 64), "hex");
if (options.challengeExt) {
challenge = Buffer.concat([challenge, options.challengeExt]);
}
const assertion = yield account.signer.sign(msgHash);
const assertion = yield account.signer.sign(challenge);
const signature = (0, webauthn_1.formatAssertion)(assertion);

@@ -156,0 +155,0 @@ const receipt = yield account.invokeFunction({ contractAddress: account.address, calldata, signature }, {

@@ -11,3 +11,3 @@ import { Abi, Call, InvocationsSignerDetails, Signature, SignerInterface, typedData, Account, DeclareSignerDetails } from "starknet";

getPubKey(): Promise<string>;
sign(hash: string): Promise<Assertion>;
sign(challenge: BufferSource): Promise<Assertion>;
hashTransaction(transactions: Call[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): string;

@@ -14,0 +14,0 @@ signTransaction(calls: Call[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): Promise<Signature>;

@@ -45,5 +45,4 @@ "use strict";

}
sign(hash) {
sign(challenge) {
return __awaiter(this, void 0, void 0, function* () {
const challenge = Buffer.from(hash.slice(2).padStart(64, "0").slice(0, 64), "hex");
return (yield navigator.credentials.get({

@@ -81,3 +80,4 @@ publicKey: {

const msgHash = starknet_1.hash.calculateTransactionHash(transactionsDetail.walletAddress, transactionsDetail.version, [starknet_1.hash.getSelectorFromName("__execute__")].concat(calldata), transactionsDetail.maxFee, transactionsDetail.chainId, transactionsDetail.nonce);
const assertion = yield this.sign(msgHash);
const challenge = Buffer.from(msgHash.slice(2).padStart(64, "0").slice(0, 64), "hex");
const assertion = yield this.sign(challenge);
return formatAssertion(assertion);

@@ -89,3 +89,4 @@ });

const msgHash = starknet_1.typedData.getMessageHash(td, accountAddress);
const assertion = yield this.sign(msgHash);
const challenge = Buffer.from(msgHash.slice(2).padStart(64, "0").slice(0, 64), "hex");
const assertion = yield this.sign(challenge);
return formatAssertion(assertion);

@@ -99,3 +100,4 @@ });

const msgHash = (0, hash_1.calculateDeclareTransactionHash)(classHash, senderAddress, version, maxFee, chainId, nonce);
const assertion = yield this.sign(msgHash);
const challenge = Buffer.from(msgHash.slice(2).padStart(64, "0").slice(0, 64), "hex");
const assertion = yield this.sign(challenge);
return formatAssertion(assertion);

@@ -102,0 +104,0 @@ });

{
"name": "@cartridge/controller",
"version": "0.1.64",
"version": "0.1.65",
"description": "Cartridge Controller",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc