@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
| Name | Type |
|---|---|
args | Object |
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
| Name | Type |
|---|---|
Metadata | extends Record<string, any> = Record<never, never> |
Parameters
| Name | Type |
|---|---|
credential | IDXCredential<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
| Name | Type |
|---|---|
infuraProjectIdToAdd | string |
Returns
void
Defined in
learn-card-core/src/types/methods.ts:260
AllLearnCardMethods
Ƭ AllLearnCardMethods: Object
Type declaration
| Name | Type |
|---|---|
activateChapiHandler | ActivateChapiHandler |
addCredential | AddCredential |
addInfuraProjectId | AddInfuraProjectId |
changeNetwork | ChangeNetwork |
did | Did |
getBalance | GetBalance |
getBalanceForAddress | GetBalanceForAddress |
getCredential | GetCredential |
getCredentials | GetCredentials |
getCredentialsList | GetCredentialsList |
getCurrentNetwork | GetCurrentNetwork |
getEthereumAddress | GetEthereumAddress |
getTestVc | GetTestVc |
getTestVp | GetTestVp |
installChapiHandler | InstallChapiHandler |
issueCredential | IssueCredential |
issuePresentation | IssuePresentation |
keypair | Keypair |
newCredential | NewCredential |
newPresentation | NewPresentation |
publishCredential | PublishCredential |
readFromCeramic | ReadFromCeramic |
receiveChapiEvent | ReceiveChapiEvent |
removeCredential | RemoveCredential |
resolveCredential | ResolveCredential |
resolveDid | ResolveDid |
storeCredentialViaChapiDidAuth | StoreCredentialViaChapiDidAuth |
storePresentationViaChapi | StorePresentationViaChapi |
transferTokens | TransferTokens |
verifyCredential | VerifyCredential |
verifyPresentation | VerifyPresentation |
vpFromQrCode | VpFromQrCode |
vpToQrCode | VpToQrCode |
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
| Name | Type |
|---|---|
network | ethers.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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
walletAddress | string |
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
| Name | Type |
|---|---|
title | string |
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
| Name | Type |
|---|---|
Metadata | extends 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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
credential | UnsignedVC |
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
| Name | Type |
|---|---|
presentation | UnsignedVP |
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
| Name | Type |
|---|---|
type? | Algorithm |
Returns
Object
| Name | Type |
|---|---|
crv | string |
d | string |
kty | string |
x | string |
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
| Name | Type |
|---|---|
credential | VC |
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
| Name | Type |
|---|---|
credential | VC |
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
| Name | Type |
|---|---|
streamId | string |
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
| Name | Type |
|---|---|
id | string |
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
did | string |
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
| Name | Type |
|---|---|
credential | UnsignedVC |
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
| Name | Type |
|---|---|
presentation | VP |
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
| Name | Type |
|---|---|
tokenSymbolOrAddress | string |
amount | number |
toAddress | string |
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
| Name | Type |
|---|---|
credential | VC |
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
| Name | Type |
|---|---|
presentation | VP |
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
| Name | Type |
|---|---|
text | string |
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
| Name | Type |
|---|---|
vp | VP |
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
| Name | Type |
|---|---|
T | extends string |
Type declaration
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
DidMethod | extends string |
Type declaration
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
Metadata | extends Record<string, any> = Record<never, never> |
Type declaration
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
Metadata | extends Record<string, any> = Record<never, never> |
Defined in
learn-card-core/src/wallet/plugins/idx/types.ts:64
CeramicIDXArgs
Ƭ CeramicIDXArgs: Object
Type declaration
| Name | Type |
|---|---|
ceramicEndpoint | string |
credentialAlias | string |
defaultContentFamily | string |
modelData | ModelAliases |
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
| Name | Type |
|---|---|
Metadata | extends Record<string, any> = Record<never, never> |
Type declaration
| Name | Type |
|---|---|
credentials | IDXCredential<Metadata>[] |
Defined in
learn-card-core/src/wallet/plugins/idx/types.ts:51
IDXPluginDependentMethods
Ƭ IDXPluginDependentMethods<URI>: { getKey: () => string } & ResolutionExtension<URI>
Type parameters
| Name | Type |
|---|---|
URI | extends 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
| Name | Type |
|---|---|
URI | extends 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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
args | Object |
args.credentialHandler | any |
args.credentialRequestOptions | any |
args.credentialRequestOrigin | string |
args.hintKey | string |
Returns
Type declaration
| Name | Type |
|---|---|
_credentialHandler | any |
credentialRequestOptions | any |
credentialRequestOrigin | string |
hintKey | string |
openWindow | (url: string) => Promise<any> |
respondWith | (handlerResponse: Promise<null | { data: any ; dataType: string }>) => void |
type | string |
Defined in
learn-card-core/src/wallet/plugins/chapi/types.ts:18
CredentialStoreEvent
Ƭ CredentialStoreEvent: Object
Call signature
• new CredentialStoreEvent(args): CredentialStoreEvent
Parameters
| Name | Type |
|---|---|
args | Object |
args.credential | WebCredential |
args.credentialHandler | any |
args.credentialRequestOrigin | string |
args.hintKey | string |
Returns
Type declaration
| Name | Type |
|---|---|
_credentialHandler | any |
credential | WebCredential |
credentialRequestOrigin | string |
hintKey | string |
openWindow | (url: string) => Promise<any> |
respondWith | (handlerResponse: Promise<null | { data: any ; dataType: string }>) => void |
type | string |
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
| Name | Type |
|---|---|
dataType | string |
data | Object |
data.@context | string[] |
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.recommendedHandlerOrigins | string[] |
Returns
Type declaration
| Name | Type |
|---|---|
data | VP |
dataType | string |
options | { recommendedHandlerOrigins: string[] } |
options.recommendedHandlerOrigins | string[] |
type | string |
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
Methods | extends keyof AllLearnCardMethods = keyof AllLearnCardMethods |
RawWallet | extends Wallet<any, any> = LearnCardRawWallet |
Defined in
learn-card-core/src/types/LearnCard.ts:56
LearnCardConfig
Ƭ LearnCardConfig: Object
Type declaration
| Name | Type |
|---|---|
ceramicIdx | CeramicIDXArgs |
defaultContents | any[] |
didkit | InitInput | Promise<InitInput> |
ethereumConfig | EthereumConfig |
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
| Name | Type |
|---|---|
__namedParameters | Partial<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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
url | string |
did? | string |
__namedParameters | Partial<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
| Name | Type |
|---|---|
key | string |
__namedParameters | Partial<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
| Name | Type |
|---|---|
infuraProjectId? | string |
network? | providers.Networkish |
Defined in
learn-card-core/src/wallet/plugins/EthereumPlugin/types.ts:19
EthereumPluginMethods
Ƭ EthereumPluginMethods: Object
Type declaration
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
address | string |
chainId | number |
decimals | number |
extensions | any |
logoURI | string |
name | string |
symbol | string |
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
| Name | Type |
|---|---|
Name | extends string |
PublicMethods | extends Record<string, (...args: any[]) => any> = Record<never, never> |
DependentMethods | extends Record<string, (...args: any[]) => any> = Record<never, never> |
Type declaration
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
PluginNames | extends string = "" |
PluginMethods | extends 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
| Name | Type |
|---|---|
PluginNames | extends string |
PluginMethods | extends Record<string, (...args: any[]) => any> = Record<never, never> |
Parameters
| Name | Type | Default value |
|---|---|---|
contents | any[] | [] |
_wallet | Partial<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
| Name | Type |
|---|---|
Objects | extends 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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
verifyCredential | (credential: VC) => Promise<VerificationCheck> |
Defined in
learn-card-core/src/wallet/plugins/vc/types.ts:46
VPQR Plugin
VpqrPluginDependentMethods
Ƭ VpqrPluginDependentMethods: Object
Type declaration
| Name | Type |
|---|---|
contextLoader | (url: string) => Promise<Record<string, any>> |
Defined in
learn-card-core/src/wallet/plugins/vpqr/types.ts:10
VpqrPluginMethods
Ƭ VpqrPluginMethods: Object
Type declaration
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
wallet | Wallet<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
| Name | Type |
|---|---|
DidMethod | extends string |
Parameters
| Name | Type |
|---|---|
wallet | Wallet<string, DependentMethods<DidMethod>> |
key | string |
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
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
initWallet | Wallet<string, { getSubjectDid: (type: DidMethod) => string ; getSubjectKeypair: (type?: Algorithm) => { crv: string ; d: string ; kty: string ; x: string ; y?: string } }> |
config | EthereumConfig |
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
| Name | Type |
|---|---|
URI | extends string = "" |
Parameters
| Name | Type |
|---|---|
wallet | Wallet<any, IDXPluginDependentMethods<URI>> |
__namedParameters | CeramicIDXArgs |
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
| Name | Type |
|---|---|
wallet | Wallet<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
| Name | Type |
|---|---|
wallet | Wallet<string, VpqrPluginDependentMethods> |
Returns
Plugin<"Vpqr", VpqrPluginMethods, Record<never, never>>