Skip to main content

js-sdk package

Classes

ClassDescription
AgentResolver

AgentResolver is a class that allows to interact with the issuer's agent to get revocation status.

AgentResolver

AtomicQueryMTPV2Inputs

AtomicQueryMTPInputs ZK private inputs for credentialAtomicQueryMTP.circom

AtomicQueryMTPV2Inputs {BaseConfig}

AtomicQueryMTPV2OnChainInputs

AtomicQueryMTPV2OnChainInputs ZK private inputs for credentialAtomicQueryMTPV2OnChain.circom

AtomicQuerySigV2OnChainInputs {BaseConfig}

AtomicQueryMTPV2OnChainPubSignals

public signals

AtomicQueryMTPV2OnChainPubSignals {BaseConfig}

AtomicQueryMTPV2PubSignals

Public signals

AtomicQueryMTPV2PubSignals {BaseConfig}

AtomicQuerySigV2Inputs

AtomicQuerySigV2Inputs representation for credentialAtomicQuerySig.circom Inputs and public signals declaration, marshalling and parsing

AtomicQuerySigV2Inputs {BaseConfig}

AtomicQuerySigV2OnChainCircuitInputs

AtomicQuerySigV2OnChainCircuitInputs type represents credentialAtomicQuerySig.circom private inputs required by prover

AtomicQuerySigV2OnChainCircuitInputs

AtomicQuerySigV2OnChainInputs

AtomicQuerySigV2OnChainInputs ZK private inputs for credentialAtomicQuerySig.circom

AtomicQuerySigV2OnChainInputs {BaseConfig}

AtomicQuerySigV2OnChainPubSignals

public signals

AtomicQuerySigV2OnChainPubSignals {BaseConfig}

AtomicQuerySigV2PubSignals

public signals

AtomicQuerySigV2PubSignals {BaseConfig}

AuthHandler

Allows to process AuthorizationRequest protocol message and produce JWZ response.

AuthHandler implements IAuthHandler interface

AuthV2Inputs

Auth v2 circuit representation Inputs and public signals declaration, marshalling and parsing

AuthV2Inputs {BaseConfig}

AuthV2PubSignals

public signals

AuthV2PubSignals

BaseConfig

base config for circuit inputs

BaseConfig

BjjProvider

Provider for Baby Jub Jub keys

BjjProvider implements IKeyProvider interface

BJJSignatureProof2021

BJJSignatureProof2021 is a signature of core claim by BJJ key

BJJSignatureProof2021

BrowserDataSource

Storage in the browser, uses local storage

BrowserDataSource Type

CircuitClaim

Claim structure for circuit inputs

CircuitClaim

CircuitStorage

Implementation of ICircuitStorage to store keys data

CircuitStorage implements ICircuitStorage interface

CredentialStatusResolverRegistry

CredentialStatusResolverRegistry is a registry of CredentialStatusResolver

CredentialStatusResolverRegistry

CredentialStorage

Implementation of ICredentialStorage with KV Data source

CredentialStorage {ICredentialStorage}

CredentialWallet

Wallet instance is a wrapper of CRUD logic for W3C credentials, also it allows to fetch revocation statuses.

CredentialWallet implements ICredentialWallet interface

DataPrepareHandlerFunc

Handler to

DataPrepareHandlerFunc

EthStateStorageEthStateStorage implements IStateStorage interface
FetchHandler

Allows to handle Credential offer protocol message and return fetched credential

FetchHandler implements IFetchHandler interface

FilterQuery

Filter for queries of credentialSubject with a json path e.g birthday.date

FilterQuery implements IFilterQuery interface

FSKeyLoader

Loader from file system

FSKeyLoader implements IKeyLoader interface

Iden3SparseMerkleTreeProof

Iden3SparseMerkleProof is a iden3 protocol merkle tree proof

Iden3SparseMerkleTreeProof

IdentityStorage

Implementation of the IIdentityStorage with KV data source

IdentityStorage implements IIdentityStorage interface

IdentityWallet

Wallet instance to manage the digital identity based on iden3 protocol allows to: create identity/profile, sign payloads (bigint / bytes), generate keys, generate Merkle tree proofs of inclusion / non-inclusion to Merkle trees, issue credentials with a BJJSignature and Iden3SparseMerkleTree Proofs, revoke credentials, add credentials to Merkle trees, push states to reverse hash service

IdentityWallet - class

implements IIdentityWallet interface

IndexedDBDataSource

Storage in the browser, uses indexed db storage

IndexedDBDataSource Type

IndexedDBPrivateKeyStore

Allows storing keys in the indexed db storage of the browser (NOT ENCRYPTED: DO NOT USE IN THE PRODUCTION)

IndexedDBPrivateKeyStore implements AbstractPrivateKeyStore interface

InMemoryDataSource

Generic Memory Data Source

InMemoryDataSource - class Type

InMemoryMerkleTreeStorage

InMemoryMerkleTreeStorage implements IMerkleTreeStorage interface

InMemoryPrivateKeyStore

Key Store to use in memory

InMemoryPrivateKeyStore implements AbstractPrivateKeyStore interface

IssuerData

IssuerData is the data that is used to create a proof

IssuerData

IssuerResolver

IssuerResolver is a class that allows to interact with the issuer's http endpoint to get revocation status.

IssuerResolver

JsonSchemaValidator

JSON Schema Validator

JsonSchemaValidator

JWSPacker

Packer that can pack message to JWZ token, and unpack and validate JWZ envelope

ZKPPacker implements IPacker interface

KMS

Key management system class contains different key providers. allows to register custom provider, create key, get public key and sign

KMS - class

LDParser

LDParser can parse JSONLD schema according to specification

LDParser

LocalStoragePrivateKeyStore

Allows storing keys in the local storage of the browser (NOT ENCRYPTED: DO NOT USE IN THE PRODUCTION)

LocalStoragePrivateKeyStore implements AbstractPrivateKeyStore interface

MerkleTreeIndexedDBStorage

Merkle tree storage that uses browser indexed db storage

MerkleTreeIndexedDBStorage implements IMerkleTreeStorage interface

MerkleTreeLocalStorage

Merkle tree storage that uses browser local storage

MerkleTreeLocalStorage implements IMerkleTreeStorage interface

NativeProver
OnChainResolver

OnChainIssuer is a class that allows to interact with the onchain contract and build the revocation status.

OnChainIssuer

PackageManager

Basic package manager for iden3 communication protocol

PackageManager implements IPackageManager interface

Parser

Parser can parse claim and schema data according to specification

Parser

PlainPacker

Plain packer just serializes bytes to JSON and adds media type

PlainPacker implements IPacker interface

ProofNode

ProofNode is a partial Reverse Hash Service result it contains the current node hash and its children

ProofNode

ProofService

Proof service is an implementation of IProofService that works with a native groth16 prover

ProofService implements IProofService interface

Query

Query represents basic request to claim slot verification

Query

RevocationStatusDTO

RevocationStatusDTO is a result of fetching credential status with type SparseMerkleTreeProof

RevocationStatusDTO

RHSResolver

RHSResolver is a class that allows to interact with the RHS service to get revocation status.

RHSResolver

Scalar

Scalar is used to compare two scalar value.

Scalar implements IComparer interface

Sec256k1Provider

Provider for Sec256p1 keys256p1

Sec256p1Provider implements IKeyProvider interface

StateTransitionInputs

StateTransition circuit representation Inputs and public signals declaration, marshalling and parsing

StateTransitionInputs {BaseConfig}

StateTransitionPubSignals

Public signals of StateTransition circuit

StateTransitionPubSignals

ValueProof

ValueProof represents a Merkle Proof for a value stored as MT

ValueProof

Vector

Vector uses for find/not find x scalar type in y vector type.

Vector implements IComparer interface

VerificationHandlerFunc

Handler to verify public signals of authorization circuits

VerificationHandlerFunc

W3CCredential

W3C Verifiable credential

https://www.w3.org/2018/credentials/v1

W3CCredential

ZKPPacker

Packer that can pack message to JWZ token, and unpack and validate JWZ envelope

ZKPPacker implements IPacker interface

Abstract Classes

Abstract ClassDescription
AbstractPrivateKeyStore

KeyStore that allows to import and get keys by alias.

AbstractPrivateKeyStore

Enumerations

EnumerationDescription
CircuitError

List of errors of circuit inputs processing

{number}

CircuitId

CircuitID is alias for circuit identifier

{number}

CredentialStatusType

CredentialStatusType type for revocation type

{number}

KmsKeyType

Key type that can be used in the key management system

{number}

MerkleTreeType

Type of MerkleTree

{number}

MerklizedRootPosition

Merklized Core.Claim root position for vc creation

{number}

Operators

List of available operators.

{number}

ProofPurpose

W3C Proof purpose

{number}

ProofType

Proof type for Verifiable Credential supported by sdk

{number}

SearchError

search errors

{number}

SubjectPosition

Subject Core.Claim position for vc creation

{number}

Functions

FunctionDescription
base58ToBytes(s)
base64ToBytes(s)
bytesToBase58(b)
bytesToBase64(b)
bytesToBase64url(b)
bytesToHex(b)
checkDataInField(data)check if byte data is in Q field
dataFillsSlot(slot, newData)checks if data fills into slot capacity ()
decodeBase64url(s)
encodeBase64url(s)
extractProof(proof)

extracts core claim from Proof and returns Proof Type

fieldToByteArray(field)FieldToByteArray convert fields to byte representation based on type
getProperties(obj)return object properties
getRandomBytes(n)generates Uint8Array with random bytes of size n
hexToBytes(s)
isGenesisStateId(id, state, type)Checks if id is created from given state and type is genesis
isIssuerGenesis(issuer, state)Checks if issuer did is created from given state is genesis
keyPath(keyType, keyID)builds key path
pushHashesToRHS(state, trees, rhsUrl, revokedNonces)

Pushes identity state information to a reverse hash service.

A reverse hash service (RHS) is a centralized or decentralized service for storing publicly available data about identity. Such data are identity state and state of revocation tree and roots tree root tree.

Interfaces

InterfaceDescription
AuthHandlerOptions

Options to pass to auth handler

AuthHandlerOptions

BJJSignatureProof

prepared bjj signature for circuits with auth bjj claim data

BJJSignatureProof

ClaimNonRevStatus

claim non revocation status for circuit TreeState and Proof of inclusion / non-inclusion

ClaimNonRevStatus

ClaimWithMTPProof

Claim for circuit with non revocation proof and proof of merkle tree inclusion

ClaimWithMTPProof

ClaimWithSigProof

Claim for circuit with non revocation proof and signature proof

ClaimWithSigProof

CoreClaimOptions

CoreClaimOptions is params for core claim parsing

CoreClaimOptions

CredentialRequest

Request to core library to create Core Claim from W3C Verifiable Credential

CredentialRequest

CredentialSchema

Credential schema vc

CredentialSchema

CredentialStatus

CredentialStatus contains type and revocation Url

CredentialStatus

CredentialStatusResolveOptions

CredentialStatusResolveOptions is a set of options that can be passed to CredentialStatusResolver

CredentialStatusResolveOptions

CredentialStatusResolver

CredentialStatusResolver is an interface that allows to interact with deifferent types of credential status to resolve revocation status

CredentialStatusResolver

DIDProfileMetadata
EthConnectionConfig

Configuration of ethereum based blockchain connection

EthConnectionConfig

FetchHandlerOptions

Options to pass to fetch handler

FetchHandlerOptions

GISTProof

global identity state proof

GISTProof

IAuthHandler

Interface that allows the processing of the authorization request in the raw format for given identifier

IAuthHandler

ICircuitStorage

Interface to work with circuit files

ICircuitStorage

IComparer
ICredentialStorage

Interface for credential storages

ICredentialStorage

ICredentialWallet

Interface to work with credential wallets

ICredentialWallet

IDataSource

Generic Key/Value Data Source for crud operation

IDataSource Type - generic type

IDataStorage

General Data storage interface that union identity, credential, merkletree and states storage.

IDataStorage

Iden3ProofCreationResult

Proof creation result

Iden3ProofCreationResult

IdentityCreationOptionsDID creation options seed - seed to generate BJJ keypair revocationOpts - IdentityCreationOptions
IdentityMerkleTreeMetaInformation

Interface to store metadata about merkle tree

IdentityMerkleTreeMetaInformation

IFetchHandler

Interface that allows the processing of the credential offer in the raw format for given identifier

IFetchHandler

IFilterQuery

query filter interface that allows to query Verifiable Credential

IFilterQuery

IIdentityStorage

storage for identities and profiles

IIdentityStorage

IIdentityWalletInterface for IdentityWallet
IKeyLoader

Loader interface to load from different sources

IKeyLoader

IKeyProvider

KeyProvider is responsible for signing and creation of the keys

IKeyProvider

IMerkleTreeStorage

Interface to work with a merkle tree storage

IMerkleTreeStorage

IPackageManager

Interface for defining the registry of packers

IPackageManager

IPacker

Defines method that must be implemented by any packer

IPacker

IProofService
Issuer

Issuer tree information

Issuer

IStateStorage

Interface that defines methods for state storage

IStateStorage

JSONSchema

JSON credential Schema

Schema

KmsKeyId

ID of the key that describe contain key type

KmsKeyId

MerkleTreeProofWithTreeState

Proof with MerkleTree info

MerkleTreeProofWithTreeState

MTProof

prepared mtp with a tree state

MTProof

NodeAuxValue

auxiliary node

NodeAuxValue

ParsedSlots

Parsed slots of core.Claim

ParsedSlots

ProofDTO

Proof dto as a partial result of fetching credential status with type SparseMerkleTreeProof

ProofDTO

ProofGenerationOptions
ProofQuery

Query represents structure for query to atomic circuit

ProofQuery

QueryWithFieldName
RevocationStatus

RevocationStatus status of revocation nonce. Info required to check revocation state of claim in circuits

RevocationStatus

RootInfo

global identity state root info from chain

RootInfo

SchemaMetadata

schema metadata in the json credential schema

SchemaMetadata

SerializationSchema

Serialization of data slots for the fields non-merklized claims

SerializationSchema

State

Represents the published state of the issuer

State

StateInfo

state information of identity from chain.

StateInfo

StateProof

state proof of identity from chain

StateProof

TreesModel

Interface to unite contains three trees: claim, revocation and rootOfRoots Also contains the current state of identity

TreesModel

TreeState

TreeState is model for merkle tree roots

TreeState

Namespaces

NamespaceDescription
PROTOCOL_CONSTANTS

Variables

VariableDescription
bigIntArrayToStringArrayconverts each big integer in array to string
bJJSignatureFromHexString
buildQueryPath
buildTreeStateconverts hexes of tree roots to Hashes
byteDecoder
byteEncoder
comparatorOptions
createSchemaHashCalculates schema hash
createVerifiablePresentation
defaultEthConnectionConfig
defaultMTLevels
defaultMTLevelsClaimsMerklization
defaultMTLevelsOnChain
defaultValueArraySize
defineMerklizedRootPositionReturns merklized root position based on schema serialization metadata and expected position
DIDDocumentJSONSchemaDIDDocumentJSONSchema is a basic schema of did document
ErrorEmptyAuthClaimNonRevProof
ErrorEmptyAuthClaimProof
ErrorEmptyChallengeSignature
ErrorEmptyClaimNonRevProof
ErrorEmptyClaimProof
ErrorEmptyClaimSignature
ErrorEmptyIssuerAuthClaimNonRevProof
ErrorEmptyIssuerAuthClaimProof
ErrorUserStateInRelayClaimProof
existenceToIntconverts boolean existence param to integer if true - 1, else - 0
extractPublicKeyBytes
factoryComparerFactoryComparer depends on input data will return right comparer.
fillSlotchecks if data can fill the slot
generateProfileDIDReturns profile DID based on did and profile nonce
getNodeAuxValue
JSON_SCHEMA_VALIDATORS_REGISTRYJSON SCHEMA VALIDATOR REGISTRY
prepareCircuitArrayValuesPrepareCircuitArrayValues padding values to size. Validate array size and throw an exception if array is bigger than size if array is bigger, circuit cannot compile because number of inputs does not match
prepareSiblingsStrsiblings as string array
QueryOperatorsQueryOperators represents operators for atomic circuits
resolvePathcredential search path resolver
resolveVerificationMethods
StandardJSONCredentialsQueryFiltercreates filters based on proof query
stringByPath
strMTHexconverts hex to Hash
subjectPositionIndexDetermines subject position
swapEndiannessSwapEndianness swaps the endianness of the value encoded in buf. If buf is Big-Endian, the result will be Little-Endian and vice-versa.
toClaimNonRevStatusconverts verifiable RevocationStatus model to circuits structure
toGISTProofconverts state info from smart contract to gist proof
VerifiableConstantsVerifiable constants
verifiablePresentationFromCred

Type Aliases

Type AliasDescription
AuthDataPrepareFuncsignature of auth signals function preparer
AuthorizationMessageResponseBodyAuthorizationMessageResponseBody is struct the represents authorization response data
AuthorizationRequestMessageAuthorizationRequestMessage is struct the represents iden3message authorization request
AuthorizationRequestMessageBodyAuthorizationRequestMessageBody is body for authorization request
AuthorizationResponseMessageAuthorizationResponseMessage is struct the represents iden3message authorization response
BasicMessage
CircuitDataCircuit data that includes id, wasm file, verification key and proving key
CredentialFetchRequestMessageCredentialFetchRequestMessage represent Iden3message for credential fetch request
CredentialFetchRequestMessageBodyCredentialFetchRequestMessageBody is msg body for fetch request
CredentialIssuanceMessageCredentialIssuanceMessage represent Iden3message for credential issuance
CredentialIssuanceRequestMessageCredentialIssuanceRequestMessage represent Iden3message for credential request
CredentialIssuanceRequestMessageBodyCredentialIssuanceRequestMessageBody represents data for credential issuance request
CredentialOfferCredentialOffer is structure to fetch credential
CredentialsOfferMessageCredentialsOfferMessage represent Iden3message for credential offer
CredentialsOfferMessageBodyCredentialsOfferMessageBody is struct the represents offer message
EnvelopeStubEnvelopeStub is used to stub the jwt based envelops
FilterOperatorFunctionfilter function type
FilterOperatorMethodallowed operators to search
HeaderStubHeaderStub is used to stub the jwt based envelops
IdentityIdentity structure that can be used for identity storage
IssuanceMessageBodyIssuanceMessageBody is struct the represents message when credential is issued
JSONObjectJSON object
JWSPackerParamsJWSPackerParams are parameters for JWS packer
MessageFetchRequestMessageMessageFetchRequestMessage represent Iden3message for message fetch request.
MessageFetchRequestMessageBodyMessageFetchRequestMessageBody is struct the represents body for message fetch request.
PackerParamsparameters for any packer
PlainPackerParamsparameters for plain packer
ProfileProfile structure that can be used for profiles storage
ProofGenerationRequestMessageProofGenerationRequestMessage is struct the represents body for proof generation request
ProofGenerationRequestMessageBodyProofGenerationRequestMessageBody is struct the represents body for proof generation request
ProofGenerationResponseMessageProofGenerationResponseMessage is struct the represents body for proof generation request
ProtocolMessageProtocol message type
ProvingParamsParams for generation of proof for auth circuit
ResponseMessageBodyResponseMessageBody is struct the represents request for revocation status
RevocationStatusRequestMessageRevocationStatusRequestMessage is struct the represents body for proof generation request
RevocationStatusRequestMessageBodyRevocationStatusRequestMessageBody is struct the represents request for revocation status
RevocationStatusResponseMessageRevocationStatusResponseMessage is struct the represents body for proof generation request
RevocationStatusResponseMessageBodyRevocationStatusResponseMessageBody is struct the represents request for revocation status
SchemaSchema represents location and type where it's stored
SignerFnSignerFn Is function to sign data with a verification method
StateVerificationFuncsignature of state function verifier
VerificationParamsParams for verification of auth circuit public signals
ZeroKnowledgeProofRequestZeroKnowledgeProofRequest represents structure of zkp request object
ZeroKnowledgeProofResponseZeroKnowledgeProofResponse represents structure of zkp response
ZKPPackerParamsparameters for zkp packer