better error checking
This commit is contained in:
parent
03fe61f2e4
commit
44de364ae4
1 changed files with 6 additions and 0 deletions
|
|
@ -87,6 +87,12 @@ mySEA.decrypt = (encMsg, secret) => {
|
|||
}
|
||||
|
||||
mySEA.secret = (recipientOrSenderEpub, recipientOrSenderSEA) => {
|
||||
if (typeof recipientOrSenderEpub !== 'string') {
|
||||
throw new TypeError('epub has to be an string')
|
||||
}
|
||||
if (typeof recipientOrSenderSEA !== 'object') {
|
||||
throw new TypeError('sea has to be an object')
|
||||
}
|
||||
if (recipientOrSenderEpub === recipientOrSenderSEA.pub) {
|
||||
throw new Error('Do not use pub for mysecret')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue