@@ -4,7 +4,7 @@ import type { CredentialRevocationConfig } from './CredentialRevocationConfig'
44import type { RevocationStatusList } from './RevocationStatusList'
55
66import { AnoncredsObject } from '../AnoncredsObject'
7- import { anoncreds } from '../register'
7+ import { NativeAnoncreds } from '../register'
88
99import { CredentialDefinition } from './CredentialDefinition'
1010import { CredentialDefinitionPrivate } from './CredentialDefinitionPrivate'
@@ -69,7 +69,7 @@ export class Credential extends AnoncredsObject {
6969 ? options . credentialRequest . handle
7070 : pushToArray ( CredentialRequest . fromJson ( options . credentialRequest ) . handle , objectHandles )
7171
72- credential = anoncreds . createCredential ( {
72+ credential = NativeAnoncreds . instance . createCredential ( {
7373 credentialDefinition,
7474 credentialDefinitionPrivate,
7575 credentialOffer,
@@ -87,7 +87,7 @@ export class Credential extends AnoncredsObject {
8787 }
8888
8989 public static fromJson ( json : JsonObject ) {
90- return new Credential ( anoncreds . credentialFromJson ( { json : JSON . stringify ( json ) } ) . handle )
90+ return new Credential ( NativeAnoncreds . instance . credentialFromJson ( { json : JSON . stringify ( json ) } ) . handle )
9191 }
9292
9393 public process ( options : ProcessCredentialOptions ) {
@@ -115,7 +115,7 @@ export class Credential extends AnoncredsObject {
115115 )
116116 : undefined
117117
118- credential = anoncreds . processCredential ( {
118+ credential = NativeAnoncreds . instance . processCredential ( {
119119 credential : this . handle ,
120120 credentialDefinition,
121121 credentialRequestMetadata,
@@ -134,25 +134,25 @@ export class Credential extends AnoncredsObject {
134134 return this
135135 }
136136 public get schemaId ( ) {
137- return anoncreds . credentialGetAttribute ( { objectHandle : this . handle , name : 'schema_id' } )
137+ return NativeAnoncreds . instance . credentialGetAttribute ( { objectHandle : this . handle , name : 'schema_id' } )
138138 }
139139
140140 public get credentialDefinitionId ( ) {
141- return anoncreds . credentialGetAttribute ( { objectHandle : this . handle , name : 'cred_def_id' } )
141+ return NativeAnoncreds . instance . credentialGetAttribute ( { objectHandle : this . handle , name : 'cred_def_id' } )
142142 }
143143
144144 public get revocationRegistryId ( ) {
145- return anoncreds . credentialGetAttribute ( { objectHandle : this . handle , name : 'rev_reg_id' } )
145+ return NativeAnoncreds . instance . credentialGetAttribute ( { objectHandle : this . handle , name : 'rev_reg_id' } )
146146 }
147147
148148 public get revocationRegistryIndex ( ) {
149- const index = anoncreds . credentialGetAttribute ( { objectHandle : this . handle , name : 'rev_reg_index' } )
149+ const index = NativeAnoncreds . instance . credentialGetAttribute ( { objectHandle : this . handle , name : 'rev_reg_index' } )
150150 return index ? Number ( index ) : undefined
151151 }
152152
153153 public toW3c ( options : CredentialToW3cOptions ) : W3cCredential {
154154 return new W3cCredential (
155- anoncreds . credentialToW3c ( {
155+ NativeAnoncreds . instance . credentialToW3c ( {
156156 objectHandle : this . handle ,
157157 issuerId : options . issuerId ,
158158 w3cVersion : options . w3cVersion ,
@@ -161,6 +161,8 @@ export class Credential extends AnoncredsObject {
161161 }
162162
163163 public static fromW3c ( options : CredentialFromW3cOptions ) {
164- return new Credential ( anoncreds . credentialFromW3c ( { objectHandle : options . credential . handle } ) . handle )
164+ return new Credential (
165+ NativeAnoncreds . instance . credentialFromW3c ( { objectHandle : options . credential . handle } ) . handle
166+ )
165167 }
166168}
0 commit comments