This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Firas Qutishat <firas.qutishat@securekey.com>
- Loading branch information
Showing
8 changed files
with
114 additions
and
32 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
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,73 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// Package create implements sidetree create did option | ||
// | ||
package create | ||
|
||
import ( | ||
"crypto" | ||
|
||
docdid "github.com/hyperledger/aries-framework-go/pkg/doc/did" | ||
|
||
"github.com/hyperledger/aries-framework-go-ext/component/vdr/sidetree/doc" | ||
) | ||
|
||
// Opts create did opts. | ||
type Opts struct { | ||
PublicKeys []doc.PublicKey | ||
Services []docdid.Service | ||
GetEndpoints func() ([]string, error) | ||
RecoveryPublicKey crypto.PublicKey | ||
UpdatePublicKey crypto.PublicKey | ||
SigningKey crypto.PrivateKey | ||
SigningKeyID string | ||
MultiHashAlgorithm uint | ||
} | ||
|
||
// Option is a create DID option. | ||
type Option func(opts *Opts) | ||
|
||
// WithPublicKey add DID public key. | ||
func WithPublicKey(publicKey *doc.PublicKey) Option { | ||
return func(opts *Opts) { | ||
opts.PublicKeys = append(opts.PublicKeys, *publicKey) | ||
} | ||
} | ||
|
||
// WithService add service. | ||
func WithService(service *docdid.Service) Option { | ||
return func(opts *Opts) { | ||
opts.Services = append(opts.Services, *service) | ||
} | ||
} | ||
|
||
// WithSidetreeEndpoint get sidetree endpoints. | ||
func WithSidetreeEndpoint(getEndpoints func() ([]string, error)) Option { | ||
return func(opts *Opts) { | ||
opts.GetEndpoints = getEndpoints | ||
} | ||
} | ||
|
||
// WithRecoveryPublicKey set recovery public key. | ||
func WithRecoveryPublicKey(recoveryPublicKey crypto.PublicKey) Option { | ||
return func(opts *Opts) { | ||
opts.RecoveryPublicKey = recoveryPublicKey | ||
} | ||
} | ||
|
||
// WithUpdatePublicKey set update public key. | ||
func WithUpdatePublicKey(updatePublicKey crypto.PublicKey) Option { | ||
return func(opts *Opts) { | ||
opts.UpdatePublicKey = updatePublicKey | ||
} | ||
} | ||
|
||
// WithMultiHashAlgorithm set multi hash algorithm for sidetree request. | ||
func WithMultiHashAlgorithm(multiHashAlgorithm uint) Option { | ||
return func(opts *Opts) { | ||
opts.MultiHashAlgorithm = multiHashAlgorithm | ||
} | ||
} |
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