Skip to content

Commit

Permalink
Bump bs58 from 4.0.1 to 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
retheeshskumar committed Nov 24, 2024
1 parent 591c89e commit 1f55194
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"ajv": "^8.10.0",
"ajv-formats": "^2.1.1",
"axios": "^1.3.6",
"bs58": "^4.0.1",
"bs58": "^6.0.0",
"bson": "^6.5.0",
"dotenv": "^16.0.0",
"exceljs": "^4.4.0",
Expand Down
4 changes: 2 additions & 2 deletions common/src/hedera-modules/hashing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export class Hashing {
encode: (data: Uint8Array): string => {
return bs58.encode(data);
},
decode: (data: string): Uint8Array => {
return bs58.decode(data);
decode: (data: string): Buffer => {
return Buffer.from(bs58.decode(data));
}
}
/**
Expand Down
10 changes: 5 additions & 5 deletions common/src/helpers/vc-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { KeyType, Users, Wallet } from '../helpers/index.js';
import { IAuthUser } from '../interfaces/index.js';
import { Ed25519VerificationKey2018 } from '@transmute/ed25519-signature-2018';
import { bls12_381 } from '@noble/curves/bls12-381';
import bs58 from 'bs58';
import { Hashing } from '../hedera-modules/hashing.js';
import { DatabaseServer } from '../database-modules/index.js';

/**
Expand Down Expand Up @@ -501,10 +501,10 @@ export class VcHelper extends VCJS {
const option = method.toObject(true) as any;
switch (option.type) {
case 'Ed25519VerificationKey2018': {
const privateKeyHex = bs58
const privateKeyHex = Hashing.base58
.decode(option.privateKeyBase58)
.toString('hex')
const publicKeyHex = bs58
const publicKeyHex = Hashing.base58
.decode(option.publicKeyBase58)
.toString('hex')
if (!privateKeyHex.endsWith(publicKeyHex)) {
Expand All @@ -516,12 +516,12 @@ export class VcHelper extends VCJS {
case 'Bls12381G2Key2020': {
const privateKeyBase58 = option.privateKeyBase58;
const publicKeyBase58 = option.publicKeyBase58;
const privateKeyHex = bs58
const privateKeyHex = Hashing.base58
.decode(privateKeyBase58)
.toString('hex')
.toUpperCase();
const publicKey = bls12_381.getPublicKeyForShortSignatures(privateKeyHex);
if (publicKeyBase58 !== bs58.encode(publicKey)) {
if (publicKeyBase58 !== Hashing.base58.encode(publicKey)) {
return false;
}
keyPair = await Bls12381G2KeyPair.from(option);
Expand Down
4 changes: 2 additions & 2 deletions common/src/wallet/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SecretManager, SecretManagerBase, SecretManagerType } from '../secret-manager/index.js';
import crypto from 'crypto';
import * as bs58 from 'bs58';
import { Hashing } from '../hedera-modules/hashing.js';
import { AzureSecretManager } from '../secret-manager/azure/azure-secret-manager.js';
import { GcpSecretManager } from '../secret-manager/gcp/gcp-secret-manager.js';

Expand Down Expand Up @@ -64,7 +64,7 @@ export class Wallet {
// convert hashedKey from hex to Base58 to shoeten key length, Azure does not accept keys longet than 128 chars
// convert hashedKey from hex to Base58 to shoeten key length, GCP does not accept keys longet than 255 chars
const buffer = Buffer.from(hashedKey, 'hex');
const hashedKeyBase58 = bs58.encode(buffer);
const hashedKeyBase58 = Hashing.base58.encode(buffer);
return hashedKeyBase58;
}

Expand Down
1 change: 0 additions & 1 deletion guardian-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"ajv": "^8.10.0",
"ajv-formats": "^2.1.1",
"axios": "^1.3.6",
"bs58": "^4.0.1",
"bson": "^6.5.0",
"cors": "^2.8.5",
"cron": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion indexer-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@nestjs/core": "^9.4.1",
"@nestjs/microservices": "^9.4.1",
"axios": "^1.7.2",
"bs58": "^4.0.1",
"bs58": "^6.0.0",
"axios-retry": "^3.2.4",
"cron": "^3.1.7",
"cross-blob": "^2.0.1",
Expand Down
1 change: 0 additions & 1 deletion policy-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"ajv": "^8.10.0",
"ajv-formats": "^2.1.1",
"axios": "^1.3.6",
"bs58": "^4.0.1",
"bson": "^6.5.0",
"cors": "^2.8.5",
"cron": "^2.0.0",
Expand Down

0 comments on commit 1f55194

Please sign in to comment.