{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package factory\n\nCopyright IBM Corp. 2016 All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright IBM Corp. 2017 All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright IBM Corp. 2016 All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright IBM Corp. All Rights Reserved.\n\nSPDX-License-Identifier: Apache-2.0\n\nCopyright IBM Corp. 2016 All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n## Constants\n\n```go\nconst (\n\t// PluginFactoryName is the factory name for BCCSP plugins\n\tPluginFactoryName = \"PLUGIN\"\n)\n```\n\n```go\nconst (\n\t// SoftwareBasedFactoryName is the name of the factory of the software-based BCCSP implementation\n\tSoftwareBasedFactoryName = \"SW\"\n)\n```\n\n## Functions\n\n```go\nfunc GetBCCSP(name string) (bccsp.BCCSP, error)\n```\nGetBCCSP returns a BCCSP created according to the options passed in input.\n\n```go\nfunc GetBCCSPFromOpts(config *FactoryOpts) (bccsp.BCCSP, error)\n```\nGetBCCSPFromOpts returns a BCCSP created according to the options passed in input.\n\n```go\nfunc GetDefault() bccsp.BCCSP\n```\nGetDefault returns a non-ephemeral (long-term) BCCSP\n\n```go\nfunc InitFactories(config *FactoryOpts) error\n```\nInitFactories must be called before using factory interfaces It is acceptable to call with config = nil, in which case some defaults will get used Error is returned only if defaultBCCSP cannot be found\n\n## Types\n\n```go\ntype BCCSPFactory interface {\n\n\t// Name returns the name of this factory\n\tName() string\n\n\t// Get returns an instance of BCCSP using opts.\n\tGet(opts *FactoryOpts) (bccsp.BCCSP, error)\n}\n```\nBCCSPFactory is used to get instances of the BCCSP interface. A Factory has name used to address it.\n\n```go\ntype DummyKeystoreOpts struct{}\n```\n\n```go\ntype FactoryOpts struct {\n\tProviderName string      `mapstructure:\"default\" json:\"default\" yaml:\"Default\"`\n\tSwOpts       *SwOpts     `mapstructure:\"SW,omitempty\" json:\"SW,omitempty\" yaml:\"SwOpts\"`\n\tPluginOpts   *PluginOpts `mapstructure:\"PLUGIN,omitempty\" json:\"PLUGIN,omitempty\" yaml:\"PluginOpts\"`\n}\n```\nFactoryOpts holds configuration information used to initialize factory implementations\n\n```go\nfunc GetDefaultOpts() *FactoryOpts\n```\nGetDefaultOpts offers a default implementation for Opts returns a new instance every time\n\n```go\nfunc (o *FactoryOpts) FactoryName() string\n```\nFactoryName returns the name of the provider\n\n```go\ntype FileKeystoreOpts struct {\n\tKeyStorePath string `mapstructure:\"keystore\" yaml:\"KeyStore\"`\n}\n```\nPluggable Keystores, could add JKS, P12, etc..\n\n```go\ntype InmemKeystoreOpts struct{}\n```\nInmemKeystoreOpts - empty, as there is no config for the in-memory keystore\n\n```go\ntype PluginFactory struct{}\n```\nPluginFactory is the factory for BCCSP plugins\n\n```go\nfunc (f *PluginFactory) Get(config *FactoryOpts) (bccsp.BCCSP, error)\n```\nGet returns an instance of BCCSP using Opts.\n\n```go\nfunc (f *PluginFactory) Name() string\n```\nName returns the name of this factory\n\n```go\ntype PluginOpts struct {\n\t// Path to plugin library\n\tLibrary string\n\t// Config map for the plugin library\n\tConfig map[string]interface{}\n}\n```\nPluginOpts contains the options for the PluginFactory\n\n```go\ntype SWFactory struct{}\n```\nSWFactory is the factory of the software-based BCCSP.\n\n```go\nfunc (f *SWFactory) Get(config *FactoryOpts) (bccsp.BCCSP, error)\n```\nGet returns an instance of BCCSP using Opts.\n\n```go\nfunc (f *SWFactory) Name() string\n```\nName returns the name of this factory\n\n```go\ntype SwOpts struct {\n\t// Default algorithms when not specified (Deprecated?)\n\tSecLevel   int    `mapstructure:\"security\" json:\"security\" yaml:\"Security\"`\n\tHashFamily string `mapstructure:\"hash\" json:\"hash\" yaml:\"Hash\"`\n\n\t// Keystore Options\n\tEphemeral     bool               `mapstructure:\"tempkeys,omitempty\" json:\"tempkeys,omitempty\"`\n\tFileKeystore  *FileKeystoreOpts  `mapstructure:\"filekeystore,omitempty\" json:\"filekeystore,omitempty\" yaml:\"FileKeyStore\"`\n\tDummyKeystore *DummyKeystoreOpts `mapstructure:\"dummykeystore,omitempty\" json:\"dummykeystore,omitempty\"`\n\tInmemKeystore *InmemKeystoreOpts `mapstructure:\"inmemkeystore,omitempty\" json:\"inmemkeystore,omitempty\"`\n}\n```\nSwOpts contains options for the SWFactory\n\n","path":"github.com/eric-erki/https-hyperledger.org/bccsp/factory","name":"factory","synopsis":"","isRedistributable":true}
