Skip to main content

Parser class

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Parser can parse claim and schema data according to specification

Parser

Signature:

export declare class Parser 

Methods

MethodModifiersDescription
extractCredentialSubjectProperties(schema)staticExtractCredentialSubjectProperties return credential subject types from JSON schema
extractMetadata(schema)staticExtractMetadata return metadata from JSON schema
getFieldSlotIndex(field, schemaBytes)GetFieldSlotIndex return index of slot from 0 to 7 (each claim has by default 8 slots) for non-merklized claims
getLdPrefixesByJSONSchema(schema)staticGetLdPrefixesByJSONSchema return possible credential types for JSON schema
parseClaim(credential, credentialType, jsonSchemaBytes, opts)ParseClaim creates core.Claim object from W3CCredential
parseSlots(credential, schemaBytes)ParseSlots converts payload to claim slots using provided schema