Skip to content

Commit

Permalink
Fixed couple comments
Browse files Browse the repository at this point in the history
Signed-off-by: artem.ivanov <[email protected]>
  • Loading branch information
Artemkaaas committed Jan 15, 2024
1 parent 9e6875d commit f0c2901
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ export class NodeJSAnoncreds implements Anoncreds {
credentialDefinitionPrivate,
credentialOffer,
credentialRequest,
attributeNames as unknown as Buffer,
attributeRawValues as unknown as Buffer,
attributeNames,
attributeRawValues,
attributeEncodedValues as unknown as Buffer,
revocationConfiguration?.ref().address() ?? 0,
credentialPtr
Expand Down Expand Up @@ -296,15 +296,15 @@ export class NodeJSAnoncreds implements Anoncreds {

this.nativeAnoncreds.anoncreds_create_presentation(
presentationRequest,
credentialEntryList as unknown as Buffer,
credentialProveList as unknown as Buffer,
credentialEntryList,
credentialProveList,
selfAttestNames as unknown as Buffer,
selfAttestValues as unknown as Buffer,
linkSecret,
schemas as unknown as Buffer,
schemaIds as unknown as Buffer,
credentialDefinitions as unknown as Buffer,
credentialDefinitionIds as unknown as Buffer,
schemas,
schemaIds,
credentialDefinitions,
credentialDefinitionIds,
ret
)
this.handleError()
Expand Down Expand Up @@ -350,7 +350,7 @@ export class NodeJSAnoncreds implements Anoncreds {
revocationRegistryDefinitions,
revocationRegistryDefinitionIds,
revocationStatusLists,
nonRevokedIntervalOverrideList as unknown as Buffer,
nonRevokedIntervalOverrideList,
ret
)
this.handleError()
Expand Down Expand Up @@ -540,8 +540,8 @@ export class NodeJSAnoncreds implements Anoncreds {
credentialDefinitionPrivate,
credentialOffer,
credentialRequest,
attributeNames as unknown as Buffer,
attributeRawValues as unknown as Buffer,
attributeNames,
attributeRawValues,
revocationConfiguration?.ref().address() ?? 0,
w3cVersion,
credentialPtr
Expand Down Expand Up @@ -595,13 +595,13 @@ export class NodeJSAnoncreds implements Anoncreds {

this.nativeAnoncreds.anoncreds_create_w3c_presentation(
presentationRequest,
credentialEntryList as unknown as Buffer,
credentialProveList as unknown as Buffer,
credentialEntryList,
credentialProveList,
linkSecret,
schemas as unknown as Buffer,
schemaIds as unknown as Buffer,
credentialDefinitions as unknown as Buffer,
credentialDefinitionIds as unknown as Buffer,
schemas,
schemaIds,
credentialDefinitions,
credentialDefinitionIds,
w3cVersion,
ret
)
Expand Down Expand Up @@ -648,7 +648,7 @@ export class NodeJSAnoncreds implements Anoncreds {
revocationRegistryDefinitions,
revocationRegistryDefinitionIds,
revocationStatusLists,
nonRevokedIntervalOverrideList as unknown as Buffer,
nonRevokedIntervalOverrideList,
ret
)
this.handleError()
Expand Down Expand Up @@ -850,7 +850,7 @@ export class NodeJSAnoncreds implements Anoncreds {
rev_state: number
}>
>
})
}) as unknown as Buffer
}

private convertCredentialProves(credentialsProve: NativeCredentialProve[]) {
Expand All @@ -869,21 +869,21 @@ export class NodeJSAnoncreds implements Anoncreds {
reveal: number
}>
>
})
}) as unknown as Buffer
}

private convertSchemas(schemas: Record<string, ObjectHandle>) {
const schemaKeys = Object.keys(schemas)
const schemaIds = StringListStruct({
count: schemaKeys.length,
data: schemaKeys as unknown as TypedArray<string>
})
}) as unknown as Buffer

const schemaValues = Object.values(schemas)
const schemasList = ObjectHandleListStruct({
count: schemaValues.length,
data: ObjectHandleArray(schemaValues.map((o) => o.handle))
})
}) as unknown as Buffer
return {
schemaIds,
schemas: schemasList
Expand All @@ -895,13 +895,13 @@ export class NodeJSAnoncreds implements Anoncreds {
const credentialDefinitionIds = StringListStruct({
count: credentialDefinitionKeys.length,
data: credentialDefinitionKeys as unknown as TypedArray<string>
})
}) as unknown as Buffer

const credentialDefinitionValues = Object.values(credentialDefinitions)
const credentialDefinitionsList = ObjectHandleListStruct({
count: credentialDefinitionValues.length,
data: ObjectHandleArray(credentialDefinitionValues.map((o) => o.handle))
})
}) as unknown as Buffer
return {
credentialDefinitionIds,
credentialDefinitions: credentialDefinitionsList
Expand All @@ -928,21 +928,21 @@ export class NodeJSAnoncreds implements Anoncreds {
override_rev_status_list_ts: number
}>
>
})
}) as unknown as Buffer
}

private convertAttributeNames(attributeRawValues: Record<string, string>) {
return StringListStruct({
count: Object.keys(attributeRawValues).length,
data: Object.keys(attributeRawValues) as unknown as TypedArray<string>
})
}) as unknown as Buffer
}

private convertAttributeRawValues(attributeRawValues: Record<string, string>) {
return StringListStruct({
count: Object.keys(attributeRawValues).length,
data: Object.values(attributeRawValues) as unknown as TypedArray<string>
})
}) as unknown as Buffer
}

private convertAttributeEncodedValues(attributeEncodedValues?: Record<string, string>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ export * from './RevocationRegistryDefinition'
export * from './RevocationRegistryDefinitionPrivate'
export * from './RevocationStatusList'
export * from './W3cCredential'
export * from './CredentialOffer'
export * from './W3cPresentation'
2 changes: 1 addition & 1 deletion wrappers/python/anoncreds/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def from_legacy(
return cred.to_w3c(cred_def, w3c_version)

def _get_proof_details(self) -> bindings.ObjectHandle:
if self._proof_details == None:
if self._proof_details is None:
self._proof_details = bindings.w3c_credential_get_integrity_proof_details(self.handle)
return self._proof_details

Expand Down

0 comments on commit f0c2901

Please sign in to comment.