PeerTube/server/helpers/custom-validators/activitypub/signature.ts

23 lines
641 B
TypeScript
Raw Normal View History

2017-11-09 10:51:58 -06:00
import { exists } from '../misc'
import { isActivityPubUrlValid } from './misc'
function isSignatureTypeValid (signatureType: string) {
2017-12-18 04:53:04 -06:00
return exists(signatureType) && signatureType === 'RsaSignature2017'
2017-11-09 10:51:58 -06:00
}
function isSignatureCreatorValid (signatureCreator: string) {
return exists(signatureCreator) && isActivityPubUrlValid(signatureCreator)
}
function isSignatureValueValid (signatureValue: string) {
return exists(signatureValue) && signatureValue.length > 0
}
// ---------------------------------------------------------------------------
export {
isSignatureTypeValid,
isSignatureCreatorValid,
isSignatureValueValid
}