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

SDK-1.0.0-alpha #2347

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

SDK-1.0.0-alpha #2347

wants to merge 5 commits into from

Conversation

lukeg90
Copy link
Contributor

@lukeg90 lukeg90 commented Jan 16, 2024

No description provided.

@lukeg90
Copy link
Contributor Author

lukeg90 commented Jan 16, 2024

Still need to fix the tests

src/views/SignDid/SignDid.tsx Show resolved Hide resolved
src/utilities/did/did.ts Outdated Show resolved Hide resolved
src/utilities/getDeposit/getDeposit.ts Outdated Show resolved Hide resolved
src/utilities/getDeposit/getDeposit.ts Outdated Show resolved Hide resolved
src/utilities/getTabEncryption/getTabEncryption.ts Outdated Show resolved Hide resolved
src/utilities/getTabEncryption/getTabEncryption.ts Outdated Show resolved Hide resolved

const {
didDocumentMetadata: { canonicalId, deactivated },
} = await DidResolver.resolve(lightDid, {});
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn’t the second parameter optional? I feel that it has to be.

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 also think it's weird that it's not optional, especially when it's called ResolutionOptions

Copy link
Contributor

Choose a reason for hiding this comment

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

Let’s apply slight pressure to someone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rflechtner we are applying slight pressure to you 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

That is an interesting one! I agree this is massively annoying and I'm inclined to make it optional - especially bc it is only required on the typing, but the actual implementation handles omitting it just fine. A quick look at the typings explains what feels like an oversight (Antonio built this, so I went to a similar discovery process):

  resolve: (
    /**
     * This is the DID to resolve.
     * This input is REQUIRED and the value MUST be a conformant DID as defined in 3.1 DID Syntax.
     */
    did: Did,
    /**
     * A metadata structure containing properties defined in 7.1.1 DID Resolution Options.
     * This input is REQUIRED, but the structure MAY be empty.
     */
    resolutionOptions: ResolutionOptions
  ) => Promise<ResolutionResult>

Meaning: it is a specification thing, which is why I am unsure what to do about it. I don't see any harm in making it optional really, but for some reason it's explicitly required even if empty...

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, my opinion about this specification authors has sunk a little more, nothing to see here

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 don't need to be sticklers about it really, I'll put it in my list of improvements

Copy link

Choose a reason for hiding this comment

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

Not an oversight, but compliance to the resolution spec. We could make it optional, I agree.

src/views/SignDidExtrinsic/SignDidExtrinsic.tsx Outdated Show resolved Hide resolved
src/utilities/didUpgrade/didUpgrade.ts Outdated Show resolved Hide resolved
@lukeg90 lukeg90 requested a review from ntn-x2 January 16, 2024 15:55
import { HexString } from '@polkadot/util/types';

import { DAppName } from '../../dApps/AccessChannels/DAppName';
import { Origin } from '../../dApps/AccessChannels/Origin';

export type CreateDidInput = DAppName & {
submitter: KiltAddress;
pendingDidUri?: DidUri;
pendingDidUri?: Did;
Copy link

Choose a reason for hiding this comment

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

Would changing pendingDidUrl to pendingDid following the new naming convention of the SDK break anything?

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless it's also changed in all the apps that use this API

src/channels/SignDidChannels/types.ts Show resolved Hide resolved
};

export type SignDidOriginInput = SignDidInput & Origin;

export interface SignDidOutput {
signature: HexString;
didKeyUri: DidResourceUri;
didKeyUri: DidUrl;
Copy link

Choose a reason for hiding this comment

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

Just a heads-up, mind that the new definition of DidUrl can include optional query parameters, so something like did:kilt:4....?param=value#keyId would now be a valid URL. They can of course simply be ignored, but I wanted to raise awareness that that's also possible now.

src/utilities/did/did.ts Outdated Show resolved Hide resolved
);
const dAppEncryptionDidKey = contentStream as VerificationMethod | undefined;

if (dAppEncryptionDidKey?.type !== 'Multikey') {
Copy link

Choose a reason for hiding this comment

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

@arty-name what would the convenience method do?


const {
didDocumentMetadata: { canonicalId, deactivated },
} = await DidResolver.resolve(lightDid, {});
Copy link

Choose a reason for hiding this comment

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

Not an oversight, but compliance to the resolution spec. We could make it optional, I agree.

src/injectedScript.ts Show resolved Hide resolved
src/injectedScript.ts Show resolved Hide resolved
src/injectedScript.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants