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

keys in did documents should list controller instead of owner #33

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ open class EthrDIDResolver : DIDResolver {
"owner", PublicKeyEntry(
id = "$ownerDID#owner",
type = Secp256k1VerificationKey2018,
owner = ownerDID,
controller = ownerDID,
ethereumAddress = ownerAddress
)
)
Expand Down Expand Up @@ -278,7 +278,7 @@ open class EthrDIDResolver : DIDResolver {
val pk = PublicKeyEntry(
id = "$normalizedDid#delegate-$delegateIndex",
type = type,
owner = normalizedDid
controller = normalizedDid
)

pkEntries[key] = when (encoding) {
Expand Down Expand Up @@ -335,7 +335,7 @@ open class EthrDIDResolver : DIDResolver {
veriKey.name -> pkEntries[key] = PublicKeyEntry(
id = "$ownerDID#delegate-$delegateIndex",
type = Secp256k1VerificationKey2018,
owner = ownerDID,
controller = ownerDID,
ethereumAddress = delegate
)
}
Expand Down
2 changes: 1 addition & 1 deletion ethr-did/src/test/java/me/uport/sdk/ethrdid/DDOTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DDOTest {
"publicKey": [{
"id": "did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#owner",
"type" : "Secp256k1VerificationKey2018",
"owner" : "did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a",
"controller" : "did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a",
"ethereumAddress" : "0xb9c5714089478a327f09197987f16f9e5d936e8a"
}],
"authentication": [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,13 @@ class EthrDIDResolverTest {
{
"id": "did:ethr:0x62d283fe6939c01fc88f02c6d2c9a547cc3e2656#owner",
"type": "Secp256k1VerificationKey2018",
"owner": "did:ethr:0x62d283fe6939c01fc88f02c6d2c9a547cc3e2656",
"controller": "did:ethr:0x62d283fe6939c01fc88f02c6d2c9a547cc3e2656",
"ethereumAddress": "0x62d283fe6939c01fc88f02c6d2c9a547cc3e2656"
},
{
"id": "did:ethr:0x62d283fe6939c01fc88f02c6d2c9a547cc3e2656#delegate-1",
"type": "Secp256k1VerificationKey2018",
"owner": "did:ethr:0x62d283fe6939c01fc88f02c6d2c9a547cc3e2656",
"controller": "did:ethr:0x62d283fe6939c01fc88f02c6d2c9a547cc3e2656",
"ethereumAddress": "0xcf03dd0a894ef79cb5b601a43c4b25e3ae4c67ed"
}
],
Expand Down Expand Up @@ -831,7 +831,7 @@ class EthrDIDResolverTest {
"DIDAttributeChanged-did/pub/secp256k1/veriKey/hex-0x0295dda1dca7f80e308ef60155ddeac00e46b797fd40ef407f422e88d2467a27eb" to PublicKeyEntry(
id = "did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#delegate-1",
type = PublicKeyType("secp256k1VerificationKey2018"),
owner = "did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6",
controller = "did:ethr:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6",
publicKeyHex = "0x0295dda1dca7f80e308ef60155ddeac00e46b797fd40ef407f422e88d2467a27eb"
)
) to emptyMap<String, ServiceEntry>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ open class EthrDIDTestHelpers {
PublicKeyEntry(
id = "$did#owner",
type = PublicKeyType.Secp256k1VerificationKey2018,
owner = did,
controller = did,
ethereumAddress = address
)
),
Expand Down
52 changes: 20 additions & 32 deletions jwt/src/test/java/me/uport/sdk/jwt/JWTToolsJVMTest.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ data class PublicKeyEntry(
@SerialName("type")
val type: PublicKeyType,

@SerialName("owner")
val owner: String,
@SerialName("controller")
val controller: String,

@SerialName("ethereumAddress")
val ethereumAddress: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ data class UportIdentityDocument(
val publicVerificationKey = PublicKeyEntry(
id = "$normalizedDid#keys-1",
type = Secp256k1VerificationKey2018,
owner = normalizedDid,
controller = normalizedDid,
publicKeyHex = this.publicKey?.clean0xPrefix()
)
val authEntries = listOf(
Expand All @@ -69,7 +69,7 @@ data class UportIdentityDocument(
PublicKeyEntry(
id = "$normalizedDid#keys-2",
type = Curve25519EncryptionPublicKey,
owner = normalizedDid,
controller = normalizedDid,
publicKeyBase64 = publicEncKey
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ class UportDIDResolverTest {

val verificationPkMatch = convertedDDO.publicKey.find { it ->
it.id.startsWith(expectedOwner) &&
it.owner == expectedOwner &&
it.controller == expectedOwner &&
it.type == Secp256k1VerificationKey2018 &&
it.publicKeyHex == publicKeyHex.clean0xPrefix()
}
assertThat(verificationPkMatch).isNotNull()

val encPkMatch = convertedDDO.publicKey.find { it ->
it.id.startsWith(expectedOwner) &&
it.owner == expectedOwner &&
it.controller == expectedOwner &&
it.type == Curve25519EncryptionPublicKey &&
it.publicKeyBase64 == publicEncKey
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WebDIDResolverTest {
{
"id": "did:web:uport.me#owner",
"type": "Secp256k1VerificationKey2018",
"owner": "did:web:uport.me",
"controller": "did:web:uport.me",
"publicKeyHex": "042b0af9b3ae6c7c3a90b01a3879d9518081bc0dcdf038488db9cb109b082a77d97ea3373e3dfde0eccd9adbdce11d0302ea5c098dbb0b310234c86895c8641622"
}
],
Expand All @@ -45,7 +45,7 @@ class WebDIDResolverTest {
PublicKeyEntry(
id = "did:web:uport.me#owner",
type = PublicKeyType.Secp256k1VerificationKey2018,
owner = "did:web:uport.me",
controller = "did:web:uport.me",
publicKeyHex = "042b0af9b3ae6c7c3a90b01a3879d9518081bc0dcdf038488db9cb109b082a77d97ea3373e3dfde0eccd9adbdce11d0302ea5c098dbb0b310234c86895c8641622"
)
),
Expand Down