feat(crypto): 新增 validatePgpPrivateKey 校验函数
This commit is contained in:
@@ -28,6 +28,10 @@ export const generatePgpKeyPair = async (
|
||||
* @param armoredPrivateKey - ASCII-armored private key
|
||||
* @returns ASCII-armored detached signature (signature.asc content)
|
||||
*/
|
||||
export const validatePgpPrivateKey = async (armoredKey: string): Promise<void> => {
|
||||
await openpgp.readPrivateKey({ armoredKey })
|
||||
}
|
||||
|
||||
export const pgpSignDetached = async (data: Uint8Array, armoredPrivateKey: string): Promise<string> => {
|
||||
const privateKey = await openpgp.readPrivateKey({ armoredKey: armoredPrivateKey })
|
||||
const message = await openpgp.createMessage({ binary: data })
|
||||
|
||||
Reference in New Issue
Block a user