good progress on did:key, x25519

This commit is contained in:
Michael Muré
2025-03-16 12:17:33 +01:00
parent ef067492f3
commit fe5b469bf9
14 changed files with 582 additions and 56 deletions

View File

@@ -14,6 +14,8 @@ type DID interface {
Document() (Document, error)
String() string // return the full DID URL, with path, query, fragment
Equal(DID) bool
}
// Document is the interface for a DID document. It represents the "resolved" state of a DID.
@@ -34,25 +36,25 @@ type Document interface {
// Authentication defines how the DID is able to authenticate, for purposes such as logging into a website
// or engaging in any sort of challenge-response protocol.
Authentication() []VerificationMethod
Authentication() []VerificationMethodSignature
// Assertion specifies how the DID subject is expected to express claims, such as for the purposes of issuing
// a Verifiable Credential.
// See https://www.w3.org/TR/vc-data-model/
Assertion() []VerificationMethod
Assertion() []VerificationMethodSignature
// KeyAgreement specifies how an entity can generate encryption material in order to transmit confidential
// information intended for the DID subject, such as for the purposes of establishing a secure communication channel
// with the recipient.
KeyAgreement() []VerificationMethod
KeyAgreement() []VerificationMethodKeyAgreement
// CapabilityInvocation specifies a verification method that might be used by the DID subject to invoke a
// cryptographic capability, such as the authorization to update the DID Document.
CapabilityInvocation() []VerificationMethod
CapabilityInvocation() []VerificationMethodSignature
// CapabilityDelegation specifies a mechanism that might be used by the DID subject to delegate a cryptographic
// capability to another party, such as delegating the authority to access a specific HTTP API to a subordinate.
CapabilityDelegation() []VerificationMethod
CapabilityDelegation() []VerificationMethodSignature
// TODO: Service
// https://www.w3.org/TR/did-extensions-properties/#service-types
@@ -77,7 +79,22 @@ type VerificationMethod interface {
// JsonLdContext reports the JSON-LD context definition required for this verification method.
JsonLdContext() string
}
// VerificationMethodSignature is a VerificationMethod implementing signature verification.
// It can be used for Authentication, Assertion, CapabilityInvocation, CapabilityDelegation
// in a Document.
type VerificationMethodSignature interface {
VerificationMethod
// Verify checks that 'sig' is a valid signature of 'data'.
Verify(data []byte, sig []byte) bool
}
// VerificationMethodKeyAgreement is a VerificationMethod implementing a shared key agreement.
// It can be used for KeyAgreement in a Document.
type VerificationMethodKeyAgreement interface {
VerificationMethod
// TODO: function for key agreement
}