@lerna-labs/hydra-sdk 1.0.0-beta.23 → 1.0.0-beta.25

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.
@@ -23,13 +23,16 @@ export function verifySignature(signature, message, signingAddress, signatureKey
23
23
  const signatureBytes = coseSign1.signature();
24
24
  const [, , , payload1] = cbor.decode(bufferToHex(coseSign1.signed_data().to_bytes()));
25
25
  const signaturePayloadAscii = bufferToAscii(payload1);
26
- const { words } = bech32.decode(signingAddress);
26
+ const { words, prefix } = bech32.decode(signingAddress);
27
27
  const addressBytes = Buffer.from(bech32.fromWords(words));
28
28
  const coseSigKey = cbor.decode(signatureKey);
29
29
  const cosePublicKey = coseSigKey.get(-2);
30
30
  const sigKey = CSL.PublicKey.from_bytes(cosePublicKey);
31
31
  const publicKeyHash = sigKey.hash();
32
- const address_matches = addressBytes.toString('hex').slice(2) === publicKeyHash.to_hex();
32
+ // pool1... bech32 encodes the raw 28-byte key hash with no header byte.
33
+ // All other address types (addr, drep, stake) have a 1-byte header prefix.
34
+ const addressHex = addressBytes.toString('hex');
35
+ const address_matches = prefix === 'pool' ? addressHex === publicKeyHash.to_hex() : addressHex.slice(2) === publicKeyHash.to_hex();
33
36
  const sig = CSL.Ed25519Signature.from_bytes(signatureBytes);
34
37
  const validates = sigKey.verify(coseSign1.signed_data().to_bytes(), sig);
35
38
  const message_matches = signaturePayloadAscii === message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerna-labs/hydra-sdk",
3
- "version": "1.0.0-beta.23",
3
+ "version": "1.0.0-beta.25",
4
4
  "description": "TypeScript SDK for managing Cardano Hydra Heads — lifecycle, UTxO queries, wallet management, transaction submission, and signature verification",
5
5
  "keywords": [
6
6
  "cardano",
@@ -48,13 +48,13 @@
48
48
  "devDependencies": {
49
49
  "@types/ws": "^8.18.1"
50
50
  },
51
- "homepage": "https://github.com/Lerna-Labs/hydra-sdk#readme",
51
+ "homepage": "https://github.com/lerna-labs/hydra-sdk#readme",
52
52
  "bugs": {
53
- "url": "https://github.com/Lerna-Labs/hydra-sdk/issues"
53
+ "url": "https://github.com/lerna-labs/hydra-sdk/issues"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",
57
- "url": "https://github.com/Lerna-Labs/hydra-sdk",
57
+ "url": "https://github.com/lerna-labs/hydra-sdk",
58
58
  "directory": "packages/core"
59
59
  }
60
60
  }