-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeesun Kim
authored and
Jeesun Kim
committed
Apr 29, 2024
1 parent
342211d
commit f630b99
Showing
5 changed files
with
215 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const bipPath = (value: string) => { | ||
const regexp = /44'\/148'\/(\d+)'/; | ||
const match = regexp.exec(value); | ||
|
||
if (!(match && match[1].length > 0)) { | ||
return "Invalid BIP path. Please provide it in format 44'/148'/x'. We call 44'/148'/0' the primary account"; | ||
} | ||
|
||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { StrKey } from "@stellar/stellar-sdk"; | ||
|
||
export const secretKey = (value: string) => { | ||
if (value.startsWith("S")) { | ||
if (!StrKey.isValidEd25519SecretSeed(value)) { | ||
return "Invalid secret key."; | ||
} | ||
} else { | ||
if (!value.match(/^[0-9a-f]{2,128}$/gi) || value.length % 2 == 1) { | ||
return `Invalid hex value. Please provide up to 64 bytes in hexadecimal format.`; | ||
} | ||
} | ||
|
||
return false; | ||
}; |