Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Latest commit

 

History

History
372 lines (227 loc) · 12.2 KB

modules.md

File metadata and controls

372 lines (227 loc) · 12.2 KB

Mattr Verifier SDK React Native / Exports

Mattr Verifier SDK React Native

Table of contents

Namespaces

Enumerations

Type Aliases

Functions

Type Aliases

BaseSDKError

Ƭ BaseSDKError: Object

Type declaration

Name Type
cause? Error | unknown
message string
type string

CloseVerifierError

Ƭ CloseVerifierError: BaseSDKError & { type: "CloseVerifierError" }


CommonVerifyError

Ƭ CommonVerifyError: BaseSDKError & { type: CommonVerifyErrorType }


CompactSemanticCredentialPayload

Ƭ CompactSemanticCredentialPayload: ImplementsZodType<TypeOf<typeof CompactSemanticCredentialPayloadValidator>, { aud?: string ; exp?: number ; iat?: number ; iss: string ; jti: string ; nbf: number ; status?: CwtStatus ; sub?: string ; vc: CompactSemanticCredentialVcPayload }>


CompactSemanticCredentialVcPayload

Ƭ CompactSemanticCredentialVcPayload: ImplementsZodType<TypeOf<typeof CompactSemanticCredentialVcPayloadValidator>, { @context: JsonLdContext ; credentialSubject: Record<string, string | number | boolean> ; type: string[] }>


CompactSemanticVerifyError

Ƭ CompactSemanticVerifyError: BaseError & { type: CompactSemanticVerifyErrorType }


CompactSemanticVerifyErrorType

Ƭ CompactSemanticVerifyErrorType: VerifyErrorType


CompactSemanticVerifyFailureReasonType

Ƭ CompactSemanticVerifyFailureReasonType: VerifyFailureReasonType


CompactSemanticVerifyResult

Ƭ CompactSemanticVerifyResult: Omit<VerifyResult, "payload" | "reason"> & { header?: CwtHeader ; payload?: CompactSemanticCredentialPayload ; reason: { details?: VerifyFailedResultReasonDetails ; message: string ; type: CompactSemanticVerifyFailureReasonType } ; verified: false } | Omit<VerifyResult, "payload"> & { header: CwtHeader ; payload: CompactSemanticCredentialPayload ; verified: true }


CompactVerifyError

Ƭ CompactVerifyError: BaseError & { type: CompactVerifyErrorType }


CompactVerifyErrorType

Ƭ CompactVerifyErrorType: VerifyErrorType


CompactVerifyFailureReasonType

Ƭ CompactVerifyFailureReasonType: VerifyFailureReasonType


CompactVerifyResult

Ƭ CompactVerifyResult: Omit<VerifyResult, "payload" | "reason"> & { header?: CwtHeader ; payload?: CompactCredentialPayload ; reason: { details?: VerifyFailedResultReasonDetails ; message: string ; type: CompactVerifyFailureReasonType } ; verified: false } | Omit<VerifyResult, "payload"> & { header: CwtHeader ; payload: CompactCredentialPayload ; verified: true }


DestroyVerifierError

Ƭ DestroyVerifierError: BaseSDKError & { type: "DestroyVerifierError" }


EncryptionKeyNotFoundError

Ƭ EncryptionKeyNotFoundError: BaseSDKError & { type: "EncryptionKeyNotFoundError" }


GenericPayload

Ƭ GenericPayload: Record<string, unknown>


InitOptions

Ƭ InitOptions: Object

Options to configure when initialising a verifier

Type declaration

Name Type Description
assertExpiry? boolean Set whether to check the credential's expiry date during verification. If true, verification will fail if the credential is expired. remarks Default to true.
assertNotBefore? boolean Set whether to check the credential's not before date during verification. If true, verification will fail if the credential is not active i.e. current date is before the not before date. remarks Not before date is the date a credential is activated and becomes active. Default to true.
checkRevocation? boolean Set whether to check the credential's revocation status during verification. If true, verification will fail if the credential is revoked. remarks Revocation status represents the validity of the credential as determined by the issuer. Default to true.
issuerCacheTtl number Duration that an issuer is kept in the cache after it is added or re-added
revocationListCacheTtl number Duration that a revocation list is kept in the cache after it is added or re-added
trustedIssuers? ReadonlyArray<string> List of issuers we want to trust the credentials of remarks Issuers defined here are cached up front. If this is empty, all issuers will be considered trusted.

IssuerResolverError

Ƭ IssuerResolverError: BaseError & { type: IssuerResolverErrorType }


MalformedEncryptionKeyError

Ƭ MalformedEncryptionKeyError: BaseSDKError & { type: "MalformedEncryptionKeyError" }


PropertiesMappingConfig

Ƭ PropertiesMappingConfig: Record<string, (value: unknown) => [string, unknown]>

A record of transformation functions that maps an existing key and value to a new key and value The existing value is passed as the parameter to the transformation function

example

 // Defines a single transformation to map an object of type { foo: any } to { bar: "something" }
 const propertyMappingConfig = {
   foo: (_foosValue) => ["bar", "something"],
 };

RefreshCacheError

Ƭ RefreshCacheError<E>: BaseSDKError & { cause?: readonly ResolverError<E>[] ; expiryDate: Date | undefined ; type: RefreshCacheErrorType }

Type parameters

Name
E

RefreshCacheSuccess

Ƭ RefreshCacheSuccess: Object

Type declaration

Name Type
expiryDate Date | undefined

ResolverError

Ƭ ResolverError<E>: Object

Type parameters

Name
E

Type declaration

Name Type
error E
key string

Result

Ƭ Result<T, E>: Ok<T, E> | Err<T, E>

Type parameters

Name
T
E

Verifier

Ƭ Verifier: VerifierBase & VerifierExtension


VerifierBase

Ƭ VerifierBase: Object

An instance of a verifier

Type declaration

Name Type
close () => Promise<Result<void, CloseVerifierError>>
getCacheExpiry () => Promise<undefined | Date>
isOpen () => boolean
refreshCache () => Promise<Result<RefreshCacheSuccess, RefreshCacheError<IssuerResolverError | RevocationListResolverError>>>
verify (options: VerifyCredentialOptions) => Promise<Result<VerifyCredentialResult, VerifyCredentialError>>

VerifierExtension

Ƭ VerifierExtension: Object

React Native specific verifier that has been extended with additional functionality

Type declaration

Name Type
destroy () => Promise<Result<void, DestroyVerifierError>>

VerifyCredentialError

Ƭ VerifyCredentialError: CommonVerifyError | CompactVerifyError | CompactSemanticVerifyError


VerifyCredentialOptions

Ƭ VerifyCredentialOptions: Object

Type declaration

Name Type Description
payload string The credential payload to verify
propertyMappingConfig? PropertiesMappingConfig The mapping configuration that lists transformation functions to apply for designated properties of the returned payload

VerifyCredentialResult

Ƭ VerifyCredentialResult: CompactVerifyResult | CompactSemanticVerifyResult & { transformedPayload?: GenericPayload }

Functions

init

init(options): Promise<Verifier>

Initialise a verifier.

Parameters

Name Type Description
options InitOptions InitOptions containing the options for the init function

Returns

Promise<Verifier>

A Result containing the initialised Verifier object


unwrap

unwrap<T>(result): T

A utility function to get the value from a Result or throw if there was an error

remarks Allows you to get the value of a result directly or handle an error Result as an exception

Type parameters

Name Type Description
T unknown the expected value of an ok result

Parameters

Name Type Description
result Result<T, unknown> The Result to unwrap

Returns

T