This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #383 from klaytn/release/v1.5.4
[Master] release/v1.5.4 QA Sign-off
- Loading branch information
Showing
10 changed files
with
244 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
# Terms of Use | ||
# Software Terms Of Use | ||
|
||
## 1. Your Use of Open Source Software | ||
## 1. Purpose | ||
|
||
We may make (but are not obligated to make) the source code of Klaytn Blockchain Network Platform ("Platform"), the software on the Platform, etc. for download as open source software. If you use this open source software, you agree to be bound by and comply with any license that applies to this open source software. You will not indicate that you are associated with us in connection with your use, modifications or distributions of this open source software. | ||
The purpose of these Terms of Use (“Terms”) is to describe and define terms and conditions of users’ using open source software provided by Klaytn Pte. Ltd. (“Klaytn”)(“Software”). Users may easily and effectively utilize the Klaytn blockchain platform (“Platform”) by downloading the Software. | ||
|
||
## 2. Services Provided on the Platform | ||
## 2. Consent of the Terms | ||
|
||
The Platform is a combination of peer-to-peer subnetworks of nodes transmitting transactions and blocks to execute value transfers and run smart contracts. The Core Cell Network ("CCN"), which is one of the subnetworks that constitute the Platform, verifies and executes transactions that occur on the Platform. The CCN is operated by Klaytn Governance Council, which is a collective group of Core Cell Operators, and Klaytn is not directly involved in any services that are provided in or individual transactions that occur on the Platform. | ||
These Terms shall be applied to users installing and utilizing the Software including but not limited to user contents and further applied to users downloading and utilizing the Software from a third party webpage which is not operated by Klaytn. In this case, it is deemed to be acknowledged and agreed that users shall comply with and be bound by all licenses applied to or belong to the Software by users’ installing and using the Software. | ||
|
||
## 3. Your Installation of BApp on the Platform | ||
## 3. Services provided by the Software | ||
|
||
Your use of open source software is free of charge. However, you may be required to pay a certain number of KLAY as a transaction fee in order to execute a transaction on the Platform, including the installation of the BApp on the Platform. | ||
The Software provides users with services which enable them to interact with Klaytn blockchain and users may refer to details of such services at Klaytn docs (https://docs.klaytn.com/bapp/sdk/caver-js). | ||
|
||
Once transaction is executed successfully and respective block generation is verified successfully by the Platform’s mechanism, the block is irreversibly stored in the blockchain. As such, your installation of the BApp and any other transactions on the Platform, as well as the submission of transaction fee is final and irrevocable. | ||
## 4. Software use and installation | ||
|
||
## 4. User Content | ||
While users may install and use the Software free of charge, with respect to transactions during operating a BApp, certain amount of fee (or KLAY) may incur due to the Software’s using the Klaytn blockchain network in accordance with the network’s policy. Furthermore, Klaytn shall not limit or shall not be responsible for all activities/outcomes arising out of or in connection with users’ utilization of the Software. Klaytn does not provide with any express or implied representations or warranties regarding users’ installation and/or utilization of the Software. | ||
|
||
If you or the users of your BApp post, upload, input, provide or submit any content on the Platform (collectively, your "User Content"), you must ensure that the User Content provided by you or the users of your BApp at that or at any other time is true, accurate, up to date and complete and that any User Content you or the users of your BApp post, upload, input, provide or submit via the Platform do not breach or infringe legal rights of any third party. To the extent that is technically possible, you agree to prevent, remove or block access of any User Content that you or the users of your BApp post, upload, input, provide or submit via the Platform that violate or may violate legal rights (such as rights of privacy and publicity) of others or any applicable laws or regulations. We do not own, control or endorse any User Content that is transmitted, stored or processed via the Platform or sent to us and we are not responsible or liable for any User Content. We make no assurance that any of Your Content will be secured or that such content will remain confidential. | ||
## 5. Modification of the Terms | ||
|
||
You are solely responsible and liable for all of your User Content and for your use of any interactive features, links or information or content on the Platform, and you represent and warrant that (i) you own all intellectual property rights (or have obtained all necessary permissions) to provide your User Content and to grant the licenses in these Terms of Use; (ii) your User Content will not violate any agreements or confidentiality obligations; and (iii) your User Content will not violate, infringe or misappropriate any intellectual property right or other proprietary right, including the right of publicity or privacy, of any person or entity. | ||
If necessary, Klaytn may amend any terms and conditions of these Terms without prior notice to users. The amended Terms shall be effective as of the date when its posting at the root directory of the Github source repository (http://github.com/klaytn/caver-js). Klaytn recommends users to frequently check up the latest Terms as Klaytn does not notify such to an individual user. | ||
|
||
You shall not include in User Content, or upload, transmit to or create or include in the Services environment any production data or any sensitive, proprietary, confidential or other data with particular data protection requirements such as personal data or personally identifiable information relating to an identified or identifiable natural person. | ||
## 6. Liability for the use of Software | ||
|
||
You are prohibited from using the Platform to post or transmit any threatening, libellous, defamatory, obscene, scandalous, inflammatory, pornographic or profane material, any material that is contrary to applicable local, federal, or international laws and regulations, or any material that could constitute or encourage unlawful conduct. You must ensure that your User Content do not include such materials. We may from time to time monitor or review material transmitted or posted using the Network, and we reserve the right to delete any material we deem inappropriate. | ||
|
||
We are under no obligation to do so and assume no responsibility or liability arising from any material transmitted or posted using the Platform. | ||
|
||
You understand that any information you or users of your BApp upload to the Platform will be distributed among the blockchain nodes and may not removable due to technical limitations of the blockchain technology. | ||
|
||
You are entirely responsible for any and all activities that occur under your account or your BApp (if any). You agree to notify us immediately of any unauthorized use of your User Content, your BApp or account or any other breach of security. We will not be liable for any loss or damages that you may incur as a result of someone else using your User Content, your BApp or account, either with or without your knowledge. However, you could be held liable for losses incurred by us or another party due to someone else using your User Content, your BApp or account. You may not use anyone else’s User Content, your BApp or account at any time without the permission of such person or entity. | ||
|
||
By posting, uploading, inputting, providing or submitting your User Content to the Platform, you grant to participants of the Platform and any necessary sub-licensees a non-exclusive, worldwide, perpetual, right and permission to use, reproduce, copy, edit, modify, translate, reformat, create derivative works from, distribute, transmit, publicly perform and publicly display your User Content and sub-license such rights to others. | ||
|
||
If we have reason to believe that there is likely to be a breach of security, breach or misuse of the Platform or if you breach any of your obligations under these terms, we may suspend your use of the Platform at any time and for any reason. | ||
Klaytn shall not limit or enforce any action against its provision, publication and/or input of the Software to users except for the cases where a relevant governmental authority requests and/or a certain applicable law dictate. Users shall ultimately be responsible for any and all activities/outcomes arising out of or in connection with the utilization of the Software and therefore Klaytn shall not be responsible for them. | ||
|
||
Users shall be responsible for any and all unexpectable problems arising out of or in connection with users’ alteration or deletion of any code (including but not limited to licenses) of the Software which shall include any act which is any misuse of the network or violation of any social policies. Klaytn shall not be responsible for any problems brought by users’ errors and/or omissions when utilizing the Software. | ||
|
||
With respect to users’ installation and utilization of the Software, it is deemed to be acknowledged and agreed that users understand and agree that any information including but not limited to users’ personal information may not be removable due to technical limitations of blockchain technology resulted from such information being distributed among klaytn blockchain nodes. Users shall be cautious and be careful to upload, create and/or transmit any personally verifiable information or important data. Klaytn shall not be responsible for any incorrect or wrongful transmission/publication of data. |
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,12 @@ | ||
{ | ||
"name": "caver-ipfs", | ||
"version": "1.0.0", | ||
"description": "This is a sub package of [caver-js][repo]", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Klaytn Team", | ||
"license": "LGPL" | ||
} | ||
|
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,103 @@ | ||
/* eslint-disable class-methods-use-this */ | ||
/* | ||
Copyright 2020 The caver-js Authors | ||
This file is part of the caver-js library. | ||
The caver-js library is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
The caver-js library 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 Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with the caver-js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
const fs = require('fs') | ||
const IPFSAPI = require('ipfs-api') | ||
const multihash = require('multihashes') | ||
|
||
/** | ||
* Representing a class for uploading and loading files to IPFS. | ||
* @class | ||
*/ | ||
class IPFS { | ||
/** | ||
* Create an IPFS. | ||
* @param {string} host The host url. | ||
* @param {number} port The port number to use. | ||
* @param {boolean} ssl With or without SSL. | ||
*/ | ||
constructor(host, port, ssl) { | ||
if (host !== undefined && port !== undefined && ssl !== undefined) { | ||
this.setIPFSNode(host, port, ssl) | ||
} | ||
} | ||
|
||
/** | ||
* sets a IPFS Node | ||
* | ||
* @param {string} host The host url. | ||
* @param {number} port The port number to use. | ||
* @param {boolean} ssl With or without SSL. | ||
* @return {void} | ||
*/ | ||
setIPFSNode(host, port, ssl) { | ||
const protocol = ssl ? 'https' : 'http' | ||
this.ipfs = new IPFSAPI({ host, port, protocol }) | ||
} | ||
|
||
/** | ||
* adds a file to IPFS | ||
* | ||
* @param {string} path The file path string. | ||
* @return {string} | ||
*/ | ||
async add(path) { | ||
if (!this.ipfs) throw new Error(`Please set IPFS Node through 'caver.ipfs.setIPFSNode'.`) | ||
const data = fs.readFileSync(path) | ||
const ret = await this.ipfs.add(data) | ||
return ret[0].hash | ||
} | ||
|
||
/** | ||
* gets a file from IPFS | ||
* | ||
* @param {string} hash The file hash string. | ||
* @return {Buffer} | ||
*/ | ||
async get(hash) { | ||
if (!this.ipfs) throw new Error(`Please set IPFS Node through 'caver.ipfs.setIPFSNode'.`) | ||
const ret = await this.ipfs.cat(hash) | ||
return ret | ||
} | ||
|
||
/** | ||
* converts a hash to hex format. | ||
* | ||
* @param {string} hash The file hash string. | ||
* @return {string} | ||
*/ | ||
toHex(hash) { | ||
const buf = multihash.fromB58String(hash) | ||
return `0x${multihash.toHexString(buf)}` | ||
} | ||
|
||
/** | ||
* converts from a hex format. | ||
* | ||
* @param {string} hash The file hash string in hex format. | ||
* @return {string} | ||
*/ | ||
fromHex(contentHash) { | ||
const hex = contentHash.substring(2) | ||
const buf = multihash.fromHexString(hex) | ||
return multihash.toB58String(buf) | ||
} | ||
} | ||
|
||
module.exports = IPFS |
Oops, something went wrong.