@regulaforensics/document-reader
Version:
This is an npm module for Regula Document Reader SDK. It allows you to read various kinds of identification documents using your phone's camera.
55 lines (50 loc) • 1.38 kB
JavaScript
export class PKDCertificate {
binaryData
resourceType
privateKey
constructor(binaryData, resourceType, options) {
this.binaryData = binaryData
this.resourceType = resourceType
this.privateKey = options?.privateKey
}
static fromJson(jsonObject) {
if (jsonObject == null) return null
return new PKDCertificate(
jsonObject["binaryData"],
jsonObject["resourceType"],
{ privateKey: jsonObject["privateKey"] }
)
}
}
export const PKDResourceType = {
CERTIFICATE_PA: 0,
CERTIFICATE_TA: 1,
LDIF: 2,
CRL: 3,
ML: 4,
DEFL: 5,
DEVL: 6,
BL: 7,
getType(value) {
switch (value) {
case "pa":
return PKDResourceType.CERTIFICATE_PA
case "ta":
return PKDResourceType.CERTIFICATE_TA
case "ldif":
return PKDResourceType.LDIF
case "crl":
return PKDResourceType.CRL
case "ml":
return PKDResourceType.ML
case "defl":
return PKDResourceType.DEFL
case "devl":
return PKDResourceType.DEVL
case "bl":
return PKDResourceType.BL
default:
return PKDResourceType.CERTIFICATE_PA
}
}
}