Documentation ¶
Overview ¶
Copyright 2016, Cossack Labs Limited
Licensed 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
http://www.apache.org/licenses/LICENSE-2.0
Unless 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.
Copyright 2016, Cossack Labs Limited ¶
Licensed 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
http://www.apache.org/licenses/LICENSE-2.0
Unless 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.
Copyright 2016, Cossack Labs Limited ¶
Licensed 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
http://www.apache.org/licenses/LICENSE-2.0
Unless 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.
Copyright 2016, Cossack Labs Limited ¶
Licensed 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
http://www.apache.org/licenses/LICENSE-2.0
Unless 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.
Copyright (c) 2017 Cossack Labs Limited ¶
This file is a part of Hermes-core.
Hermes-core is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Hermes-core is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Hermes-core. If not, see <http://www.gnu.org/licenses/>.
Copyright (c) 2017 Cossack Labs Limited ¶
This file is a part of Hermes-core.
Hermes-core is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Hermes-core is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Hermes-core. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func CArrayToSlice(buffer unsafe.Pointer, bufferLength int) []byte
- func GeneralKeystoreTest(store KeyStore, t *testing.T)
- func SetOutBufferPointerFromByteSlice(value []byte, outBuffer, outBufferLength unsafe.Pointer) error
- type CredentialStore
- type DataStore
- type KeyStore
- type MidHermes
- func (mh *MidHermes) AddBlock(id []byte, data []byte, meta []byte) error
- func (mh *MidHermes) Close() error
- func (mh *MidHermes) DeleteBlock(id []byte) error
- func (mh *MidHermes) GrantReadAccess(id []byte, for_user []byte) error
- func (mh *MidHermes) GrantWriteAccess(id []byte, for_user []byte) error
- func (mh *MidHermes) ReadBlock(id []byte) ([]byte, []byte, error)
- func (mh *MidHermes) RevokeReadAccess(id []byte, for_user []byte) error
- func (mh *MidHermes) RevokeWriteAccess(id []byte, for_user []byte) error
- func (mh *MidHermes) RotateBlock(id []byte) error
- func (mh *MidHermes) UpdateBlock(id []byte, data []byte, meta []byte) error
- type MidHermesWrapper
Constants ¶
const ( READ_ACCESS = 0 WRITE_ACCESS = 1 )
Variables ¶
var ErrCAlloc = errors.New("can't allocate memory")
var ErrEmptyParameter = errors.New("empty parameter")
var ErrIncorrectRightsValue = errors.New("used incorrect rights value")
var ErrInvalidDocumentId = errors.New("invalid document id")
var ErrInvalidUserId = errors.New("invalid user id")
var ErrKeyStoreAdd = errors.New("add command - Failed")
var ErrKeyStoreDelete = errors.New("delete command - Failed")
var ErrKeyStoreGet = errors.New("get command - Failed")
var ErrKeyStoreGetIndexedRights = errors.New("getIndexedRights command - Failed")
var ErrMacNotMatched = errors.New("mac not matched")
var ErrPublicKeyNotFound = errors.New("public key not found")
var ErrUserCredentialsExists = errors.New("user's credentials already exists")
Functions ¶
func CArrayToSlice ¶
CArrayToSlice return buffer as byte slice with len/cap equals to bufferLength
func GeneralKeystoreTest ¶
GeneralKeystoreTest test keystore implementation on standard behaviour and can be used by custom implementations for testing
Types ¶
type CredentialStore ¶
type CredentialStore interface { GetPublicKey(userId []byte) ([]byte, error) GetUsersList() ([][]byte, error) Close() error }
CredentialStore interface of hermes-core credential store and should be implemented by go implementations
type DataStore ¶
type DataStore interface { // AddBlock return block id or error AddBlock(data, meta, mac []byte) ([]byte, error) // AddBlockWithId return id or error AddBlockWithId(id, data, meta, mac []byte) ([]byte, error) // ReadBlock return data and meta data of block or error ReadBlock(id []byte) ([]byte, []byte, error) // ReadBlockMac return mac of block ReadBlockMac(id []byte) ([]byte, error) // UpdateBlock only if current block mac == oldMac UpdateBlock(id, data, meta, mac, oldMac []byte) error // DeleteBlock only if current block mac == oldMac DeleteBlock(id []byte, oldMac []byte) error // Close any implementation related resources Close() error }
DataStore interface of hermes-core data store and should be implemented by go implementations
type KeyStore ¶
type KeyStore interface { Get(docId, userId []byte, isUpdate int) ([]byte, []byte, error) // key, ownerId, error Add(docId, userId, key, ownerId []byte, isUpdate int) error Delete(docId, userId []byte, isUpdate int) error GetIndexedRights(blockId []byte, index int) ([]byte, int, error) Close() error }
KeyStore interface of hermes-core key store and should be implemented by go implementations
type MidHermes ¶
type MidHermes struct {
// contains filtered or unexported fields
}
MidHermes used to pass Go function call to C
func NewMidHermes ¶
func NewMidHermes(wrapper MidHermesWrapper) (*MidHermes, error)
NewMidHermes return new MidHermes
func (*MidHermes) DeleteBlock ¶
func (*MidHermes) GrantReadAccess ¶
func (*MidHermes) GrantWriteAccess ¶
func (*MidHermes) RevokeReadAccess ¶
func (*MidHermes) RevokeWriteAccess ¶
func (*MidHermes) RotateBlock ¶
type MidHermesWrapper ¶
MidHermesWrapper hide fetching C pointer to mid_hermes from go wrappers