Run some sanity checks/validations on the private key input. Cannot save it unless the field is valid.
This commit is contained in:
@@ -206,3 +206,10 @@ export function humanPermission(p) {
|
||||
return 'Unknown';
|
||||
}
|
||||
}
|
||||
|
||||
export function validateKey(key) {
|
||||
const hexMatch = /^[\da-f]{64}$/i.test(key);
|
||||
const b32Match = /^nsec1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58}$/.test(key);
|
||||
|
||||
return hexMatch || b32Match;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user