Skip to content

feat: identity class #815

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

Closed
wants to merge 12 commits into from
Closed

feat: identity class #815

wants to merge 12 commits into from

Conversation

rflechtner
Copy link
Contributor

@rflechtner rflechtner commented Dec 8, 2023

closes kiltprotocol/ticket#3043

TODOs

  • I ultimately envision this to have high-level support for managing an on-chain identity as well; but as-is, you can already make any DID operation (including those changing your DID document) through a combination of authorizeTx, submitTx, and update.
  • creating a new DID should allow passing account signers instead of keypairs
  • the vocabulary/terminology needs to be refined and finalised to make sure all methods and parameters communicate clearly what they are made for.

@rflechtner rflechtner changed the base branch from develop to vc-refactor December 8, 2023 16:15
@rflechtner rflechtner self-assigned this Dec 11, 2023
@rflechtner rflechtner force-pushed the rf-identity-class branch 2 times, most recently from 3dc8af4 to 3e46424 Compare December 13, 2023 17:25
@rflechtner rflechtner changed the base branch from vc-refactor to rf-sdk-surface December 13, 2023 17:40
Base automatically changed from rf-sdk-surface to vc-refactor December 14, 2023 12:44
Base automatically changed from vc-refactor to develop December 14, 2023 16:03
@rflechtner rflechtner force-pushed the rf-identity-class branch 2 times, most recently from 3127f68 to 02e6419 Compare December 14, 2023 17:41
* @param keypairs
* @returns The (in-place) modified Identity object for chaining.
*/
addKeypair: (...keypairs: Array<Keypair | KeyringPair>) => Promise<Identity>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this name may be problematic; if I implement a method that helps rotate or add public keys to the DID document, these namings may clash

resolver?: typeof resolve
transactionStrategy: TransactionStrategy<T>
}): Promise<T>
export async function makeIdentity<T extends IdentityClass>({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's makeIdentity and newIdentity; names could be improved to distinguish them better.

T extends IdentityClass &
Required<Pick<Identity, 'submitTx' | 'submitterAddress'>>
>(args: {
keys: TypedKeyPair | TypedKeyPairs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this parameter could accept signers too; but the name would have to change. I don't like it anyway though - it's too similar but different from the keypairs parameter of makeIdentity

signers: [...(await aliceSign(alice)), payerSigner],
submitterAccount: payerSigner.id,
})
const issued = await Issuer.issue(credential, alice as any)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’m used to seeing this test as an example of real-life usage of the SDK. As an SDK user I won’t be happy to write as any in my code. Is this an indication of an issue? (pun intended)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, probably a leftover, I don't think it's necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But more generally, what do you think about the overall approach to interacting with identity primitives here? Is this something you would have liked to implement sporran and SKYC on?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think my judgement is currently clouded by the pain of seeing the bundle-test in its current state. I believe it should be talked over.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, would love to chat, because right now I wouldn't really know what to change here

{ secretKey: encPublicKey, publicKey: encPublicKey, type: 'x25519' },
],
},
})
const address = api.createType('Address', authPublicKey).toString()
Copy link
Member

Choose a reason for hiding this comment

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

How does this work? I tried using this but failed.

Copy link
Member

Choose a reason for hiding this comment

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

The api throws an error back that it has a secret key.

Copy link
Member

Choose a reason for hiding this comment

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

If I pass only the publickey I get my address.

@Dudleyneedham
Copy link
Member

@rflechtner Can we close this?

@rflechtner
Copy link
Contributor Author

I do believe this is superseded by #881, so I'll close this PR. Please do not delete the branch though, as we may want to cherry-pick some features - especially the generateKeypair function - into our new solution.

@rflechtner rflechtner closed this Jul 17, 2024
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.

3 participants