Skip to content

Enable the SDK to choose the subject DID when accepting a credential offer. #404

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

Open
mineme0110 opened this issue Mar 18, 2025 · 1 comment

Comments

@mineme0110
Copy link
Contributor

Proposed feature

Currently, the subject DID is created and used automatically when accepting the offer, but the process is not transparent to the user, and there is no option to choose the subject DID

export class CredentialOffer extends Plugins.Task<Args> {
async run(ctx: Plugins.Context) {
const offer = this.args.offer;
// [ ] https://github.com/hyperledger-identus/sdk-ts/issues/363 use CreatePrismDID
// CreatePrismDID needs updating to accept keytypes (both secp here)
const getIndexTask = new PrismKeyPathIndexTask({});
const index = await ctx.run(getIndexTask);
const masterSk = await ctx.Apollo.createPrivateKey({
[Domain.KeyProperties.curve]: Domain.Curve.SECP256K1,
[Domain.KeyProperties.index]: index,
[Domain.KeyProperties.seed]: Buffer.from(ctx.Seed.value).toString("hex"),
});
const authSk = await ctx.Apollo.createPrivateKey({
[Domain.KeyProperties.curve]: Domain.Curve.SECP256K1,
[Domain.KeyProperties.index]: index + 1,
[Domain.KeyProperties.seed]: Buffer.from(ctx.Seed.value).toString("hex"),
});
const did = await ctx.Castor.createPrismDID(
masterSk.publicKey(),
[],
[authSk.publicKey()]
);
await ctx.Pluto.storeDID(did, [masterSk, authSk]);
// ODOT
const payload = {
aud: [offer.options.domain],
nonce: offer.options.challenge,
vp: {
"@context": ["https://www.w3.org/2018/presentations/v1"],
type: ["VerifiablePresentation"],
},
};
const signedJWT = await ctx.JWT.signWithDID(did, payload);
return Payload.make(OEA.PRISM_JWT, signedJWT);

Feature description

Feature: User control over subject DID selection

As an SDK user,
I want to have control over the subject DID used when accepting a credential offer,
So that I can choose which DID to use instead of relying on an automatically created one.

Scenario: Accepting a credential offer with a chosen subject DID
Given I am using the SDK
When I receive a credential offer
Then I should have the option to select a subject DID before accepting the offer
And the process should be transparent to me.

Anything else?

No response

@mineme0110
Copy link
Contributor Author

@elribonazo @yshyn-iohk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant