-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skeleton loader added to Unlock Profile
- Loading branch information
1 parent
d078568
commit f88c5f8
Showing
2 changed files
with
144 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as w2wHelper from 'helpers/w2w'; | ||
|
||
export const retrieveUserPGPKeyFromStorage = (account: string) => { | ||
const key = getUniquePGPKey(account); | ||
const value = localStorage.getItem(key); | ||
|
||
if (isPGPKey(value)) { | ||
return value; | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
const isPGPKey = (str: string | null) => { | ||
if (!str) return false; | ||
|
||
const pgpPublicKeyRegex = /-----BEGIN PGP PUBLIC KEY BLOCK-----[\s\S]*-----END PGP PUBLIC KEY BLOCK-----/; | ||
const pgpPrivateKeyRegex = /-----BEGIN PGP PRIVATE KEY BLOCK-----[\s\S]*-----END PGP PRIVATE KEY BLOCK-----/; | ||
|
||
return pgpPublicKeyRegex.test(str) || pgpPrivateKeyRegex.test(str); | ||
}; | ||
|
||
const getUniquePGPKey = (account: string) => { | ||
let address = w2wHelper.walletToCAIP10({ account }); | ||
const uniqueKey = `push-user-${address}-pgp`; | ||
return uniqueKey; | ||
}; |