1
0
Fork 0
peertube/server/helpers/custom-validators/activitypub/signature.ts

23 lines
643 B
TypeScript
Raw Normal View History

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