Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat utils and fixes #467

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/types/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,6 @@ export class Transaction {
const hex = new HexBytes(signature);
const approval = new Approval(publicKey, hex);

this.approvals.push(approval);

if (this.originTransactionV1) {
this.originTransactionV1.approvals.push(approval);
} else if (this.originDeployV1) {
Expand Down
11 changes: 10 additions & 1 deletion src/types/keypair/PrivateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,21 @@ export class PrivateKey {
return this.priv.toPem();
}

/**
* Signs a message using the private key.
* @param msg - The message to sign.
* @returns A promise resolving to the signature bytes.
*/
public async sign(msg: Uint8Array): Promise<Uint8Array> {
return await this.priv.sign(msg);
}

/**
* Signs a message using the private key and includes the algorithm byte in the signature.
* @param msg - The message to sign.
* @returns A promise resolving to the signature bytes with the algorithm byte.
*/
public async sign(msg: Uint8Array): Promise<Uint8Array> {
public async signAndAddAlgorithmBytes(msg: Uint8Array): Promise<Uint8Array> {
const signature = await this.priv.sign(msg);
const algBytes = Uint8Array.of(this.alg);
return concat([algBytes, signature]);
Expand Down
Loading