Skip to content

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

Closed
@mineme0110

Description

@mineme0110

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions