IdCard (Common API)

Overview - Common API - Client API - Admin API - Runtime API

IdCard

Business Network Card. Encapsulates credentials and other information required to connect to a specific business network as a specific user.

Instances of this class can be created using IdCard.fromArchive or IdCard.fromDirectory, as well as the constructor.

Details

  • Module common

See also

Method Summary

Name Returns Description
constructor void Create the IdCard
fromArchive Promise Create an IdCard from a card archive
fromDirectory Promise Create an IdCard from a directory consisting of the content of an ID card
getBusinessNetworkName String Name of the business network to which the ID card applies
getConnectionProfile Object Connection profile for this card
getCredentials Object Credentials associated with this card, and which are used to connect to the associated business network
getDescription String Free text description of the card
getEnrollmentCredentials Object Enrollment credentials
getRoles String[] Special roles for which this ID can be used, which can include:
  • PeerAdmin
  • ChannelAdmin
  • Issuer
getUserName String Name of the user identity associated with the card
setCredentials void Credentials to associate with this card
toArchive Promise Generate a card archive representing this ID card
toDirectory Promise Save the content of an IdCard a directory

Method Details

new IdCard()

Create the IdCard.

See also

Parameters

Name Type Mandatory Description
metadata Object Yes metadata associated with the card.
connectionProfile Object Yes connection profile associated with the card.

getUserName

String getUserName( )

Name of the user identity associated with the card. This should be unique within the scope of a given business network and connection profile. This is a mandatory field.

Returns

String - Name of the user identity.

See also

Parameters

No parameters

getDescription

String getDescription( )

Free text description of the card.

Returns

String - card description.

See also

Parameters

No parameters

getBusinessNetworkName

String getBusinessNetworkName( )

Name of the business network to which the ID card applies. Generally this will be present but may be omitted for system cards.

Returns

String - business network name.

See also

Parameters

No parameters

getConnectionProfile

Object getConnectionProfile( )

Connection profile for this card. This is a mandatory field.

Returns

Object - connection profile.

See also

Parameters

No parameters

getCredentials

Object getCredentials( )

Credentials associated with this card, and which are used to connect to the associated business network.

For PKI-based authentication, the credentials are expected to be of the form: { certificate: String, privateKey: String }.

Returns

Object - credentials.

See also

Parameters

No parameters

setCredentials

_ setCredentials( Object credentials )_

Credentials to associate with this card.

For PKI-based authentication, the credentials are expected to be of the form: { certificate: String, privateKey: String }.

See also

Parameters

Name Type Mandatory Description
credentials Object Yes credentials.

getEnrollmentCredentials

Object getEnrollmentCredentials( )

Enrollment credentials. If there are no credentials associated with this card, these credentials are used to enroll with a business network and obtain certificates.

For an ID/secret enrollment scheme, the credentials are expected to be of the form: { secret: String }.

Returns

Object - enrollment credentials, or null if none exist.

See also

Parameters

No parameters

getRoles

String[] getRoles( )

Special roles for which this ID can be used, which can include:

  • PeerAdmin
  • ChannelAdmin
  • Issuer

Returns

String - roles.

See also

Parameters

No parameters

fromArchive

Promise fromArchive( String; ArrayBuffer; Uint8Array; Buffer; Blob; Promise zipdata )

Create an IdCard from a card archive.

Valid types for zipData are any of the types supported by JSZip.

Returns

Promise - Promise to the instantiated IdCard.

See also

Parameters

Name Type Mandatory Description
zipData String; ArrayBuffer; Uint8Array; Buffer; Blob; Promise Yes card archive data.

toArchive

Promise toArchive( [Object options] )

Generate a card archive representing this ID card.

The default value for the options.type parameter is arraybuffer. See JSZip documentation for other valid values.

Returns

Promise - Promise of the generated ZIP file; by default an ArrayBuffer.

See also

Parameters

Name Type Mandatory Description
options Object Yes JSZip generation options.

Sub-options

Name Type Mandatory Description
options.type String Yes type of the resulting ZIP file data.

fromDirectory

Promise fromDirectory( String carddirectory, [ fs] )

Create an IdCard from a directory consisting of the content of an ID card.

Returns

Promise - Promise that resolves to an IdCard.

See also

Parameters

Name Type Mandatory Description
cardDirectory String Yes directory containing card data.
fs Yes Node file system API implementation to use for reading card data. Defaults to the Node implementation.

toDirectory

Promise toDirectory( String carddirectory, [ fs] )

Save the content of an IdCard a directory.

Returns

Promise - Promise that resolves then the save is complete.

See also

Parameters

Name Type Mandatory Description
cardDirectory String Yes directory to save card data.
fs Yes Node file system API implementation to use for writing card data. Defaults to the Node implementation.

Inherited methods