Skip to content

Commit

Permalink
Pres submission test vectors (#109)
Browse files Browse the repository at this point in the history
* add new vectors

* add pres submission test vectors

* update script

* new test

---------

Co-authored-by: Gabe <[email protected]>
  • Loading branch information
nitro-neal and decentralgabe authored Jan 26, 2024
1 parent 999327f commit c778d31
Show file tree
Hide file tree
Showing 4 changed files with 868 additions and 0 deletions.
150 changes: 150 additions & 0 deletions test-vectors/did_dht/create.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"description": "did:dht create",
"vectors": [
{
"description": "creates a did document according to the vector in https://did-dht.com/#vector-1",
"input": {
"identityPublicJwk": {
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
}
},
"output": {
"id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo",
"verificationMethod": [
{
"id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0",
"type": "JsonWebKey",
"controller": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo",
"publicKeyJwk": {
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
}
}
],
"authentication": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0"
],
"assertionMethod": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0"
],
"capabilityInvocation": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0"
],
"capabilityDelegation": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0"
]
}
},
{
"description": "creates a did document according to the vector in https://did-dht.com/#vector-2",
"input": {
"identityPublicJwk": {
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
},
"services": [
{
"id": "service-1",
"type": "TestService",
"serviceEndpoint": [
"https://test-service.com/1",
"https://test-service.com/2"
]
}
],
"additionalVerificationMethods": [
{
"jwk": {
"kty": "EC",
"crv": "secp256k1",
"x": "1_o0IKHGNamet8-3VYNUTiKlhVK-LilcKrhJSPHSNP0",
"y": "qzU8qqh0wKB6JC_9HCu8pHE-ZPkDpw4AdJ-MsV2InVY",
"alg": "ES256K",
"kid": "0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw"
},
"purposes": [
"assertionMethod",
"capabilityInvocation"
]
}
],
"controller": [
"did:example:abcd"
],
"alsoKnownAs": [
"did:example:efgh",
"did:example:ijkl"
]
},
"output": {
"id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo",
"controller": "did:example:abcd",
"alsoKnownAs": [
"did:example:efgh",
"did:example:ijkl"
],
"verificationMethod": [
{
"id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0",
"type": "JsonWebKey",
"controller": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo",
"publicKeyJwk": {
"kty": "OKP",
"crv": "Ed25519",
"x": "YCcHYL2sYNPDlKaALcEmll2HHyT968M4UWbr-9CFGWE",
"alg": "EdDSA",
"kid": "0"
}
},
{
"id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw",
"type": "JsonWebKey",
"controller": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo",
"publicKeyJwk": {
"kty": "EC",
"crv": "secp256k1",
"x": "1_o0IKHGNamet8-3VYNUTiKlhVK-LilcKrhJSPHSNP0",
"y": "qzU8qqh0wKB6JC_9HCu8pHE-ZPkDpw4AdJ-MsV2InVY",
"alg": "ES256K",
"kid": "0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw"
}
}
],
"authentication": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0"
],
"assertionMethod": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0",
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw"
],
"capabilityInvocation": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0",
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0GkvkdCGu3DL7Mkv0W1DhTMCBT9-z0CkFqZoJQtw7vw"
],
"capabilityDelegation": [
"did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#0"
],
"service": [
{
"id": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoo#service-1",
"type": "TestService",
"serviceEndpoint": [
"https://test-service.com/1",
"https://test-service.com/2"
]
}
]
}
}
]
}
41 changes: 41 additions & 0 deletions test-vectors/did_dht/resolve.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"description": "did:dht resolution",
"vectors": [
{
"description": "methodNotSupported error returned when did method is not dht",
"input": {
"didUri": "did:web:example.com"
},
"output": {
"didResolutionMetadata": {
"error": "methodNotSupported"
}
},
"errors": true
},
{
"description": "notFound error returned when not published",
"input": {
"didUri": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfoz"
},
"output": {
"didResolutionMetadata": {
"error": "notFound"
}
},
"errors": true
},
{
"description": "invalidDid error returned for suffix with invalid character",
"input": {
"didUri": "did:dht:cyuoqaf7itop8ohww4yn5ojg13qaq83r9zihgqntc5i9zwrfdfov"
},
"output": {
"didResolutionMetadata": {
"error": "invalidDid"
}
},
"errors": true
}
]
}
Loading

0 comments on commit c778d31

Please sign in to comment.