Skip to content

Commit

Permalink
fix(hashicorp-vault-signing-manager): fix long message signing (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdossa committed Oct 8, 2022
1 parent 2f604b3 commit c25ead8
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TypeRegistry } from '@polkadot/types';
import { SignerPayloadJSON, SignerPayloadRaw, SignerResult } from '@polkadot/types/types';
import { hexToU8a, u8aToHex } from '@polkadot/util';
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import { blake2AsU8a, decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import { PolkadotSigner, SigningManager } from '@polymeshassociation/signing-manager-types';

import { AddressedVaultKey } from '../types';
Expand Down Expand Up @@ -50,8 +50,10 @@ export class VaultSigner implements PolkadotSigner {
* Use the Vault to sign raw data and return the signature + update ID
*/
private async signData(name: string, version: number, data: Uint8Array): Promise<SignerResult> {
const fixedData = data.length > 256 ? blake2AsU8a(data) : data;

const body = {
input: Buffer.from(data).toString('base64'),
input: Buffer.from(fixedData).toString('base64'),
// eslint-disable-next-line @typescript-eslint/naming-convention
key_version: version,
};
Expand Down

0 comments on commit c25ead8

Please sign in to comment.