-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add signature to resolver by parameter
- Loading branch information
Showing
15 changed files
with
815 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
## | ||
## Build did driver | ||
## | ||
FROM golang:1.18-alpine as base | ||
FROM golang:1.18-alpine AS base | ||
|
||
WORKDIR /build | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package document | ||
|
||
import ( | ||
"encoding/json" | ||
"errors" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/signer/core/apitypes" | ||
"github.com/iden3/go-schema-processor/v2/verifiable" | ||
) | ||
|
||
type DidResolutionProof interface { | ||
ProofType() verifiable.ProofType | ||
} | ||
|
||
type DidResolutionProofs []DidResolutionProof | ||
|
||
type EthereumEip712SignatureProof2021 struct { | ||
Type verifiable.ProofType `json:"type"` | ||
ProofPursopose string `json:"proofPurpose"` | ||
ProofValue string `json:"proofValue"` | ||
VerificationMethod string `json:"verificationMethod"` | ||
Created time.Time `json:"created"` | ||
Eip712 apitypes.TypedData `json:"eip712"` | ||
} | ||
|
||
// EthereumEip712Signature2021Type is a proof type for EIP172 signature proofs | ||
// nolint:stylecheck // we need to keep the name as it is | ||
const EthereumEip712SignatureProof2021Type verifiable.ProofType = "EthereumEip712Signature2021" | ||
|
||
func (p *EthereumEip712SignatureProof2021) ProofType() verifiable.ProofType { | ||
return p.Type | ||
} | ||
|
||
func (p *EthereumEip712SignatureProof2021) UnmarshalJSON(in []byte) error { | ||
var obj struct { | ||
Type verifiable.ProofType `json:"type"` | ||
ProofPursopose string `json:"proofPurpose"` | ||
ProofValue string `json:"proofValue"` | ||
VerificationMethod string `json:"verificationMethod"` | ||
Created time.Time `json:"created"` | ||
Eip712 json.RawMessage `json:"eip712"` | ||
} | ||
err := json.Unmarshal(in, &obj) | ||
if err != nil { | ||
return err | ||
} | ||
if obj.Type != EthereumEip712SignatureProof2021Type { | ||
return errors.New("invalid proof type") | ||
} | ||
p.Type = obj.Type | ||
err = json.Unmarshal(obj.Eip712, &p.Eip712) | ||
if err != nil { | ||
return err | ||
} | ||
p.VerificationMethod = obj.VerificationMethod | ||
p.ProofPursopose = obj.ProofPursopose | ||
p.ProofValue = obj.ProofValue | ||
p.Created = obj.Created | ||
return nil | ||
} |
Oops, something went wrong.