diff --git a/tests/anoncreds_demos.rs b/tests/anoncreds_demos.rs index 4ac6599a..a2ba50f2 100644 --- a/tests/anoncreds_demos.rs +++ b/tests/anoncreds_demos.rs @@ -3029,6 +3029,7 @@ fn anoncreds_demo_works_for_issue_w3c_credential_and_present_w3c_presentation() .expect("Error processing credential"); // Store W3C credential form in wallet + println!("w3c_credential {}", json!(w3c_credential).to_string()); prover_wallet.w3c_credentials.push(w3c_credential); // Create and Verify W3C presentation using W3C credential @@ -3074,6 +3075,7 @@ fn anoncreds_demo_works_for_issue_w3c_credential_and_present_w3c_presentation() &cred_defs, ) .expect("Error creating presentation"); + println!("presentation {}", json!(presentation).to_string()); // Verifier verifies presentation assert_eq!( diff --git a/wrappers/javascript/packages/anoncreds-nodejs/src/NodeJSAnoncreds.ts b/wrappers/javascript/packages/anoncreds-nodejs/src/NodeJSAnoncreds.ts index 0bf4bd01..a2725c11 100644 --- a/wrappers/javascript/packages/anoncreds-nodejs/src/NodeJSAnoncreds.ts +++ b/wrappers/javascript/packages/anoncreds-nodejs/src/NodeJSAnoncreds.ts @@ -687,7 +687,7 @@ export class NodeJSAnoncreds implements Anoncreds { revocationConfiguration?: NativeCredentialRevocationConfig encoding?: string }): ObjectHandle { - const { credentialDefinition, credentialDefinitionPrivate, credentialOffer, credentialRequest } = + const { credentialDefinition, credentialDefinitionPrivate, credentialOffer, credentialRequest, encoding } = serializeArguments(options) const attributeNames = StringListStruct({ @@ -722,7 +722,7 @@ export class NodeJSAnoncreds implements Anoncreds { attributeNames as unknown as Buffer, attributeRawValues as unknown as Buffer, revocationConfiguration?.ref().address() ?? 0, - options.encoding, + encoding, credentialPtr ) this.handleError() @@ -907,7 +907,7 @@ export class NodeJSAnoncreds implements Anoncreds { return Boolean(handleReturnPointer(ret)) } - public credentialToW3C(options: { objectHandle: ObjectHandle, credentialDefinition: ObjectHandle }): ObjectHandle { + public credentialToW3C(options: { objectHandle: ObjectHandle; credentialDefinition: ObjectHandle }): ObjectHandle { const { objectHandle, credentialDefinition } = serializeArguments(options) const ret = allocatePointer() @@ -943,6 +943,20 @@ export class NodeJSAnoncreds implements Anoncreds { return new ObjectHandle(handleReturnPointer(ret)) } + public w3cCredentialAddNonAnonCredsIntegrityProof(options: { + objectHandle: ObjectHandle + proof: string + }): ObjectHandle { + const { objectHandle, proof } = serializeArguments(options) + + const ret = allocatePointer() + + this.nativeAnoncreds.anoncreds_w3c_credential_add_non_anoncreds_integrity_proof(objectHandle, proof, ret) + this.handleError() + + return new ObjectHandle(handleReturnPointer(ret)) + } + public w3cCredentialSetId(options: { objectHandle: ObjectHandle; id: string }): ObjectHandle { const { objectHandle, id } = serializeArguments(options) diff --git a/wrappers/javascript/packages/anoncreds-react-native/src/NativeBindings.ts b/wrappers/javascript/packages/anoncreds-react-native/src/NativeBindings.ts index 4bdd5692..60344f5c 100644 --- a/wrappers/javascript/packages/anoncreds-react-native/src/NativeBindings.ts +++ b/wrappers/javascript/packages/anoncreds-react-native/src/NativeBindings.ts @@ -237,7 +237,7 @@ export type NativeBindings = { w3cCredentialAddType(options: { objectHandle: number; type_: string }): ReturnObject - credentialToW3C(options: { objectHandle: number, credentialDefinition: number }): ReturnObject + credentialToW3C(options: { objectHandle: number; credentialDefinition: number }): ReturnObject credentialFromW3C(options: { objectHandle: number }): ReturnObject diff --git a/wrappers/javascript/packages/anoncreds-react-native/src/ReactNativeAnoncreds.ts b/wrappers/javascript/packages/anoncreds-react-native/src/ReactNativeAnoncreds.ts index 03204b61..8d55cf44 100644 --- a/wrappers/javascript/packages/anoncreds-react-native/src/ReactNativeAnoncreds.ts +++ b/wrappers/javascript/packages/anoncreds-react-native/src/ReactNativeAnoncreds.ts @@ -571,7 +571,7 @@ export class ReactNativeAnoncreds implements Anoncreds { return new ObjectHandle(handle) } - public credentialToW3C(options: { objectHandle: ObjectHandle, credentialDefinition: ObjectHandle }): ObjectHandle { + public credentialToW3C(options: { objectHandle: ObjectHandle; credentialDefinition: ObjectHandle }): ObjectHandle { const handle = this.handleError(this.anoncreds.credentialToW3C(serializeArguments(options))) return new ObjectHandle(handle) } diff --git a/wrappers/javascript/packages/anoncreds-shared/src/Anoncreds.ts b/wrappers/javascript/packages/anoncreds-shared/src/Anoncreds.ts index b83d2269..a8debf1b 100644 --- a/wrappers/javascript/packages/anoncreds-shared/src/Anoncreds.ts +++ b/wrappers/javascript/packages/anoncreds-shared/src/Anoncreds.ts @@ -280,7 +280,7 @@ export type Anoncreds = { w3cCredentialFromJson(options: { json: string }): ObjectHandle - credentialToW3C(options: { objectHandle: ObjectHandle, credentialDefinition: ObjectHandle }): ObjectHandle + credentialToW3C(options: { objectHandle: ObjectHandle; credentialDefinition: ObjectHandle }): ObjectHandle credentialFromW3C(options: { objectHandle: ObjectHandle }): ObjectHandle } diff --git a/wrappers/javascript/packages/anoncreds-shared/src/api/Credential.ts b/wrappers/javascript/packages/anoncreds-shared/src/api/Credential.ts index dee4f390..d118fc70 100644 --- a/wrappers/javascript/packages/anoncreds-shared/src/api/Credential.ts +++ b/wrappers/javascript/packages/anoncreds-shared/src/api/Credential.ts @@ -151,17 +151,17 @@ export class Credential extends AnoncredsObject { // Objects created within this method must be freed up const objectHandles: ObjectHandle[] = [] try { - const credentialDefinition = - options.credentialDefinition instanceof CredentialDefinition - ? options.credentialDefinition.handle - : pushToArray(CredentialDefinition.fromJson(options.credentialDefinition).handle, objectHandles) - - credential = new W3CCredential( - anoncreds.credentialToW3C({ - objectHandle: this.handle, - credentialDefinition, - }).handle - ) + const credentialDefinition = + options.credentialDefinition instanceof CredentialDefinition + ? options.credentialDefinition.handle + : pushToArray(CredentialDefinition.fromJson(options.credentialDefinition).handle, objectHandles) + + credential = new W3CCredential( + anoncreds.credentialToW3C({ + objectHandle: this.handle, + credentialDefinition + }).handle + ) } finally { objectHandles.forEach((handle) => { handle.clear() diff --git a/wrappers/javascript/packages/anoncreds-shared/src/api/W3CCredential.ts b/wrappers/javascript/packages/anoncreds-shared/src/api/W3CCredential.ts index ab35df15..bd974bae 100644 --- a/wrappers/javascript/packages/anoncreds-shared/src/api/W3CCredential.ts +++ b/wrappers/javascript/packages/anoncreds-shared/src/api/W3CCredential.ts @@ -160,17 +160,17 @@ export class W3CCredential extends AnoncredsObject { // Objects created within this method must be freed up const objectHandles: ObjectHandle[] = [] try { - const credentialDefinition = - options.credentialDefinition instanceof CredentialDefinition - ? options.credentialDefinition.handle - : pushToArray(CredentialDefinition.fromJson(options.credentialDefinition).handle, objectHandles) - - credential = new W3CCredential( - anoncreds.credentialToW3C({ - objectHandle: options.credential.handle, - credentialDefinition, - }).handle - ) + const credentialDefinition = + options.credentialDefinition instanceof CredentialDefinition + ? options.credentialDefinition.handle + : pushToArray(CredentialDefinition.fromJson(options.credentialDefinition).handle, objectHandles) + + credential = new W3CCredential( + anoncreds.credentialToW3C({ + objectHandle: options.credential.handle, + credentialDefinition + }).handle + ) } finally { objectHandles.forEach((handle) => { handle.clear()