Skip to content

Commit ea00a5f

Browse files
Merge pull request #176 from DIG-Network/release/v0.0.1-alpha.189
Release/v0.0.1 alpha.189
2 parents 86562c0 + 21495ca commit ea00a5f

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [0.0.1-alpha.189](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.188...v0.0.1-alpha.189) (2024-11-01)
6+
7+
### [0.0.1-alpha.188](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.187...v0.0.1-alpha.188) (2024-11-01)
8+
9+
10+
### Features
11+
12+
* add base64 getters to udi class ([b77cc11](https://github.com/DIG-Network/dig-chia-sdk/commit/b77cc1107719b1cfff158e7ba65f7c169ccd6dcf))
13+
514
### [0.0.1-alpha.187](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.186...v0.0.1-alpha.187) (2024-11-01)
615

716

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dignetwork/dig-sdk",
3-
"version": "0.0.1-alpha.187",
3+
"version": "0.0.1-alpha.189",
44
"description": "",
55
"type": "commonjs",
66
"main": "./dist/index.js",

src/utils/Udi.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class Udi {
2929
if (!/^[a-fA-F0-9]{64}$/.test(input)) {
3030
throw new Error("Input must be a 64-character hex string.");
3131
}
32-
return input.toLowerCase();
32+
return input;
3333
}
3434

3535
static fromUrn(urn: string): Udi {
3636
const parsedUrn = urns.parseURN(urn);
37-
if (parsedUrn.nid.toLowerCase() !== Udi.nid) {
37+
if (parsedUrn.nid !== Udi.nid) {
3838
throw new Error(`Invalid nid: ${parsedUrn.nid}`);
3939
}
4040

@@ -62,11 +62,11 @@ class Udi {
6262

6363
static convertToHex(input: string): string {
6464
// Attempt hex conversion first
65-
if (/^[a-fA-F0-9]{64}$/.test(input)) return input.toLowerCase();
65+
if (/^[a-fA-F0-9]{64}$/.test(input)) return input;
6666

6767
// Convert from Base32
6868
try {
69-
const paddedInput = Udi.addBase32Padding(input.toUpperCase());
69+
const paddedInput = Udi.addBase32Padding(input);
7070
const buffer = Buffer.from(base32Decode(paddedInput, false));
7171
return buffer.toString("hex");
7272
} catch (e) {
@@ -118,7 +118,7 @@ class Udi {
118118
if (encoding === "hex") {
119119
return hexString;
120120
} else if (encoding === "base32") {
121-
return base32Encode(buffer).toLowerCase().replace(/=+$/, "");
121+
return base32Encode(buffer).replace(/=+$/, "");
122122
} else if (encoding === "base64") {
123123
return Udi.toBase64UrlSafe(buffer.toString("base64"));
124124
}

0 commit comments

Comments
 (0)