Skip to main content

@learncard/core

LearnCard Methods

ActivateChapiHandler

Ƭ ActivateChapiHandler: (args: { get?: (event: CredentialRequestEvent) => Promise<HandlerResponse> ; mediatorOrigin?: string ; store?: (event: CredentialStoreEvent) => Promise<HandlerResponse> }) => Promise<void>

Type declaration

▸ (args): Promise<void>

Activates CHAPI

Parameters
NameType
argsObject
args.get?(event: CredentialRequestEvent) => Promise<HandlerResponse>
args.mediatorOrigin?string
args.store?(event: CredentialStoreEvent) => Promise<HandlerResponse>
Returns

Promise<void>

Defined in

learn-card-core/src/types/methods.ts:288


AddCredential

Ƭ AddCredential: <Metadata>(credential: IDXCredential<Metadata>) => Promise<void>

Type declaration

▸ <Metadata>(credential): Promise<void>

Adds a URI pointing to a credential (such as the one returned by publishCredential) to IDX with a bespoke ID

The credential may then be retrieved using getCredential and passing in that bespoke ID, or by using getCredentials/getCredentialsList to get a list of all credentials that have been added to IDX

Type parameters
NameType
Metadataextends Record<string, any> = Record<never, never>
Parameters
NameType
credentialIDXCredential<Metadata>
Returns

Promise<void>

Defined in

learn-card-core/src/types/methods.ts:144


AddInfuraProjectId

Ƭ AddInfuraProjectId: (infuraProjectIdToAdd: string) => void

Type declaration

▸ (infuraProjectIdToAdd): void

Add an infura project id to an existing wallet. Really only useful for testing with the CLI right now...

Parameters
NameType
infuraProjectIdToAddstring
Returns

void

Defined in

learn-card-core/src/types/methods.ts:260


AllLearnCardMethods

Ƭ AllLearnCardMethods: Object

Type declaration

NameType
activateChapiHandlerActivateChapiHandler
addCredentialAddCredential
addInfuraProjectIdAddInfuraProjectId
changeNetworkChangeNetwork
didDid
getBalanceGetBalance
getBalanceForAddressGetBalanceForAddress
getCredentialGetCredential
getCredentialsGetCredentials
getCredentialsListGetCredentialsList
getCurrentNetworkGetCurrentNetwork
getEthereumAddressGetEthereumAddress
getTestVcGetTestVc
getTestVpGetTestVp
installChapiHandlerInstallChapiHandler
issueCredentialIssueCredential
issuePresentationIssuePresentation
keypairKeypair
newCredentialNewCredential
newPresentationNewPresentation
publishCredentialPublishCredential
readFromCeramicReadFromCeramic
receiveChapiEventReceiveChapiEvent
removeCredentialRemoveCredential
resolveCredentialResolveCredential
resolveDidResolveDid
storeCredentialViaChapiDidAuthStoreCredentialViaChapiDidAuth
storePresentationViaChapiStorePresentationViaChapi
transferTokensTransferTokens
verifyCredentialVerifyCredential
verifyPresentationVerifyPresentation
vpFromQrCodeVpFromQrCode
vpToQrCodeVpToQrCode

Defined in

learn-card-core/src/types/methods.ts:323


ChangeNetwork

Ƭ ChangeNetwork: (network: ethers.providers.Networkish) => void

Type declaration

▸ (network): void

Change your Ethereum network

Parameters
NameType
networkethers.providers.Networkish
Returns

void

Defined in

learn-card-core/src/types/methods.ts:252


Did

Ƭ Did: (type?: DidMethod) => string

Type declaration

▸ (type?): string

Wallet holder's did

Parameters
NameType
type?DidMethod
Returns

string

Defined in

learn-card-core/src/types/methods.ts:29


GetBalance

Ƭ GetBalance: (symbolOrAddress?: string) => Promise<string>

Type declaration

▸ (symbolOrAddress?): Promise<string>

Get the balance of an ERC20 token Defaults to ETH if symbolOrAddress is not provided

Parameters
NameType
symbolOrAddress?string
Returns

Promise<string>

Defined in

learn-card-core/src/types/methods.ts:216


GetBalanceForAddress

Ƭ GetBalanceForAddress: (walletAddress: string, symbolOrAddress?: string) => Promise<string>

Type declaration

▸ (walletAddress, symbolOrAddress?): Promise<string>

Get the balance of an ERC20 token for a given address Defaults to ETH if symbolOrAddress is not provided

Parameters
NameType
walletAddressstring
symbolOrAddress?string
Returns

Promise<string>

Defined in

learn-card-core/src/types/methods.ts:224


GetCredential

Ƭ GetCredential: (title: string) => Promise<VC | undefined>

Type declaration

▸ (title): Promise<VC | undefined>

Returns the credential marked with title from IDX

Parameters
NameType
titlestring
Returns

Promise<VC | undefined>

Defined in

learn-card-core/src/types/methods.ts:106


GetCredentials

Ƭ GetCredentials: () => Promise<VC[]>

Type declaration

▸ (): Promise<VC[]>

Returns all credentials from IDX

Returns

Promise<VC[]>

Defined in

learn-card-core/src/types/methods.ts:113


GetCredentialsList

Ƭ GetCredentialsList: <Metadata>() => Promise<IDXCredential<Metadata>[]>

Type declaration

▸ <Metadata>(): Promise<IDXCredential<Metadata>[]>

Returns all credentials from IDX

Type parameters
NameType
Metadataextends Record<string, any> = Record<never, never>
Returns

Promise<IDXCredential<Metadata>[]>

Defined in

learn-card-core/src/types/methods.ts:120


GetCurrentNetwork

Ƭ GetCurrentNetwork: () => ethers.providers.Networkish

Type declaration

▸ (): ethers.providers.Networkish

Get your current Ethereum network

Returns

ethers.providers.Networkish

Defined in

learn-card-core/src/types/methods.ts:245


GetEthereumAddress

Ƭ GetEthereumAddress: () => string

Type declaration

▸ (): string

Returns Ethereum public address

Returns

string

Defined in

learn-card-core/src/types/methods.ts:208


GetTestVc

Ƭ GetTestVc: (subject?: string) => UnsignedVC

Type declaration

▸ (subject?): UnsignedVC

Returns an example credential, optionally allowing a subject's did to be passed in

You can use this to test out implementations that use this library!

Parameters
NameType
subject?string
Returns

UnsignedVC

Defined in

learn-card-core/src/types/methods.ts:191


GetTestVp

Ƭ GetTestVp: (credential?: VC) => Promise<UnsignedVP>

Type declaration

▸ (credential?): Promise<UnsignedVP>

Wraps a crednetial in an exmaple presentaion. If no credential is provided, a new one will be generated using getTestVc

You can use this to test out implementations that use this library!

Parameters
NameType
credential?VC
Returns

Promise<UnsignedVP>

Defined in

learn-card-core/src/types/methods.ts:201


InstallChapiHandler

Ƭ InstallChapiHandler: () => Promise<void>

Type declaration

▸ (): Promise<void>

Sets up CHAPI

Returns

Promise<void>

Defined in

learn-card-core/src/types/methods.ts:281


IssueCredential

Ƭ IssueCredential: (credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>

Type declaration

▸ (credential, signingOptions?): Promise<VC>

Signs an unsigned Verifiable Credential, returning the signed VC

Parameters
NameType
credentialUnsignedVC
signingOptions?Partial<ProofOptions>
Returns

Promise<VC>

Defined in

learn-card-core/src/types/methods.ts:63


IssuePresentation

Ƭ IssuePresentation: (presentation: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<VP>

Type declaration

▸ (presentation, signingOptions?): Promise<VP>

Signs an unsigned Verifiable Presentation, returning the signed VP

Parameters
NameType
presentationUnsignedVP
signingOptions?Partial<ProofOptions>
Returns

Promise<VP>

Defined in

learn-card-core/src/types/methods.ts:85


Keypair

Ƭ Keypair: (type?: Algorithm) => { crv: string ; d: string ; kty: string ; x: string ; y?: string }

Type declaration

▸ (type?): Object

Wallet holder's ed25519 key pair

Parameters
NameType
type?Algorithm
Returns

Object

NameType
crvstring
dstring
ktystring
xstring
y?string

Defined in

learn-card-core/src/types/methods.ts:36


NewCredential

Ƭ NewCredential: NewCredentialFunction

Generates a new Unsigned VC from a template

Defined in

learn-card-core/src/types/methods.ts:49


NewPresentation

Ƭ NewPresentation: (credential: VC, args?: { did?: string }) => Promise<UnsignedVP>

Type declaration

▸ (credential, args?): Promise<UnsignedVP>

Wraps a VC in a simple Presentation

Parameters
NameType
credentialVC
args?Object
args.did?string
Returns

Promise<UnsignedVP>

Defined in

learn-card-core/src/types/methods.ts:56


PublishCredential

Ƭ PublishCredential: (credential: VC) => Promise<CeramicURI>

Type declaration

▸ (credential): Promise<CeramicURI>

Publishes a credential to Ceramic, returning the credential's Ceramic URI

This URI may then be shared/persisted/resolved to gain access to the credential

Resolving a URI can be done by passing the URI to resolveCredential

Parameters
NameType
credentialVC
Returns

Promise<CeramicURI>

Defined in

learn-card-core/src/types/methods.ts:133


ReadFromCeramic

Ƭ ReadFromCeramic: (streamId: string) => Promise<any>

Type declaration

▸ (streamId): Promise<any>

Resolves a stream ID, returning its contents

Parameters
NameType
streamIdstring
Returns

Promise<any>

Defined in

learn-card-core/src/types/methods.ts:170


ReceiveChapiEvent

Ƭ ReceiveChapiEvent: () => Promise<CredentialRequestEvent | CredentialStoreEvent>

Type declaration

▸ (): Promise<CredentialRequestEvent | CredentialStoreEvent>

Receives a CHAPI Event

Returns

Promise<CredentialRequestEvent | CredentialStoreEvent>

Defined in

learn-card-core/src/types/methods.ts:299


RemoveCredential

Ƭ RemoveCredential: (id: string) => Promise<void>

Type declaration

▸ (id): Promise<void>

Removes a credential from IDX by passing in its bespoke ID

Parameters
NameType
idstring
Returns

Promise<void>

Defined in

learn-card-core/src/types/methods.ts:153


ResolveCredential

Ƭ ResolveCredential: (URI?: string | "" | `lc:ceramic:${string}`) => Promise<VC | undefined>

Type declaration

▸ (URI?): Promise<VC | undefined>

Resolves a LearnCard URI (e.g. lc:ceramic:1234561)

This can be given the return value of publishCredential to gain access to the credential that was published

Parameters
NameType
URI?string | "" | `lc:ceramic:${string}`
Returns

Promise<VC | undefined>

Defined in

learn-card-core/src/types/methods.ts:180


ResolveDid

Ƭ ResolveDid: (did: string, inputMetadata?: InputMetadata) => Promise<Record<string, any>>

Type declaration

▸ (did, inputMetadata?): Promise<Record<string, any>>

Resolves a did to its did document

Parameters
NameType
didstring
inputMetadata?InputMetadata
Returns

Promise<Record<string, any>>

Defined in

learn-card-core/src/types/methods.ts:160


StoreCredentialViaChapiDidAuth

Ƭ StoreCredentialViaChapiDidAuth: (credential: UnsignedVC) => Promise<{ success: true } | { reason: "did not auth" | "auth failed verification" | "did not store" ; success: false }>

Type declaration

▸ (credential): Promise<{ success: true } | { reason: "did not auth" | "auth failed verification" | "did not store" ; success: false }>

Stores a Credential via CHAPI using DIDAuth

Parameters
NameType
credentialUnsignedVC
Returns

Promise<{ success: true } | { reason: "did not auth" | "auth failed verification" | "did not store" ; success: false }>

Defined in

learn-card-core/src/types/methods.ts:313


StorePresentationViaChapi

Ƭ StorePresentationViaChapi: (presentation: VP) => Promise<Credential | undefined>

Type declaration

▸ (presentation): Promise<Credential | undefined>

Stores a VP via CHAPI

Parameters
NameType
presentationVP
Returns

Promise<Credential | undefined>

Defined in

learn-card-core/src/types/methods.ts:306


TransferTokens

Ƭ TransferTokens: (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>

Type declaration

▸ (tokenSymbolOrAddress, amount, toAddress): Promise<string>

Transfer tokens to a given address

Parameters
NameType
tokenSymbolOrAddressstring
amountnumber
toAddressstring
Returns

Promise<string>

Defined in

learn-card-core/src/types/methods.ts:234


VerifyCredential

Ƭ VerifyCredential: (credential: VC, options?: Partial<ProofOptions>) => Promise<VerificationItem[]>

Type declaration

▸ (credential, options?): Promise<VerificationItem[]>

Verifies a signed Verifiable Credential

Empty error/warnings arrays means verification was successful

Parameters
NameType
credentialVC
options?Partial<ProofOptions>
Returns

Promise<VerificationItem[]>

Defined in

learn-card-core/src/types/methods.ts:75


VerifyPresentation

Ƭ VerifyPresentation: (presentation: VP, options?: Partial<ProofOptions>) => Promise<VerificationCheck>

Type declaration

▸ (presentation, options?): Promise<VerificationCheck>

Verifies a signed Verifiable Presentation

Empry error/warnings arrays means verification was successful

Parameters
NameType
presentationVP
options?Partial<ProofOptions>
Returns

Promise<VerificationCheck>

Defined in

learn-card-core/src/types/methods.ts:96


VpFromQrCode

Ƭ VpFromQrCode: (text: string) => Promise<VP>

Type declaration

▸ (text): Promise<VP>

Returns a Verifiable Presentation (VP) from a QR code base-64 image data string containing a VP compressed by CBOR-LD.

Parameters
NameType
textstring
Returns

Promise<VP>

Defined in

learn-card-core/src/types/methods.ts:267


VpToQrCode

Ƭ VpToQrCode: (vp: VP) => Promise<string>

Type declaration

▸ (vp): Promise<string>

Returns a QR-embeddable base-64 image data string from a Verifiable Presentation, compressed using CBOR-LD.

Parameters
NameType
vpVP
Returns

Promise<string>

Defined in

learn-card-core/src/types/methods.ts:274

DidKey Plugin

Algorithm

Ƭ Algorithm: "ed25519" | "secp256k1"

Defined in

learn-card-core/src/wallet/plugins/didkey/types.ts:4


DependentMethods

Ƭ DependentMethods<T>: Object

Type parameters

NameType
Textends string

Type declaration

NameType
generateEd25519KeyFromBytes(bytes: Uint8Array) => JWK
generateSecp256k1KeyFromBytes(bytes: Uint8Array) => JWK
keyToDid(type: T, keypair: JWK) => string

Defined in

learn-card-core/src/wallet/plugins/didkey/types.ts:7


DidKeyPluginMethods

Ƭ DidKeyPluginMethods<DidMethod>: Object

Type parameters

NameType
DidMethodextends string

Type declaration

NameType
getKey() => string
getSubjectDid(type: DidMethod) => string
getSubjectKeypair(type?: Algorithm) => JWK

Defined in

learn-card-core/src/wallet/plugins/didkey/types.ts:14

IDXPlugin

BackwardsCompatCredentialsList

Ƭ BackwardsCompatCredentialsList<Metadata>: Object

Type parameters

NameType
Metadataextends Record<string, any> = Record<never, never>

Type declaration

NameType
credentials(IDXCredential<Metadata> | BackwardsCompatIDXCredential<Metadata>)[]

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:74


BackwardsCompatIDXCredential

Ƭ BackwardsCompatIDXCredential<Metadata>: { [key: string]: any; id: string ; storageType?: "ceramic" ; title: string } & Metadata

Type parameters

NameType
Metadataextends Record<string, any> = Record<never, never>

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:64


CeramicIDXArgs

Ƭ CeramicIDXArgs: Object

Type declaration

NameType
ceramicEndpointstring
credentialAliasstring
defaultContentFamilystring
modelDataModelAliases

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:8


CeramicURI

Ƭ CeramicURI: `lc:ceramic:${string}`

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:16


CredentialsList

Ƭ CredentialsList<Metadata>: Object

Type parameters

NameType
Metadataextends Record<string, any> = Record<never, never>

Type declaration

NameType
credentialsIDXCredential<Metadata>[]

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:51


IDXPluginDependentMethods

Ƭ IDXPluginDependentMethods<URI>: { getKey: () => string } & ResolutionExtension<URI>

Type parameters

NameType
URIextends string = ""

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:46


IDXPluginMethods

Ƭ IDXPluginMethods<URI>: { addVerifiableCredentialInIdx: <Metadata>(cred: IDXCredential<Metadata>) => Promise<CeramicURI> ; getCredentialsListFromIdx: <Metadata>(alias?: string) => Promise<CredentialsList<Metadata>> ; getVerifiableCredentialFromIdx: (id: string) => Promise<VC | undefined> ; getVerifiableCredentialsFromIdx: () => Promise<VC[]> ; publishContentToCeramic: (cred: any) => Promise<CeramicURI> ; readContentFromCeramic: (streamId: string) => Promise<any> ; removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID> } & ResolutionExtension<URI | CeramicURI>

Type parameters

NameType
URIextends string = ""

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:31


BackwardsCompatCredentialsListValidator

Const BackwardsCompatCredentialsListValidator: z.ZodType<BackwardsCompatCredentialsList>

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:81


BackwardsCompatIDXCredentialValidator

Const BackwardsCompatIDXCredentialValidator: z.ZodType<BackwardsCompatIDXCredential>

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:69


CeramicURIValidator

Const CeramicURIValidator: ZodEffects<ZodEffects<ZodString, string, string>, string, string>

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:19


CredentialsListValidator

Const CredentialsListValidator: z.ZodType<CredentialsList>

Defined in

learn-card-core/src/wallet/plugins/idx/types.ts:56

CHAPI Plugin

CHAPIPluginDependentMethods

Ƭ CHAPIPluginDependentMethods: Object

Type declaration

NameType
getTestVp(credential?: VC) => Promise<UnsignedVP>
issueCredential(credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>
issuePresentation(credential: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<VP>
verifyPresentation(presentation: VP, options?: Partial<ProofOptions>) => Promise<VerificationCheck>

Defined in

learn-card-core/src/wallet/plugins/chapi/types.ts:71


CHAPIPluginMethods

Ƭ CHAPIPluginMethods: Object

Type declaration

NameType
activateChapiHandler(args: { get?: (event: CredentialRequestEvent) => Promise<HandlerResponse> ; mediatorOrigin?: string ; store?: (event: CredentialStoreEvent) => Promise<HandlerResponse> }) => Promise<void>
installChapiHandler() => Promise<void>
receiveChapiEvent() => Promise<CredentialRequestEvent | CredentialStoreEvent>
storeCredentialViaChapiDidAuth(credential: UnsignedVC) => Promise<{ success: true } | { reason: "did not auth" | "auth failed verification" | "did not store" ; success: false }>
storePresentationViaChapi(presentation: UnsignedVP | VP) => Promise<Credential | undefined>

Defined in

learn-card-core/src/wallet/plugins/chapi/types.ts:88


CredentialRequestEvent

Ƭ CredentialRequestEvent: Object

Call signature

new CredentialRequestEvent(args): CredentialRequestEvent

Parameters
NameType
argsObject
args.credentialHandlerany
args.credentialRequestOptionsany
args.credentialRequestOriginstring
args.hintKeystring
Returns

CredentialRequestEvent

Type declaration

NameType
_credentialHandlerany
credentialRequestOptionsany
credentialRequestOriginstring
hintKeystring
openWindow(url: string) => Promise<any>
respondWith(handlerResponse: Promise<null | { data: any ; dataType: string }>) => void
typestring

Defined in

learn-card-core/src/wallet/plugins/chapi/types.ts:18


CredentialStoreEvent

Ƭ CredentialStoreEvent: Object

Call signature

new CredentialStoreEvent(args): CredentialStoreEvent

Parameters
NameType
argsObject
args.credentialWebCredential
args.credentialHandlerany
args.credentialRequestOriginstring
args.hintKeystring
Returns

CredentialStoreEvent

Type declaration

NameType
_credentialHandlerany
credentialWebCredential
credentialRequestOriginstring
hintKeystring
openWindow(url: string) => Promise<any>
respondWith(handlerResponse: Promise<null | { data: any ; dataType: string }>) => void
typestring

Defined in

learn-card-core/src/wallet/plugins/chapi/types.ts:42


HandlerResponse

Ƭ HandlerResponse: { type: "redirect" ; url: string } | { data: any ; dataType: string ; type: "response" }

Defined in

learn-card-core/src/wallet/plugins/chapi/types.ts:66


WebCredential

Ƭ WebCredential: Object

Call signature

new WebCredential(dataType, data, options?): WebCredential

Parameters
NameType
dataTypestring
dataObject
data.@contextstring[]
data.holder?string
data.id?string
data.proof{ [x: string]: any; challenge?: string ; created: string ; domain?: string ; jws?: string ; nonce?: string ; proofPurpose: string ; type: string ; verificationMethod: string } | { [x: string]: any; challenge?: string ; created: string ; domain?: string ; jws?: string ; nonce?: string ; proofPurpose: string ; type: string ; verificationMethod: string }[]
data.type[string, ...string[]]
data.verifiableCredential{ [x: string]: any; @context: string[] ; credentialSchema?: { id: string ; type: string }[] ; credentialStatus?: { id: string ; type: string } ; credentialSubject: { [x: string]: any; id?: string } | { [x: string]: any; id?: string }[] ; expirationDate?: string ; id?: string ; issuanceDate: string ; issuer: string | { [x: string]: any; additionalName?: string ; address?: { addressCountry?: string ; addressCountryCode?: string ; addressLocality?: string ; addressRegion?: string ; geo?: { latitude: number ; longitude: number ; type: string | [string, ...string[]] } ; postOfficeBoxNumber?: string ; postalCode?: string ; streetAddress?: string ; type: string | [string, ...string[]] } ; dateOfBirth?: string ; description?: string ; email?: string ; endorsement?: any[] ; familyName?: string ; familyNamePrefix?: string ; givenName?: string ; honorificPrefix?: string ; honorificSuffix?: string ; id?: string ; image?: string | { caption?: string ; id: string ; type: string } ; name?: string ; official?: string ; otherIdentifier?: { identifier: string ; identifierType: string ; type: string | [string, ...string[]] }[] ; parentOrg?: any ; patronymicName?: string ; phone?: string ; type?: string | [string, ...string[]] ; url?: string } ; proof: { [x: string]: any; challenge?: string ; created: string ; domain?: string ; jws?: string ; nonce?: string ; proofPurpose: string ; type: string ; verificationMethod: string } | { [x: string]: any; challenge?: string ; created: string ; domain?: string ; jws?: string ; nonce?: string ; proofPurpose: string ; type: string ; verificationMethod: string }[] ; refreshService?: { [x: string]: any; id: string ; type: string } ; type: [string, ...string[]] } | { [x: string]: any; @context: string[] ; credentialSchema?: { id: string ; type: string }[] ; credentialStatus?: { id: string ; type: string } ; credentialSubject: { [x: string]: any; id?: string } | { [x: string]: any; id?: string }[] ; expirationDate?: string ; id?: string ; issuanceDate: string ; issuer: string | { [x: string]: any; additionalName?: string ; address?: { addressCountry?: string ; addressCountryCode?: string ; addressLocality?: string ; addressRegion?: string ; geo?: { latitude: number ; longitude: number ; type: string | [string, ...string[]] } ; postOfficeBoxNumber?: string ; postalCode?: string ; streetAddress?: string ; type: string | [string, ...string[]] } ; dateOfBirth?: string ; description?: string ; email?: string ; endorsement?: any[] ; familyName?: string ; familyNamePrefix?: string ; givenName?: string ; honorificPrefix?: string ; honorificSuffix?: string ; id?: string ; image?: string | { caption?: string ; id: string ; type: string } ; name?: string ; official?: string ; otherIdentifier?: { identifier: string ; identifierType: string ; type: string | [string, ...string[]] }[] ; parentOrg?: any ; patronymicName?: string ; phone?: string ; type?: string | [string, ...string[]] ; url?: string } ; proof: { [x: string]: any; challenge?: string ; created: string ; domain?: string ; jws?: string ; nonce?: string ; proofPurpose: string ; type: string ; verificationMethod: string } | { [x: string]: any; challenge?: string ; created: string ; domain?: string ; jws?: string ; nonce?: string ; proofPurpose: string ; type: string ; verificationMethod: string }[] ; refreshService?: { [x: string]: any; id: string ; type: string } ; type: [string, ...string[]] }[]
options?Object
options.recommendedHandlerOriginsstring[]
Returns

WebCredential

Type declaration

NameType
dataVP
dataTypestring
options{ recommendedHandlerOrigins: string[] }
options.recommendedHandlerOriginsstring[]
typestring

Defined in

learn-card-core/src/wallet/plugins/chapi/types.ts:5

DIDKit Plugin

DidMethod

Ƭ DidMethod: "key" | "tz" | "ethr" | `pkh:${"tz" | "tezos" | "sol" | "solana" | "eth" | "celo" | "poly" | "btc" | "doge" | "eip155" | "bip122"}` | `pkh:eip155:${string}` | `pkh:bip122:${string}`

Defined in

learn-card-core/src/wallet/plugins/didkit/types.ts:4


DidkitPluginMethods

Ƭ DidkitPluginMethods: Object

Type declaration

NameType
contextLoader(url: string) => Promise<Record<string, any>>
generateEd25519KeyFromBytes(bytes: Uint8Array) => JWK
generateSecp256k1KeyFromBytes(bytes: Uint8Array) => JWK
issueCredential(credential: UnsignedVC, options: ProofOptions, keypair: JWK) => Promise<VC>
issuePresentation(presentation: UnsignedVP, options: ProofOptions, keypair: JWK) => Promise<VP>
keyToDid(type: DidMethod, keypair: JWK) => string
keyToVerificationMethod(type: string, keypair: JWK) => Promise<string>
resolveDid(did: string, inputMetadata?: InputMetadata) => Promise<Record<string, any>>
verifyCredential(credential: VC, options?: ProofOptions) => Promise<VerificationCheck>
verifyPresentation(presentation: VP, options?: ProofOptions) => Promise<VerificationCheck>

Defined in

learn-card-core/src/wallet/plugins/didkit/types.ts:43


InputMetadata

Ƭ InputMetadata: Object

Type declaration

NameType
accept?string
noCache?boolean
versionId?string
versionTime?string

Defined in

learn-card-core/src/wallet/plugins/didkit/types.ts:35


ProofOptions

Ƭ ProofOptions: Object

Type declaration

NameType
challenge?string
checks?("Proof" | "JWS" | "CredentialStatus")[]
created?string
domain?string
proofPurpose?string
type?string
verificationMethod?string

Defined in

learn-card-core/src/wallet/plugins/didkit/types.ts:24

LearnCard

EmptyLearnCard

Ƭ EmptyLearnCard: LearnCard<"newCredential" | "newPresentation" | "verifyCredential" | "verifyPresentation" | "resolveDid" | "installChapiHandler" | "activateChapiHandler" | "receiveChapiEvent" | "storePresentationViaChapi" | "storeCredentialViaChapiDidAuth", Wallet<"DIDKit" | "Expiration" | "VC Templates" | "CHAPI", MergeObjects<[DidkitPluginMethods, VerifyExtension, VCTemplatePluginMethods, CHAPIPluginMethods]>>>

Defined in

learn-card-core/src/types/LearnCard.ts:67


LearnCard

Ƭ LearnCard<Methods, RawWallet>: { _wallet: RawWallet } & Pick<AllLearnCardMethods, Methods>

Type parameters

NameType
Methodsextends keyof AllLearnCardMethods = keyof AllLearnCardMethods
RawWalletextends Wallet<any, any> = LearnCardRawWallet

Defined in

learn-card-core/src/types/LearnCard.ts:56


LearnCardConfig

Ƭ LearnCardConfig: Object

Type declaration

NameType
ceramicIdxCeramicIDXArgs
defaultContentsany[]
didkitInitInput | Promise<InitInput>
ethereumConfigEthereumConfig

Defined in

learn-card-core/src/types/LearnCard.ts:113


VCAPILearnCard

Ƭ VCAPILearnCard: LearnCard<"did" | "newCredential" | "newPresentation" | "issueCredential" | "verifyCredential" | "issuePresentation" | "verifyPresentation" | "getTestVc" | "getTestVp" | "installChapiHandler" | "activateChapiHandler" | "receiveChapiEvent" | "storePresentationViaChapi" | "storeCredentialViaChapiDidAuth", Wallet<"VC API" | "Expiration" | "VC Templates" | "CHAPI", MergeObjects<[VCAPIPluginMethods, VerifyExtension, VCTemplatePluginMethods, CHAPIPluginMethods]>>>

Defined in

learn-card-core/src/types/LearnCard.ts:89

Init Functions

EmptyWallet

Ƭ EmptyWallet: InitFunction<{}, "didkit", EmptyLearnCard>

Defined in

learn-card-core/src/types/LearnCard.ts:121


InitLearnCard

Ƭ InitLearnCard: GenericInitFunction<[EmptyWallet, WalletFromKey, WalletFromVcApi]>

Defined in

learn-card-core/src/types/LearnCard.ts:132


WalletFromKey

Ƭ WalletFromKey: InitFunction<{ seed: string }, keyof LearnCardConfig, LearnCard>

Defined in

learn-card-core/src/types/LearnCard.ts:123


WalletFromVcApi

Ƭ WalletFromVcApi: InitFunction<{ did?: string ; vcApi: true | string }, "defaultContents", VCAPILearnCard>

Defined in

learn-card-core/src/types/LearnCard.ts:125


emptyWallet

emptyWallet(__namedParameters?): Promise<EmptyLearnCard>

Generates an empty wallet with no key material

Parameters

NameType
__namedParametersPartial<Pick<LearnCardConfig, "didkit">>

Returns

Promise<EmptyLearnCard>

Defined in

learn-card-core/src/wallet/initializers/emptyWallet.ts:15


initLearnCard

initLearnCard(config?): Promise<EmptyWallet["returnValue"]>

Generates an Empty Wallet

Parameters

NameType
config?Partial<Pick<LearnCardConfig, "didkit">>

Returns

Promise<EmptyWallet["returnValue"]>

Defined in

learn-card-core/src/wallet/init.ts:18

initLearnCard(config): Promise<WalletFromKey["returnValue"]>

Generates a full wallet from a 32 byte seed

Parameters

NameType
config{ seed: string } & Partial<Pick<LearnCardConfig, keyof LearnCardConfig>>

Returns

Promise<WalletFromKey["returnValue"]>

Defined in

learn-card-core/src/wallet/init.ts:25

initLearnCard(config): Promise<WalletFromVcApi["returnValue"]>

Generates a wallet that can sign VCs/VPs from a VC API

Parameters

NameType
config{ did?: string ; vcApi: string | true } & Partial<Pick<LearnCardConfig, "defaultContents">>

Returns

Promise<WalletFromVcApi["returnValue"]>

Defined in

learn-card-core/src/wallet/init.ts:32


walletFromApiUrl

walletFromApiUrl(url, did?, __namedParameters?): Promise<VCAPILearnCard>

Generates a LearnCard Wallet from a 64 character seed string

Parameters

NameType
urlstring
did?string
__namedParametersPartial<LearnCardConfig>

Returns

Promise<VCAPILearnCard>

Defined in

learn-card-core/src/wallet/initializers/apiWallet.ts:15


walletFromKey

walletFromKey(key, __namedParameters?): Promise<LearnCard<keyof AllLearnCardMethods, LearnCardRawWallet>>

Generates a LearnCard Wallet from a 64 character seed string

Parameters

NameType
keystring
__namedParametersPartial<LearnCardConfig>

Returns

Promise<LearnCard<keyof AllLearnCardMethods, LearnCardRawWallet>>

Defined in

learn-card-core/src/wallet/initializers/walletFromKey.ts:22

Ethereum Plugin

EthereumConfig

Ƭ EthereumConfig: Object

Type declaration

NameType
infuraProjectId?string
network?providers.Networkish

Defined in

learn-card-core/src/wallet/plugins/EthereumPlugin/types.ts:19


EthereumPluginMethods

Ƭ EthereumPluginMethods: Object

Type declaration

NameType
addInfuraProjectId(infuraProjectIdToAdd: string) => void
changeNetwork(network: providers.Networkish) => void
getBalance(symbolOrAddress?: string) => Promise<string>
getBalanceForAddress(walletAddress: string, symbolOrAddress?: string) => Promise<string>
getCurrentNetwork() => providers.Networkish
getEthereumAddress() => string
transferTokens(tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>

Defined in

learn-card-core/src/wallet/plugins/EthereumPlugin/types.ts:4


Token

Ƭ Token: Object

Type declaration

NameType
addressstring
chainIdnumber
decimalsnumber
extensionsany
logoURIstring
namestring
symbolstring

Defined in

learn-card-core/src/wallet/plugins/EthereumPlugin/types.ts:25


TokenList

Ƭ TokenList: Token[]

Defined in

learn-card-core/src/wallet/plugins/EthereumPlugin/types.ts:36

Universal Wallets

LearnCardRawWallet

Ƭ LearnCardRawWallet: Wallet<"DIDKit" | "DID Key" | "VC" | "VC Templates" | "VC Resolution" | "IDX" | "Expiration" | "Ethereum" | "Vpqr" | "CHAPI", MergeObjects<[DidKeyPluginMethods<DidMethod>, VCPluginMethods, VCTemplatePluginMethods, VCResolutionPluginMethods, IDXPluginMethods, EthereumPluginMethods, VpqrPluginMethods, CHAPIPluginMethods]>>

Defined in

learn-card-core/src/types/LearnCard.ts:28


Plugin

Ƭ Plugin<Name, PublicMethods, DependentMethods>: Object

Type parameters

NameType
Nameextends string
PublicMethodsextends Record<string, (...args: any[]) => any> = Record<never, never>
DependentMethodsextends Record<string, (...args: any[]) => any> = Record<never, never>

Type declaration

NameType
name?Name
pluginMethods{ [Key in keyof PublicMethods]: Function }

Defined in

learn-card-core/src/types/wallet.ts:4


Wallet

Ƭ Wallet<PluginNames, PluginMethods>: PublicFieldsObj<PluginMethods> & { add: (content: any) => Promise<Wallet<PluginNames, PluginMethods>> ; addPlugin: <Name, Methods>(plugin: Plugin<Name, Methods>) => Promise<Wallet<"" extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : MergeObjects<[PluginMethods, Methods]>>> ; contents: any[] ; plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[] ; remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>> }

Type parameters

NameType
PluginNamesextends string = ""
PluginMethodsextends Record<string, (...args: any[]) => any> = Record<never, never>

Defined in

learn-card-core/src/types/wallet.ts:26


generateWallet

generateWallet<PluginNames, PluginMethods>(contents?, _wallet?): Promise<Wallet<PluginNames, PluginMethods>>

Type parameters

NameType
PluginNamesextends string
PluginMethodsextends Record<string, (...args: any[]) => any> = Record<never, never>

Parameters

NameTypeDefault value
contentsany[][]
_walletPartial<Wallet<any, PluginMethods>>{}

Returns

Promise<Wallet<PluginNames, PluginMethods>>

Defined in

learn-card-core/src/wallet/base/wallet.ts:66

Utility Types

MergeObjects

Ƭ MergeObjects<Objects>: undefined extends Objects[2] ? Omit<Objects[0], keyof Objects[1]> & Objects[1] : Omit<MergeObjects<RemoveLast<Objects>>, keyof Last<Objects>> & Last<Objects>

Type parameters

NameType
Objectsextends Record<string, any>[]

Defined in

learn-card-core/src/types/utilities.ts:12

VC Plugin

VCImplicitWallet

Ƭ VCImplicitWallet: Wallet<string, VCPluginMethods & VCPluginDependentMethods>

Defined in

learn-card-core/src/wallet/plugins/vc/types.ts:43


VCPluginDependentMethods

Ƭ VCPluginDependentMethods: Object

Type declaration

NameType
getSubjectDid(type: "key") => string
getSubjectKeypair() => JWK
issueCredential(credential: UnsignedVC, options: ProofOptions, keypair: JWK) => Promise<VC>
issuePresentation(presentation: UnsignedVP, options: ProofOptions, keypair: JWK) => Promise<VP>
keyToVerificationMethod(type: string, keypair: JWK) => Promise<string>
verifyCredential(credential: VC, options?: ProofOptions) => Promise<VerificationCheck>
verifyPresentation(presentation: VP, options?: ProofOptions) => Promise<VerificationCheck>

Defined in

learn-card-core/src/wallet/plugins/vc/types.ts:6


VCPluginMethods

Ƭ VCPluginMethods: Object

Type declaration

NameType
getTestVc(subject?: string) => UnsignedVC
getTestVp(credential?: VC) => Promise<UnsignedVP>
issueCredential(credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>
issuePresentation(credential: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<VP>
verifyCredential(credential: VC, options?: Partial<ProofOptions>) => Promise<VerificationCheck>
verifyPresentation(presentation: VP, options?: Partial<ProofOptions>) => Promise<VerificationCheck>

Defined in

learn-card-core/src/wallet/plugins/vc/types.ts:21


VerifyExtension

Ƭ VerifyExtension: Object

Type declaration

NameType
verifyCredential(credential: VC) => Promise<VerificationCheck>

Defined in

learn-card-core/src/wallet/plugins/vc/types.ts:46

VPQR Plugin

VpqrPluginDependentMethods

Ƭ VpqrPluginDependentMethods: Object

Type declaration

NameType
contextLoader(url: string) => Promise<Record<string, any>>

Defined in

learn-card-core/src/wallet/plugins/vpqr/types.ts:10


VpqrPluginMethods

Ƭ VpqrPluginMethods: Object

Type declaration

NameType
vpFromQrCode(text: string) => Promise<VP>
vpToQrCode(vp: VP) => Promise<string>

Defined in

learn-card-core/src/wallet/plugins/vpqr/types.ts:4

Plugins

ExpirationPlugin

ExpirationPlugin(wallet): Plugin<"Expiration", VerifyExtension, Record<never, never>>

Parameters

NameType
walletWallet<any, VerifyExtension>

Returns

Plugin<"Expiration", VerifyExtension, Record<never, never>>

Defined in

learn-card-core/src/wallet/plugins/expiration/index.ts:7


getCHAPIPlugin

getCHAPIPlugin(): Promise<Plugin<"CHAPI", CHAPIPluginMethods, CHAPIPluginDependentMethods>>

Returns

Promise<Plugin<"CHAPI", CHAPIPluginMethods, CHAPIPluginDependentMethods>>

Defined in

learn-card-core/src/wallet/plugins/chapi/chapi.ts:10


getDidKeyPlugin

getDidKeyPlugin<DidMethod>(wallet, key): Promise<Plugin<"DID Key", DidKeyPluginMethods<DidMethod>, Record<never, never>>>

Type parameters

NameType
DidMethodextends string

Parameters

NameType
walletWallet<string, DependentMethods<DidMethod>>
keystring

Returns

Promise<Plugin<"DID Key", DidKeyPluginMethods<DidMethod>, Record<never, never>>>

Defined in

learn-card-core/src/wallet/plugins/didkey/index.ts:16


getDidKitPlugin

getDidKitPlugin(input?): Promise<Plugin<"DIDKit", DidkitPluginMethods, Record<never, never>>>

Parameters

NameType
input?InitInput | Promise<InitInput>

Returns

Promise<Plugin<"DIDKit", DidkitPluginMethods, Record<never, never>>>

Defined in

learn-card-core/src/wallet/plugins/didkit/index.ts:24


getEthereumPlugin

getEthereumPlugin(initWallet, config): Plugin<"Ethereum", EthereumPluginMethods, Record<never, never>>

Parameters

NameType
initWalletWallet<string, { getSubjectDid: (type: DidMethod) => string ; getSubjectKeypair: (type?: Algorithm) => { crv: string ; d: string ; kty: string ; x: string ; y?: string } }>
configEthereumConfig

Returns

Plugin<"Ethereum", EthereumPluginMethods, Record<never, never>>

Defined in

learn-card-core/src/wallet/plugins/EthereumPlugin/index.ts:27


getIDXPlugin

getIDXPlugin<URI>(wallet, __namedParameters): Promise<Plugin<"IDX", IDXPluginMethods<URI>, Record<never, never>>>

Type parameters

NameType
URIextends string = ""

Parameters

NameType
walletWallet<any, IDXPluginDependentMethods<URI>>
__namedParametersCeramicIDXArgs

Returns

Promise<Plugin<"IDX", IDXPluginMethods<URI>, Record<never, never>>>

Defined in

learn-card-core/src/wallet/plugins/idx/idx.ts:51


getVCPlugin

getVCPlugin(wallet): Plugin<"VC", VCPluginMethods, VCPluginDependentMethods>

Parameters

NameType
walletWallet<string, VCPluginDependentMethods>

Returns

Plugin<"VC", VCPluginMethods, VCPluginDependentMethods>

Defined in

learn-card-core/src/wallet/plugins/vc/vc.ts:12


getVpqrPlugin

getVpqrPlugin(wallet): Plugin<"Vpqr", VpqrPluginMethods, Record<never, never>>

Parameters

NameType
walletWallet<string, VpqrPluginDependentMethods>

Returns

Plugin<"Vpqr", VpqrPluginMethods, Record<never, never>>

Defined in

learn-card-core/src/wallet/plugins/vpqr/index.ts:11