-
Notifications
You must be signed in to change notification settings - Fork 20
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
Trust registry
and did:key
#382
Conversation
src/utils/did.js
Outdated
|
||
export const DockDIDMethod = 'dock'; | ||
export const DockDIDQualifier = `did:${DockDIDMethod}:`; | ||
export const DockDIDMethodKeyQualifier = `did:key:${DockDIDMethod}:`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The full DID would be did:key:dock:<value>
but as per spec https://w3c-ccg.github.io/did-method-key/, full DID should be did:key:<value>
Signed-off-by: lovesh <[email protected]>
Signed-off-by: lovesh <[email protected]>
src/utils/did.js
Outdated
} | ||
} | ||
|
||
const SECP256K1_PUBLIC_KEY_PREFIX = 'zQ3'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZQ3
-> ZQ3s
as per spec.
src/utils/did.js
Outdated
return createDidSig(this, keyRef, keySignature); | ||
} | ||
|
||
changeState(method, name, payload, keyRef) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only used to create an extrinsic so better to name it accordingly.
src/utils/did.js
Outdated
const ED_25519_PUBLIC_KEY_PREFIX = 'z6Mk'; | ||
|
||
const DockDidMethodKeySecp256k1Prefix = `${DockDIDQualifier}${SECP256K1_PUBLIC_KEY_PREFIX}`; | ||
const DockDidMethodKeyEd25519Prefix = `${DockDIDMethodKeyQualifier}${ED_25519_PUBLIC_KEY_PREFIX}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and above should have key
prefix and not dock
Signed-off-by: lovesh <[email protected]>
Signed-off-by: lovesh <[email protected]>
Signed-off-by: lovesh <[email protected]>
Signed-off-by: lovesh <[email protected]>
@@ -0,0 +1,326 @@ | |||
import { randomAsHex } from "@polkadot/util-crypto"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test mentions status list repeatedly in the comments. Need to be fixed.
Signed-off-by: lovesh <[email protected]>
Signed-off-by: lovesh <[email protected]>
@@ -49,7 +51,7 @@ class DIDModule { | |||
* @returns {*} | |||
*/ | |||
createNewOffchainTx(did, didDocRef) { | |||
const hexId = getHexIdentifierFromDID(did); | |||
const hexId = typedHexDID(this.api, did).asDid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know this did won't be a did:key
so its more efficient to use getHexIdentifier(did, DockDIDQualifier, DockDIDByteSize)
here than calling typedHexDID
which creates an unnecessary object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it will differ in efficiency despite an unnecessary object will be created.
@@ -76,7 +78,7 @@ class DIDModule { | |||
* @returns {*} | |||
*/ | |||
createSetOffchainDidRefTx(did, didDocRef) { | |||
const hexId = getHexIdentifierFromDID(did); | |||
const hexId = typedHexDID(this.api, did).asDid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as above on this line and similar lines as below.
* @param withParams - If true, return the params referenced by the public key. It will throw an error if paramsRef is null | ||
* or params were not found on chain which can happen if they were deleted after this public key was added. | ||
* @returns {Promise<{bytes: string}|null>} | ||
*/ | ||
async getPublicKey(did, keyId, withParams = false) { | ||
const hexId = getHexIdentifierFromDID(did); | ||
const hexId = typedHexDID(this.api, did); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did:key
can't have an onchain public key so you can just use getHexIdentifier
and avoid creating extra object in typedHexDID
src/modules/schema.js
Outdated
@@ -3,7 +3,6 @@ import { validate } from 'jsonschema'; | |||
import axios from 'axios'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
axios was removed here.
src/utils/vc/credentials.js
Outdated
@@ -3,8 +3,7 @@ import jsigs from 'jsonld-signatures'; | |||
import { statusTypeMatches, checkStatus } from '@digitalbazaar/vc-status-list'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is missing some code in verifyCredential
from master branch.
@@ -730,29 +682,35 @@ class DIDModule { | |||
* Throws NoDID if the DID does not exist on chain. | |||
* @param {string} did - The DID can be passed as fully qualified DID like `did:dock:<SS58 string>` or | |||
* a 32 byte hex string | |||
* @param getOffchainSigKeys | |||
* @return {Promise<object>} The DID document. | |||
*/ | |||
// eslint-disable-next-line sonarjs/cognitive-complexity | |||
async getDocument(did, { getOffchainSigKeys = true } = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please update this method to use didDetails
RPC so avoid multiple calls to the chain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done separately.
…ir creation Signed-off-by: lovesh <[email protected]>
Signed-off-by: lovesh <[email protected]>
Signed-off-by: lovesh <[email protected]>
const key = did.asDidMethodKey; | ||
|
||
if (key.isSecp256k1) { | ||
const hex = getHexIdentifier( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the implementation of DockDidMethodKey
, the following 2 calls to it should fail. Is there a test for this branch of code?
Signed-off-by: lovesh <[email protected]>
945c5e9
to
e8c615e
Compare
e8c615e
to
bf124c3
Compare
bf124c3
to
e8c615e
Compare
No description provided.