Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue where attributes and predicates match #640

Merged

Conversation

Annelein
Copy link
Contributor

Solves #582

@Annelein Annelein requested a review from a team as a code owner February 15, 2022 15:02
@Annelein Annelein changed the title Fix: issue where attributes and predicates match fix: issue where attributes and predicates match Feb 15, 2022

public assertAttributeNamesDoNotMatch(proofRequest: ProofRequest) {
const attributes = Array.from(proofRequest.requestedAttributes.values()).map((a) => a.name)
const duplicates = attributes.filter((item, index) => attributes.indexOf(item) != index)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I don't see it but it looks like you are comparing each items index with its own index.

Couldn't you create a Set of the array and compare those lengths?

e.g.

const attributes = Array.from(proofRequest.requestedAttributes.values()).map((a) => a.name)
const uniqueAttributes = new Set(attributes)
// Ignore the bad naming
const areAttributesTrulyUnique = attributes.length === uniqueAttributes.size

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see now how it is supposed to be. indexOf returns the first index and if it occured a second time those indices will not be the same.

Ignore my comment :).

@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2022

Codecov Report

Merging #640 (e50b32e) into main (8386506) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #640      +/-   ##
==========================================
- Coverage   85.66%   85.61%   -0.06%     
==========================================
  Files         337      339       +2     
  Lines        7271     7290      +19     
  Branches     1138     1139       +1     
==========================================
+ Hits         6229     6241      +12     
- Misses       1041     1048       +7     
  Partials        1        1              
Impacted Files Coverage Δ
...s/core/src/modules/proofs/services/ProofService.ts 84.16% <100.00%> (-1.72%) ⬇️
packages/core/src/utils/assertNoDuplicates.ts 100.00% <100.00%> (ø)
packages/core/src/utils/index.ts 100.00% <100.00%> (ø)
packages/core/src/utils/indyProofRequest.ts 100.00% <100.00%> (ø)
packages/core/src/storage/IndyStorageService.ts 89.32% <0.00%> (-0.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8386506...e50b32e. Read the comment docs.

const duplicates = attributes.filter((item, index) => attributes.indexOf(item) != index)

if (duplicates.length > 0) {
throw new AriesFrameworkError(`The proof request contains a duplicate attribute name: ${duplicates}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully soon we will add some stricter typing. But arrays will not be allowed anymore in template literals. Could you replace ${duplicates} to ${duplicates.toString()} at all occurrences?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

},
})

return { secCredDefId: definition.id }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally do not abbriviate variables

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually took this from the function above
https://github.com/hyperledger/aries-framework-javascript/pull/640/files/da58c95310b499ea2ae3a4b84c6d728fb916e487#diff-ea192c0081e4b56d18cea33ca16a6b4d7cb2ccc5b4b23c183ba511843e30b60bL659

should I change it to return just the definition.id and take a string as a return type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that is even better.

}),
}

await expect(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think expect has to be async. I think the function called inside the expect has to be marked void though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimoGlastra you told me some times tests fail because the expect is not awaited, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I just looked at the jest docs and this is definitely how we are supposed to do it. We did not mark this like this in some other tests. Will fix that in a different PR.

Copy link
Contributor

@TimoGlastra TimoGlastra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, great addition @Annelein. some suggestions on tests and the checks

packages/core/src/modules/proofs/services/ProofService.ts Outdated Show resolved Hide resolved
Comment on lines 377 to 379
this.assertAttributePredicateGroupNamesDoNotMatch(proofRequest)
this.assertAttributeNamesDoNotMatch(proofRequest)
this.assertAttributePredicateNamesDoNotMatch(proofRequest)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it now assertAttributeNamesDoNotMatch asserts the names in the attributes array do not match and assertAttributePredicateNamesDoNotMatch asserts there's no overlap between predicates and attributes. Should we also add a check for the predicate names?

Maybe we can combine them into one method that combines all names between attributes and predicates and checks for overlap (maybe through the set length as @blu3beri suggested)?

Copy link
Contributor

@berendsliedrecht berendsliedrecht Feb 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one method would suffice for all three checks (although it might feel bit hacky)

const assertDuplicatesInArray = (arr: string[]): void => {
  const arrayLength = arr.length
  const uniqueArrayLength = new Set(arr).size

  // Minor optimalization
  if(arrayLength === uniquearrayLength) return;

  const duplicates = arr.filter((item, index) => arr.indexOf(item) != index)
  throw new AriesFrameworkError(`The proof request contains duplicate items: ${duplicates.toString()}`)
}

// And call like so

// replicate assertAttributeNamesDoNotMatch()
 const attributes = Array.from(proofRequest.requestedAttributes.values()).map((a) => a.name)
assertDuplicatesInArray(attributes)

// replicate assertPredicateNamesDoNotMatch()
const predicates = Array.from(proofRequest.requestedPredicates.values()).map((a) => a.name)
assertDuplicatesInArray(predicates)

// replicate assertAttributePredicateNamesDoNotMatch()
assertDuplicatesInArray(attributes.concat(predicates))

The function could also take a proofRequest and get the arrays from there, I have no preference really.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! Will implement it.
One question: if(arrayLength === uniquearrayLength) return; on this line you say that if the arrays are evenly long, it is fine, but there could still be a duplicate right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you create a Set in Javascript from an array it will remove all the duplicates instances of items. like so

const arr = [1,2,3,4,4,4,4];
const setOfArray = new Set(arr);

console.log(setOfArray);
// output: Set(1,2,3,4);

So if the array has a length of lets say 5 and the Set aswell it is safe to assume that there are no duplicates removed when creating the set.

faberConnection: ConnectionRecord
): Promise<string> {
const { definition } = await prepareForIssuance(faberAgent, ['name', 'age'])
const secCredDefId = definition.id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You use secCredDefId here, but return definition.id. Maybe use definition.id everywhere?

@@ -14,13 +14,14 @@ import {
RequestPresentationMessage,
} from '../src'

import { setupProofsTest, waitForProofRecord } from './helpers'
import { setupProofsTest, setupSecondCredential, waitForProofRecord } from './helpers'
import testLogger from './logger'

describe('Present Proof', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only tests the createRequest method. I think the e2e test were useful to check where indy throws error, but it might be easier to create unit tests for the specific service methods like you did with the credential service.


import { attributesToArray, predicatesToArray } from './toArray'

export function checkProofRequestForDuplicates(proofRequest: ProofRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is a nice function to have but it is very ProofService specific. I think the function below fits here quite well, but the one, attributesToArray and predicatedToArray are, and only will be, used by the proofService.

I do not think that it would be nice to keep them in the ProofService class, but maybe under packages/core/modules/proofs/utils/...

We can resolve this in a separate PR imo, but I just wanted to mention it. @TimoGlastra @jakubkoci how do you feel about having a utils folder for a module, leaving proof service specific utility functions here or moving them as private methods to the ProofService class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with proof specific utils in the proofs module 👍

However this is going to be moved to the indy proof format service soon, so should it then be in the proofs utils, or rather in the indy proof format service?


import { attributesToArray, predicatesToArray } from './toArray'

export function checkProofRequestForDuplicates(proofRequest: ProofRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with proof specific utils in the proofs module 👍

However this is going to be moved to the indy proof format service soon, so should it then be in the proofs utils, or rather in the indy proof format service?

Comment on lines 3 to 12
export function attributesToArray(proofRequest: ProofRequest) {
return Array.from(proofRequest.requestedAttributes.values()).reduce<string[]>(
(names, a) => [...names, ...(a.name ? [a.name] : a.names ? a.names : [])],
[]
)
}

export function predicatesToArray(proofRequest: ProofRequest) {
return Array.from(proofRequest.requestedPredicates.values()).map((a) => a.name)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also very proof request specific, so maybe we should host all the utils (assertDuplicates, toArray) in a util file called indyProofRequest.ts (either in the root util directory, or the proofs specific util directory)

assertDuplicatesInArray(attributes.concat(predicates))
}

export function assertDuplicatesInArray(arr: string[]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of this method makes me assume we want to assert there are duplicates in the array. While we want to make sure there are not duplicates in the array

Suggested change
export function assertDuplicatesInArray(arr: string[]) {
export function assertNoDuplicatesInArray(array: string[]) {

const predicates = predicatesToArray(proofRequest)
assertDuplicatesInArray(attributes)
assertDuplicatesInArray(predicates)
assertDuplicatesInArray(attributes.concat(predicates))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get away with only the last check. We check for any duplicates across the two arrays, making the first two checks redundant

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point.

import type { ProofRequest } from '@aries-framework/core'

export function attributesToArray(proofRequest: ProofRequest) {
return Array.from(proofRequest.requestedAttributes.values()).reduce<string[]>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return Array.from(proofRequest.requestedAttributes.values()).reduce<string[]>(
// Attributes can contain either a `name` string value or an `names` string array. We reduce it to a single array
// containing all attribute names from the requested attributes.
return Array.from(proofRequest.requestedAttributes.values()).reduce<string[]>(

@Annelein Annelein force-pushed the fix/attributes_predicates branch 2 times, most recently from 784cc9b to ed67c7e Compare February 28, 2022 10:55
@Annelein Annelein force-pushed the fix/attributes_predicates branch from 78399e9 to 3b0794a Compare February 28, 2022 12:23
Signed-off-by: annelein <[email protected]>
Copy link
Contributor

@TimoGlastra TimoGlastra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment on the tests, but implementation looks good!

).rejects.toThrowError(`The proof request contains duplicate items: age`)
})

test('attribute names match, same cred def filter', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are great! I think it would be good to move them to a util test in the utils tests directory. Then add tests to this file that makes sure the method is called where it should be (createRequest, etc...)

Annelein added 2 commits March 1, 2022 09:08
Signed-off-by: annelein <[email protected]>
Comment on lines 97 to 98
credDef = mockCredentialRecord({ state: CredentialState.OfferSent })
secCredDef = mockCredentialRecord({ state: CredentialState.OfferSent })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we're doing unit tests we can just create a random credential definition id (took this one from https://indyscan.io).

Also because the checkProofRequestForDuplicates method doesn't use the credential definition at all, we don't have to provide a second credential definition id. This should suffice (we also don't need the mockCredentialRecord etc... as the credential record is not used, we only need an id):

Suggested change
credDef = mockCredentialRecord({ state: CredentialState.OfferSent })
secCredDef = mockCredentialRecord({ state: CredentialState.OfferSent })
const credentialDefinitionId = '9vPXgSpQJPkJEALbLXueBp:3:CL:57753:tag1'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to test if it passes with an attribute and a predicate with different credential id's? or should I remove those tests then as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that could be useful, but this method doesn't test that. It never touches the credentialDefinitionId (note credentialDefinitionId is different from the credentialId. )

We should do an actual proof exchange to be able to test that (and should be done in proofs.test.ts)

@TimoGlastra TimoGlastra linked an issue Mar 1, 2022 that may be closed by this pull request
Signed-off-by: annelein <[email protected]>
describe('Present Proof', () => {
let credDefId: string

beforeAll(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not have to be async

credDefId = '9vPXgSpQJPkJEALbLXueBp:3:CL:57753:tag1'
})

test('attribute names match, same cred def filter', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not have to be async

expect(() => checkProofRequestForDuplicates(proofRequest)).toThrowError(AriesFrameworkError)
})

test('attribute names match with predicates name, same cred def filter', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not have to be async

}),
}

const nonce = 'testtesttest12345'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimoGlastra I created an issue for this, #646. Is this solution fine or do we need to expose the generateNonce function in a more accessible way?

)
}

export function predicatesToArray(proofRequest: ProofRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think predicateNamesToArray, and same for attributes, Is a better name.

Annelein added 2 commits March 1, 2022 17:17
Signed-off-by: annelein <[email protected]>
Signed-off-by: annelein <[email protected]>
@@ -664,3 +664,29 @@ export async function setupProofsTest(faberName: string, aliceName: string, auto
aliceReplay,
}
}

export async function setupSecondCredential(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still being used somewhere?

Signed-off-by: annelein <[email protected]>
Copy link
Contributor

@TimoGlastra TimoGlastra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TimoGlastra TimoGlastra merged commit 15a5e6b into openwallet-foundation:main Mar 3, 2022
@TimoGlastra TimoGlastra deleted the fix/attributes_predicates branch March 3, 2022 10:47
karimStekelenburg added a commit to animo/aries-framework-javascript that referenced this pull request May 19, 2022
fix(core): expose record metadata types (openwallet-foundation#556)

Signed-off-by: Berend Sliedrecht <[email protected]>
Co-authored-by: Timo Glastra <[email protected]>
ci: create non-annotated tags (openwallet-foundation#559)

Signed-off-by: Timo Glastra <[email protected]>
style: non-null assertions and newline import (openwallet-foundation#561)

Signed-off-by: Timo Glastra <[email protected]>
chore: disable unnecessary type check in Dispatcher test (openwallet-foundation#565)

Signed-off-by: Jakub Koci <[email protected]>
ci: add continuous deployment scripts (openwallet-foundation#552)

Signed-off-by: Timo Glastra <[email protected]>
feat: expose wallet API (openwallet-foundation#566)

This commit also contains the following changes:
* Create a master secret when creating a wallet.
* Do not delete wallet when shutdown is called on agent.
* Expose the whole wallet API, which also contains methods that should be used only inside the framework. We need to improve that in the future.

Signed-off-by: Jakub Koci <[email protected]>

BREAKING CHANGE: The agent’s `shutdown` method does not delete the wallet anymore. If you want to delete the wallet, you can do it via exposed wallet API.
build: add arm test ledger setup (openwallet-foundation#573)

Signed-off-by: Timo Glastra <[email protected]>
feat: add problem report protocol (openwallet-foundation#560)

Signed-off-by: Amit Padmani <[email protected]>
docs: added report problem protocol to README (openwallet-foundation#574)

Signed-off-by: Berend Sliedrecht <[email protected]>
fix: support mediation for connectionless exchange (openwallet-foundation#577)

Signed-off-by: Timo Glastra <[email protected]>
refactor(core): separate logic for inbound plaintext and encrypted message (openwallet-foundation#581)

* rename wire message to encrypted message

Signed-off-by: Jakub Koci <[email protected]>
feat: generic attachment handler (openwallet-foundation#578)

Signed-off-by: morrieinmaas <[email protected]>
Co-authored-by: annelein <[email protected]>
refactor: resolve feedback for problem report (openwallet-foundation#584)

Signed-off-by: Amit Padmani <[email protected]>
fix(core)!: Improved typing on metadata api (openwallet-foundation#585)

Signed-off-by: Berend Sliedrecht <[email protected]>

BREAKING CHANGE: removed the getAll() function.
chore(release): v0.1.0 (openwallet-foundation#571)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
docs(apple-silicon): update OpenSSL instructions (openwallet-foundation#590)

* docs(apple-silicon): update openssl install instructions

Signed-off-by: Karim Stekelenburg <[email protected]>

* docs(apple-silicon): add missing 'add to path' commands

Signed-off-by: Karim Stekelenburg <[email protected]>

* docs(apple-silicon): run prettier

Signed-off-by: Karim Stekelenburg <[email protected]>
feat(core): allow to set auto accept connetion exchange when accepting invitation (openwallet-foundation#589)

Signed-off-by: Jakub Koci <[email protected]>
feat: ledger connections happen on agent init in background (openwallet-foundation#580)

* Connects to ledger on agent init by default, ledger calls will wait for connections to be complete if so
* Updated version of indy-sdk-react-native to 0.1.16

Signed-off-by: Patrick Kenyon <[email protected]>
feat: add generic did resolver (openwallet-foundation#554)

* feat: did:key, did:web, did:sov resolver

Signed-off-by: Timo Glastra <[email protected]>
feat: add support for signed attachments (openwallet-foundation#595)

Signed-off-by: Timo Glastra <[email protected]>

BREAKING CHANGE: attachment method `getDataAsJson` is now located one level up. So instead of `attachment.data.getDataAsJson()` you should now call `attachment.getDataAsJson()`
build(deps): bump shelljs from 0.8.4 to 0.8.5 (openwallet-foundation#598)

Signed-off-by: dependabot[bot] <[email protected]>
feat: add didcomm message record (openwallet-foundation#593)

Signed-off-by: Timo Glastra <[email protected]>
fix: disallow usage of global buffer (openwallet-foundation#601)

fix: verify jws contains at least 1 signature (openwallet-foundation#600)

feat(core): added timeOut to the module level (openwallet-foundation#603)

* fix(core): added timeOut to the module level

Signed-off-by: Berend Sliedrecht <[email protected]>
feat: add support for did:peer (openwallet-foundation#608)

Signed-off-by: Timo Glastra <[email protected]>
feat: support new did document in didcomm message exchange (openwallet-foundation#609)

* refactor: unify did document services
* feat: integrate did resolver with message sender
* feat: support new did docoument for msg receiver

Signed-off-by: Timo Glastra <[email protected]>
docs: proofs (openwallet-foundation#564)

Signed-off-by: Mostafa <[email protected]>
fix: incorrect encoding of services for did:peer (openwallet-foundation#610)

Signed-off-by: Timo Glastra <[email protected]>
ci: get last alpha package version from npm (openwallet-foundation#611)

We currently use the commit number, but this is incorrect as the number will be reset to 0 again when the next minor version is released.

Signed-off-by: Timo Glastra <[email protected]>
chore: regenerate yarn.lock for security updates (openwallet-foundation#616)

Signed-off-by: Timo Glastra <[email protected]>
ci: prepend v to alpha releases for consistency (openwallet-foundation#617)

Signed-off-by: Timo Glastra <[email protected]>
feat: add find and save/update methods to DidCommMessageRepository (openwallet-foundation#620)

Signed-off-by: NB-Karim <[email protected]>
feat: update recursive backoff & trust ping record updates (openwallet-foundation#631)

Signed-off-by: James Ebert <[email protected]>
fix: leading zeros in credential value encoding (openwallet-foundation#632)

Signed-off-by: James Ebert <[email protected]>
feat: indy revocation (prover & verifier) (openwallet-foundation#592)

* Added recepientRevocation for createProof

Signed-off-by: Patrick Kenyon <[email protected]>

* Initial revocation functions for getRequestedCredentialsForProofRequest

Signed-off-by: Patrick Kenyon <[email protected]>

* Added option to check for revocation status in getRequestedCredentials

Signed-off-by: Patrick Kenyon <[email protected]>

* sorted transports

Signed-off-by: Adam Burdett <[email protected]>

* broken message sender tests

Signed-off-by: Adam Burdett <[email protected]>

* structure fix

Signed-off-by: Adam Burdett <[email protected]>

* lint import ordering

Signed-off-by: Adam Burdett <[email protected]>

* if(0) does not work.

Signed-off-by: Adam Burdett <[email protected]>

* utf-8 decode ws event.data

Signed-off-by: Adam Burdett <[email protected]>

* indy wallet friendly bits

Signed-off-by: Adam Burdett <[email protected]>

* correct protocal type

Signed-off-by: Adam Burdett <[email protected]>

* check invite during init

Signed-off-by: Adam Burdett <[email protected]>

* id check

Signed-off-by: Adam Burdett <[email protected]>

* keep sockets with mediators open

Signed-off-by: Adam Burdett <[email protected]>

* recursive backoff

Signed-off-by: Adam Burdett <[email protected]>

* timeout

Signed-off-by: Adam Burdett <[email protected]>

* timeout time

Signed-off-by: Adam Burdett <[email protected]>

* logger

Signed-off-by: Adam Burdett <[email protected]>

* propper recursive backoff

Signed-off-by: Adam Burdett <[email protected]>

* multiple socket timeout support

Signed-off-by: Adam Burdett <[email protected]>

* Code cleanup

Signed-off-by: Patrick Kenyon <[email protected]>

* Fix tests and types

Signed-off-by: Patrick Kenyon <[email protected]>

* Formatting and type fixes

Signed-off-by: Patrick Kenyon <[email protected]>

* revocation fixes

Signed-off-by: Patrick Kenyon <[email protected]>

* ran prettier

Signed-off-by: Patrick Kenyon <[email protected]>

* chore: add ts ignore until types are updated

Signed-off-by: James Ebert <[email protected]>

* feat: updated tails download to utilize axios and added inline docs

Signed-off-by: James Ebert <[email protected]>

* chore: fixed formatting

Signed-off-by: James Ebert <[email protected]>

* chore: removed husky

Signed-off-by: James Ebert <[email protected]>

* fix: add back husky pre-push

Signed-off-by: James Ebert <[email protected]>

* chore: formatting

Signed-off-by: James Ebert <[email protected]>

* fix: fixed error imports

Signed-off-by: James Ebert <[email protected]>

* chore: resolve dependency loop issues

Signed-off-by: James Ebert <[email protected]>

* chore: formatting

Signed-off-by: James Ebert <[email protected]>

* feature: revocation ledger methods & proof get requested credentials revoked status

Signed-off-by: James Ebert <[email protected]>

* feature: added revocation state creation

Signed-off-by: James Ebert <[email protected]>

* fix: small tweaks and fixes for revocation

Signed-off-by: James Ebert <[email protected]>

* feature: takes into account referent revocation intervals

Signed-off-by: James Ebert <[email protected]>

* chore: cleanup & prettier

Signed-off-by: James Ebert <[email protected]>

* fix: fixed createrevocationstate types & initial rev reg def caching

Signed-off-by: James Ebert <[email protected]>

* chore: formatting

Signed-off-by: James Ebert <[email protected]>

* fix: fixed proofservice test mock

Signed-off-by: James Ebert <[email protected]>

* chore: minor cleanup

Signed-off-by: James Ebert <[email protected]>

* chore: rename indyutilitiesservice

Signed-off-by: James Ebert <[email protected]>

* chore: troubleshooting revocation, added ledger methods for verifying proof of non revocation

Signed-off-by: James Ebert <[email protected]>

* chore: cleanup & credential storage w/revocation

Signed-off-by: James Ebert <[email protected]>

* feat: add download to file method to file system

Signed-off-by: Timo Glastra <[email protected]>

* refactor: use rnfs for react native

Signed-off-by: Timo Glastra <[email protected]>

* chore: cleanup & log adjustments

Signed-off-by: James Ebert <[email protected]>

* chore: formatting

Signed-off-by: James Ebert <[email protected]>

* feat: verify proofs containing proof of non_revocation

Signed-off-by: James Ebert <[email protected]>

* chore: formatting

Signed-off-by: James Ebert <[email protected]>

* chore: update indy-sdk-react-native & indy-sdk types

Signed-off-by: James Ebert <[email protected]>

* chore: adjusts names to be consistent & removing abbreviations

Signed-off-by: James Ebert <[email protected]>

* chore: updated indy-sdk types to fix proof identifier types

Signed-off-by: James Ebert <[email protected]>

* fix: indyverifierservice prototype pollution

Signed-off-by: James Ebert <[email protected]>

Co-authored-by: Patrick Kenyon <[email protected]>
Co-authored-by: Adam Burdett <[email protected]>
Co-authored-by: Timo Glastra <[email protected]>
fix: check for "REQNACK" response from indy ledger (openwallet-foundation#626)

Signed-off-by: annelein <[email protected]>
fix: credential preview attributes mismatch schema attributes (openwallet-foundation#625)

Signed-off-by: annelein <[email protected]>
docs: add cli demo (openwallet-foundation#619)

Signed-off-by: annelein <[email protected]>
fix: check proof request group names do not overlap (openwallet-foundation#638)

Signed-off-by: annelein <[email protected]>
fix(core): error if unpacked message does not match JWE structure (openwallet-foundation#639)

Signed-off-by: annelein <[email protected]>
feat: filter retrieved credential by revocation state (openwallet-foundation#641)

Signed-off-by: Timo Glastra <[email protected]>
docs: cleanup demo (openwallet-foundation#645)

Signed-off-by: Berend Sliedrecht <[email protected]>
feat(crypto): add abstract KeyPair class

Signed-off-by: NB-Karim <[email protected]>

feat(crypto): move Key class to crypto directory

Signed-off-by: NB-Karim <[email protected]>

feat(crypto): move multiCodecKey to crypto folder

Signed-off-by: NB-Karim <[email protected]>

feat(crypto): add WalletKeyPair

Signed-off-by: NB-Karim <[email protected]>

style: fix formatting issues

Signed-off-by: NB-Karim <[email protected]>

feat: add wallet key derivation method option (openwallet-foundation#650)

Signed-off-by: Timo Glastra <[email protected]>
fix: issue where attributes and predicates match (openwallet-foundation#640)

Signed-off-by: annelein <[email protected]>
fix(basic-message): assert connection is ready (openwallet-foundation#657)

Signed-off-by: Karim <[email protected]>
test: minor wallet test changes (openwallet-foundation#660)

Signed-off-by: Niall Shaw <[email protected]>
feat: add wallet module with import export (openwallet-foundation#652)

Signed-off-by: Timo Glastra <[email protected]>
refactor(proofs): remove unused method from service (openwallet-foundation#663)

Signed-off-by: Timo Glastra <[email protected]>
fix: agent isinitialized on shutdown (openwallet-foundation#665)

Signed-off-by: Niall Shaw <[email protected]>
fix(routing): remove sentTime from request message (openwallet-foundation#670)

Signed-off-by: Timo Glastra <[email protected]>
feat: add w3c credential models

Signed-off-by: Karim <[email protected]>

feat: add mock W3cCredentialService

Signed-off-by: Karim <[email protected]>

feat: keyPair record

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: generic wallet interface for key types

Signed-off-by: Timo Glastra <[email protected]>

fix: renamed secretKey -> privateKey

Signed-off-by: Berend Sliedrecht <[email protected]>

fix: dependency cycles

Signed-off-by: Karim <[email protected]>

feat: KeyPairRepository

Signed-off-by: Berend Sliedrecht <[email protected]>

docs: improved tsdoc for repository

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: restructured wallet api

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: createKey switch

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: added switch to sign and verify

Signed-off-by: Berend Sliedrecht <[email protected]>

style: added tsdoc

Signed-off-by: Berend Sliedrecht <[email protected]>

fix: remove deprecated multibase and multihash (openwallet-foundation#674)

Signed-off-by: Timo Glastra <[email protected]>
feat(crypto): add abstract KeyPair class

Signed-off-by: NB-Karim <[email protected]>

feat(crypto): add WalletKeyPair

Signed-off-by: NB-Karim <[email protected]>

style: fix formatting issues

Signed-off-by: NB-Karim <[email protected]>

feat: add dependency .d.ts files

Signed-off-by: Karim <[email protected]>

feat: implemented create key in wallet

Signed-off-by: Berend Sliedrecht <[email protected]>

Merge branch 'main' into feat/next-signatures

feat: implemented sign and verify

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: implementation done, still need record retrieval

Signed-off-by: Berend Sliedrecht <[email protected]>

fix: casing

Signed-off-by: Berend Sliedrecht <[email protected]>

refactor: remove keypairrecord and keypairrepository

Signed-off-by: Berend Sliedrecht <[email protected]>

fix: merge

Merge branch 'feat/Ed25519Signature2018' of github.com:animo/aries-framework-javascript into feat/next-signatures

Merge branch 'feat/next-signatures' of github.com:animo/aries-framework-javascript into feat/next-signatures

feat: finished without test

Signed-off-by: Berend Sliedrecht <[email protected]>

fix(routing): mediation recipient role for recipient (openwallet-foundation#661)

Signed-off-by: Timo Glastra <[email protected]>
refactor(core): renamed BufferEncoder to TypedArrayEncoder (openwallet-foundation#675)

Signed-off-by: Berend Sliedrecht <[email protected]>
feat: add Ed25519Signature2018

Signed-off-by: Karim <[email protected]>

feat: finished WalletKeyPair implementation

Signed-off-by: Karim <[email protected]>

Merge branch 'main' into feat/W3cCredentialService

Merge branch 'main' into feat/next-signatures

Merge branch 'feat/next-signatures' into feat/W3cCredentialService

fix: do not use basic message id as record id (openwallet-foundation#677)

Signed-off-by: Timo Glastra <[email protected]>
docs: inline and dev docs added

Signed-off-by: Berend Sliedrecht <[email protected]>

Merge remote-tracking branch 'origin' into feat/bbs

fix: cleanup

Signed-off-by: Berend Sliedrecht <[email protected]>

fix: using typedarrayencoder now

Signed-off-by: Berend Sliedrecht <[email protected]>

tests: started on IndyWallet test

Signed-off-by: Berend Sliedrecht <[email protected]>

tests: test sign function

Signed-off-by: Berend Sliedrecht <[email protected]>

build(deps): bump minimist from 1.2.5 to 1.2.6 (openwallet-foundation#682)

feat: improved tests

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: check if array is typedarray

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: added react native setup

Signed-off-by: Berend Sliedrecht <[email protected]>

docs: updated diff syntax

Signed-off-by: Berend Sliedrecht <[email protected]>

build(deps): bump plist from 3.0.4 to 3.0.5 (openwallet-foundation#683)

feat(routing): allow to discover mediator pickup strategy (openwallet-foundation#669)

Signed-off-by: Timo Glastra <[email protected]>
tests: test isTypedArray

Signed-off-by: Berend Sliedrecht <[email protected]>

fix: resolved feedback

Signed-off-by: Berend Sliedrecht <[email protected]>

build: decremented core build version

Signed-off-by: Berend Sliedrecht <[email protected]>

fix: update inbound message validation  (openwallet-foundation#678)

Changed isPlaintextMessage error handling, and removed logic from isEncryptedMessage
Use isValidJweStructure

Signed-off-by: Niall Shaw <[email protected]>
feat: add sign method

Signed-off-by: Karim <[email protected]>

Merge branch 'main' into feat/W3cCredentialService

feat: added w3c record and repository

Signed-off-by: Berend Sliedrecht <[email protected]>

feat: working repository and record

Signed-off-by: Berend Sliedrecht <[email protected]>

Merge pull request #17 from blu3beri/feat/w3crecord

feat(core): w3cCredentialRecord and w3cCredentialRepository
fix(core): set tags in MediationRecord constructor (openwallet-foundation#686)

Signed-off-by: Ariel Gentile <[email protected]>
Merge branch 'main' into feat/W3cCredentialService

feat: implement verifyCredential

Signed-off-by: Karim <[email protected]>

feat: createPresentation

Signed-off-by: Karim <[email protected]>

feat: implemented SignatureSuiteRegistry

Signed-off-by: Karim <[email protected]>

feat: finish signPres and verifyPres

Signed-off-by: Karim <[email protected]>

refactor: clean-up directory structure

Signed-off-by: Karim <[email protected]>

feat: add BbsBlsSiganture2020 to sig-registry

Signed-off-by: Karim <[email protected]>

Merge branch 'main' into feat/bbs

Merge branch 'feat/bbs' into feat/jsonld-credentials

feat: implement sign for bbs

Signed-off-by: Karim <[email protected]>

refactor: clean-up W3cCredentialService options

Signed-off-by: Karim <[email protected]>

refactor: switched to mattr jsonld-signatures bbs

Signed-off-by: Karim <[email protected]>

feat: regex for schemaVersion, issuerDid, credDefId, schemaId, schemaIssuerDid (openwallet-foundation#679)

Signed-off-by: annelein <[email protected]>
feat: support wallet key rotation (openwallet-foundation#672)

Signed-off-by: Mostafa <[email protected]>
feat: add role and method to did record tags (openwallet-foundation#692)

Signed-off-by: Timo Glastra <[email protected]>
feat: delete credential from wallet (openwallet-foundation#691)

Signed-off-by: Jan <[email protected]>
feat: extension module creation (openwallet-foundation#688)

Signed-off-by: Ariel Gentile <[email protected]>
refactor: restructured fixtures and more

Signed-off-by: Karim <[email protected]>

Merge branch 'main' into feat/jsonld-credentials

fix: disallow floating promises (openwallet-foundation#704)

Signed-off-by: Timo Glastra <[email protected]>
feat: bbs verification

Signed-off-by: Karim <[email protected]>

Merge branch 'main' into feat/jsonld-credentials

refactor: start and stop transports in parallel (openwallet-foundation#705)

Signed-off-by: Timo Glastra <[email protected]>
ci: add yml for postgres setup (openwallet-foundation#703)

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
fix: did sov service type resolving (openwallet-foundation#689)

Signed-off-by: James Ebert <[email protected]>
test: add test assets

Signed-off-by: Karim <[email protected]>

test(vc): add caching documentLoader for tests

Signed-off-by: Karim <[email protected]>

build(deps): bump async from 2.6.3 to 2.6.4 (openwallet-foundation#710)

feat: add update assistant for storage migrations (openwallet-foundation#690)

Signed-off-by: Timo Glastra <[email protected]>
feat: support revocation notification messages (openwallet-foundation#579)

Signed-off-by: Patrick Kenyon <[email protected]>

Co-authored-by: James Ebert <[email protected]>
fix: disallow floating promises (openwallet-foundation#704)

Signed-off-by: Timo Glastra <[email protected]>
test: add test assets

Signed-off-by: Karim <[email protected]>

test(vc): add caching documentLoader for tests

Signed-off-by: Karim <[email protected]>

Merge branch 'karim/test' into feat/jsonld-credentials

refactor: start and stop transports in parallel (openwallet-foundation#705)

Signed-off-by: Timo Glastra <[email protected]>
ci: add yml for postgres setup (openwallet-foundation#703)

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
fix: did sov service type resolving (openwallet-foundation#689)

Signed-off-by: James Ebert <[email protected]>
build(deps): bump async from 2.6.3 to 2.6.4 (openwallet-foundation#710)

feat: add update assistant for storage migrations (openwallet-foundation#690)

Signed-off-by: Timo Glastra <[email protected]>

feat: support revocation notification messages (openwallet-foundation#579)

Signed-off-by: Patrick Kenyon <[email protected]>

Co-authored-by: James Ebert <[email protected]>
fix: yarn.lock conflict

Merge branch 'main' into feat/jsonld-credentials

refactor: replace message type constant with string literal (openwallet-foundation#721)

Signed-off-by: Jakub Koci <[email protected]>
test: add local did fixtures

feat: add credential fetch methods

Signed-off-by: Karim <[email protected]>

feat: add react native documentLoader

Signed-off-by: Karim <[email protected]>

style: fix styling issues (eslint, ts, etc.)

Signed-off-by: Karim <[email protected]>

Merge branch 'main' into feat/jsonld-credentials
fix: allow agent without inbound endpoint to connect when using multi-use invitation (openwallet-foundation#712)

Previously the session is only stored by the connection id, but this is not always enough for the session to be reused. When using a multi-use invitation the connection id will change while processing the message, meaning the session cannot be reused. This also helps with cases where no connection is established. Fixes openwallet-foundation#483

Signed-off-by: Timo Glastra <[email protected]>
fix: close session early if no return route (openwallet-foundation#715)

This adds a `close` method to all transport sessions so it can be closed from within the agent. This allows us to close the session early if the message doesn't have return routing enabled

Signed-off-by: Timo Glastra <[email protected]>
ci: add node 18 to test matrix (openwallet-foundation#735)

Signed-off-by: Timo Glastra <[email protected]>
feat: pickup v2 protocol (openwallet-foundation#711)

Signed-off-by: KolbyRKunz <[email protected]>

BREAKING CHANGE: The mediator pickup strategy enum value `MediatorPickupStrategy.Explicit` has been renamed to `MediatorPickupStrategy.PickUpV1` to better align with the naming of the new `MediatorPickupStrategy.PickUpV2`
Merge branch 'main' into feat/jsonld-credentials

fix: dropped unused dependency

Signed-off-by: Karim <[email protected]>

fix: error typo

Co-authored-by: Timo Glastra <[email protected]>
fix: simplify keyType declaration

Co-authored-by: Timo Glastra <[email protected]>
fix: optional fields in did document (openwallet-foundation#726)

Signed-off-by: Timo Glastra <[email protected]>
fix: dropped ed25519 ctx deps

Signed-off-by: Karim <[email protected]>

fix: removed unused type def

Signed-off-by: Karim <[email protected]>

fix: remove unnecesarry transformer

Signed-off-by: Karim <[email protected]>

fix: broken import

Signed-off-by: Karim <[email protected]>

fix: remove unnecessary W3cCredentialState

Signed-off-by: Karim <[email protected]>

fix: doc typo

Co-authored-by: Timo Glastra <[email protected]>

Signed-off-by: Karim Stekelenburg <[email protected]>
fix: remove commented code

Signed-off-by: Karim <[email protected]>

fix: remove unnecessary comment

Signed-off-by: Karim <[email protected]>

fix: rename confusing context vs context url

Signed-off-by: Karim <[email protected]>

fix: moved jsonld related types and code to utils file

Signed-off-by: Karim <[email protected]>

fix: replaced inline urls with local constants

Signed-off-by: Karim <[email protected]>

fix: broken imports

Signed-off-by: Karim <[email protected]>

fix: eslint issues

Signed-off-by: Karim <[email protected]>

fix: eslint issues

Signed-off-by: Karim <[email protected]>

fix: remove unnecessary assignment

Signed-off-by: Karim <[email protected]>

fix: replace faulty challenge assignment

Signed-off-by: Karim <[email protected]>

fix: inverted statement

Signed-off-by: Karim <[email protected]>

fix: remove unused revoked options

Signed-off-by: Karim <[email protected]>

fix: uuid challenge and presentation suites

Signed-off-by: Karim <[email protected]>

test: add missing test for bbs verify pres

Signed-off-by: Karim <[email protected]>

refactor: add custom ed25519 2020 to 2018 impl

Signed-off-by: Karim <[email protected]>

fix: unclear variable name

Signed-off-by: Karim <[email protected]>

feat: add issue credential v2 (openwallet-foundation#745)

Signed-off-by: Mike Richardson <[email protected]>
fix: removed unused props from docs

Signed-off-by: Karim <[email protected]>

refactor: rename utilities.ts to bbs-utils.ts

Signed-off-by: Karim <[email protected]>

feat: add additional W3cCredentialRecord tags

Signed-off-by: Karim <[email protected]>

fix: removed duplicate function

Signed-off-by: Karim <[email protected]>

fix: do not import test logger in src (openwallet-foundation#746)

Signed-off-by: Timo Glastra <[email protected]>
fix: do not import from src dir (openwallet-foundation#748)

Signed-off-by: Timo Glastra <[email protected]>
refactor: rewrite conversion method

Signed-off-by: Karim Stekelenburg <[email protected]>

feat: add givenId as W3cCredentialRecord tag

Signed-off-by: Karim Stekelenburg <[email protected]>

fix: convert any types

Signed-off-by: Karim Stekelenburg <[email protected]>

chore!: update indy-sdk-react-native version to 0.2.0 (openwallet-foundation#754)

Signed-off-by: Amit <[email protected]>

BREAKING CHANGE: indy-sdk-react-native has been updated to 0.2.0. The new version now depends on libindy version 1.16 and requires you to update the binaries in your react-native application. See the [indy-sdk-react-native](https://github.com/hyperledger/indy-sdk-react-native) repository for instructions on how to get the latest binaries for both iOS and Android.
fix: typings

Signed-off-by: Karim Stekelenburg <[email protected]>

fix: typings

Signed-off-by: Karim <[email protected]>

fix: typings & drop jsonld bbs dep

Signed-off-by: Karim <[email protected]>

fix: remove commented code

Signed-off-by: Karim <[email protected]>

fix: typing and faulty context

Signed-off-by: Karim <[email protected]>

fix: remove keyAgreement

Signed-off-by: Karim <[email protected]>

fix: remove unused typing file

Signed-off-by: Karim <[email protected]>

fix: rename map variable

Signed-off-by: Karim <[email protected]>

fix: use w3cDate

Signed-off-by: Karim <[email protected]>

fix: rename map variable

Signed-off-by: Karim <[email protected]>

style: clean map syntax

Signed-off-by: Karim <[email protected]>

fix: typo

Signed-off-by: Karim <[email protected]>

fix: remove commented code

Signed-off-by: Karim <[email protected]>

feat(core): add support for postgres wallet type (openwallet-foundation#699)

Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>

Co-authored-by: Timo Glastra <[email protected]>
fix: add g1 and g2 contexts

Signed-off-by: Karim <[email protected]>

fix: add X25519  contexts

Signed-off-by: Karim <[email protected]>

fix(node): allow to import node package without postgres (openwallet-foundation#757)

Signed-off-by: Timo Glastra <[email protected]>
fix: mediation record checks for pickup v2 (openwallet-foundation#736)

Signed-off-by: Timo Glastra <[email protected]>
Merge branch 'main' into feat/jsonld-credentials

fix: Key imports

Signed-off-by: Karim <[email protected]>

fix: change invalid g1 g2 contexts to bbs

Signed-off-by: Karim <[email protected]>

fix: remove invalid contexts

Signed-off-by: Karim <[email protected]>

fix: delete credentials (openwallet-foundation#766)

Signed-off-by: Mike Richardson <[email protected]>
fix: various

Signed-off-by: Karim <[email protected]>

test: do not use indy ledgers in wallet test

Signed-off-by: Timo Glastra <[email protected]>

fix: add jsonld.expand typedef

Signed-off-by: Karim <[email protected]>

Merge branch 'main' into feat/jsonld-credentials

fix: add additional typedefs

Signed-off-by: Karim <[email protected]>

feat: add out-of-band and did exchange (openwallet-foundation#717)

Signed-off-by: Jakub Koci <[email protected]>
Co-authored-by: Timo Glastra <[email protected]>

BREAKING CHANGE: the connections module has been extended with an out of band module and support for the DID Exchange protocol. Some methods have been moved to the out of band module, see [Migrating from AFJ 0.1.0 to 0.2.x](https://github.com/hyperledger/aries-framework-javascript/blob/main/docs/migration/0.1-to-0.2.md) for detailed migration instructions.
feat: support handling messages with different minor version (openwallet-foundation#714)

Signed-off-by: Timo Glastra <[email protected]>
fix: relax validation of thread id in revocation notification (openwallet-foundation#768)

Signed-off-by: Blazej Marcinkiewicz <[email protected]>
fix: typing issues with jsonld

Signed-off-by: Timo Glastra <[email protected]>

feat: ability to add generic records (openwallet-foundation#702)

feat: extension module creation (openwallet-foundation#688)

Co-authored-by: Berend Sliedrecht <[email protected]>
Co-authored-by: Timo Glastra <[email protected]>
Merge pull request #21 from TimoGlastra/fix/jsonld-types-issues

fix: typing issues with jsonld
fix: propose payload attachment in in snake_case JSON format (openwallet-foundation#775)

Signed-off-by: Mike Richardson <[email protected]>
fix: typing issues

Signed-off-by: Karim <[email protected]>

fix: delete credentials (openwallet-foundation#770)

Signed-off-by: Mike Richardson <[email protected]>
fix: type issues

Signed-off-by: Karim <[email protected]>

test: use event listener instead of while loop (openwallet-foundation#778)

Signed-off-by: Timo Glastra <[email protected]>
feat: bbs createKey, sign and verify (openwallet-foundation#684)

Signed-off-by: Berend Sliedrecht <[email protected]>

Merge branch '0.3.0-pre' into feat/jsonld-credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Present proof same attribute as predicate
4 participants