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

Api based sdk #150

Open
wants to merge 22 commits into
base: api_based_sdk
Choose a base branch
from
Open

Api based sdk #150

wants to merge 22 commits into from

Conversation

Vikastc
Copy link
Contributor

@Vikastc Vikastc commented Dec 5, 2023

No description provided.

smohan-dw and others added 22 commits August 3, 2023 21:01
Support for nested selective disclosure by using a flattened content model.  This PR also has a breaking change on `createPresentation` call. 
**not supported** - selective disclosure of array values

- refactored the function signature to accept an options object. This would allow you to easily omit specific properties and make the function more extensible in the future.

```
interface CreatePresentationOptions {
  document: IDocument;
  signCallback: SignCallback;
  selectedAttributes?: string[];
  challenge?: string;
}
```
Modified  createPresentation function:
```
export async function createPresentation({
  document,
  signCallback,
  selectedAttributes = [],
  challenge,
}: CreatePresentationOptions): Promise<IDocumentPresentation> {
  // ... (rest of the function remains unchanged)
}
```
We can now call the function with just the properties you need. It makes the call more readable and easily extensible.

```
const presentation = await createPresentation({
    document: document,
    signCallback: async ({ data }) => ({
      signature: holderKeys.authentication.sign(data),
      keyType: holderKeys.authentication.type,
      keyUri: `${holderDid.uri}${holderDid.authentication[0].id}`,
    }),
    // selectedAttributes: ['name', 'id', 'address.pin', 'address.location', 'address'],
    challenge: challenge
});
```

In the call above, we can easily omit selectedAttributes. If you want to include selectedAttributes, you can add that property to the options object.

This structure allows for much cleaner function calls, especially when a function has several parameters, and some of them are optional. We should refactor other calls to follow this model.
The "verifyPresentation()" method was previously checking if a stream
had been revoked. However, when dealing with stream updates, the stream
remains unrevoked, causing "verifyPresentation()" to incorrectly return
true for old documents as well. This problem has been resolved by 
implementing the new check.
…iway#121)

'required' is very crucial field to be added into the schema to support multiple usecases.

Fixes: dhiway#120

Signed-off-by: Amar Tumballi <[email protected]>
* netx-dev companion
* authority membership updates
* augment api updates
* demo updates to use the membership pallets.

Author: Satish Mohan
* type definitions update 
  - updates to latest DID
  - also gets the unique pallet related updates
Signed-off-by: vikastc <[email protected]>
Signed-off-by: vikastc <[email protected]>
Signed-off-by: vikastc <[email protected]>
Signed-off-by: vikastc <[email protected]>
Signed-off-by: vikastc <[email protected]>
Signed-off-by: vikastc <[email protected]>
@smohan-dw
Copy link
Member

Why are we adding this to the SDK repo?

@Vikastc
Copy link
Contributor Author

Vikastc commented Dec 5, 2023

There is a separate branch in cord.js named api_based_sdk, was working on this so did a git rebase

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.

5 participants