Last updated
Last updated
caver.wallet.keyring
은 주소와 개인키를 포함하는 키링 관련 기능을 제공하는 패키지입니다.
Keyring
은 계정 주소와 개인키를 포함하는 구조입니다. 사용자들이 을 사용해 서명을 할 수 있게 해주는 caver-js 클래스입니다.
Keyring
can be classified into three types depending on the type of key being stored: to store one address and one private key, to store one address and multiple private keys, and to store one address and one or more private keys for each role.
: User signs with a private key
: User signs with private keys
: User signs with the private key(s) by role
SingleKeyring
은 계정의 address
와 private key
를 저장하는 클래스입니다. To create a SingleKeyring instance with a private key string, please refer to .
SingleKeyring
는 역할이 할당되지 않은 개인키를 사용합니다.
properties
MultipleKeyring
는 역할이 할당되지 않은 개인키들을 사용합니다.
properties
RoleBasedKeyring
는 계정의 address
와 각 역할에 사용될 private keys
를 배열 형식으로 저장하는 클래스입니다.
properties
이하는 각 역할에 정의된 키를 직관적으로 사용하기 위해 키링에 정의된 게터(getter)입니다. 각 역할에 사용되는 키에 게터를 통해 더 쉽게 접근할 수 있습니다.
PrivateKey
는 개인키 문자열을 포함하는 클래스입니다. Keyring 내 각 역할에 사용되는 개인키는 이 PrivateKey
인스턴스로 정의됩니다.
properties
SignatureData
는 서명 데이터를 포함한 클래스입니다. sign
또는 signMessage
의 결과인 서명은 signatureData로서 반환됩니다. 아래와 같이 signatureData가 서명(들)을 포함하는 것을 확인할 수 있습니다.
properties
무작위로 생성된 캐인키로 SingleKeyring 인스턴스를 생성합니다.
Parameters
Return Value
Example
개인키 문자열을 생성합니다.
Parameters
Return Value
Example
개인키 문자열들을 생성합니다.
Parameters
Return Value
Example
Parameters
Return Value
Example
파라미터로 키링 인스턴스를 생성합니다.
Parameters
Return Value
Example
Parameters
Return Value
Example
Parameters
Return Value
Example
주소와 개인키 문자열로부터 SingleKeyring
인스턴스를 생성합니다.
Parameters
Return Value
Example
주소와 개인키 문자열로부터 MultipleKeyring
인스턴스를 생성합니다.
Parameters
Return Value
Example
Parameters
Return Value
Example
키스토어 v3 또는 v4 JSON을 복호화하고 복호화된 키링 객체를 반환합니다.
Parameters
Return Value
Example
Parameters
Return Value
Example
Returns a copied keyring instance.
Return Value
Example
Signs with transactionHash with the private key(s) and returns signature(s). If the user has not defined an index parameter, keyring.sign
signs transaction using all the private keys used by the role. If index
is defined, the keyring.sign
signs transaction using only one private key at the index. The role used in caver-js can be checked through caver.wallet.keyring.role
.
Parameters
Return Value
Example
Signs with hashed data using the private key and returns a signature where V is 0 or 1 (parity of the y-value of a the secp256k1 curve).
Parameters
Return Value
Example
Signs message with Klaytn-specific prefix. This calculates a Klaytn-specific signature with:
If the user has not defined the index parameter, keyring.signMessage
signs message with all the private keys used by the role. If the index parameter is given, keyring.signMessage
signs message using only one private key at the given index. The role used in caver-js can be found through caver.wallet.keyring.role
.
Parameters
Return Value
The returned object contains the following:
Example
Returns the private key(s) used by the role entered as a parameter.
Parameters
Return Value
Example
Return Value
Example
Parameters
Return Value
Example
Parameters
Return Value
The returned object contains the following:
Example
Parameters
Return Value
The returned object contains the following:
Example
Returns true
if keyring has decoupled key.
Return Value
Example
MultipleKeyring
은 계정의 address
와 private keys
를 저장하는 클래스입니다. To create a MultipleKeyring instance with private key strings, please refer to .
RoleBasedKeyring
defines keys
which is implemented as a two-dimensional array (empty keys
looks like [ [], [], [] ]
) that can include multiple keys for each . 2차원 배열의 첫 번째 원소에는 roleTransactionKey
로 사용될 개인키(들), 두 번째 원소에는 roleAccountUpdateKey
로 사용될 개인키(들), 세 번째 원소에는 roleFeePayerKey
로 사용될 개인키(들)이 저장됩니다.
Generates a 2D array of which each array element contains keys defined for each .
If key
is a private key string, a instance that uses a single private key is created. If key
is an array containing private key strings, a instance that use multiple private keys is created. If key
is a 2D array of which each element contains the private key(s) to be used for each role, a instance is created.
Creates a SingleKeyring
instance from a private key string or a .
Creates a SingleKeyring
instance from a string.
Creates a RoleBasedKeyring
instance from an address and a 2D array of which each array element contains keys defined for each .
공개키 문자열(들)을 반환합니다. If keyring
is an instance of , getPublicKey returns a public key string. If keyring
is an instance of , getPublicKey returns an array of public key strings. If keyring
is an instance of , getPublicKey returns a two-dimensional array in which the public key(s) used for each role is defined as an array.
When signing transactions, it is recommended to use or .
This function is only used for certain transaction types. Therefore, it is recommended to use or when signing a transaction.
Returns the string for the keyring. With or , cannot be used. In this case, use .
Returns the instance for updating the of the . The instance has an instance that can contain public key(s) inside, which will be sent to Klaytn Network and used for validating transactions. For more details about , see .
Note that if you update the of the stored in the Klaytn, the old private key(s) cannot be used anymore. See on how to use the returned instance to update information in your on Klaytn.
Depending on the type of the private key(s) in the keyring, the returned instances can be classified as follows.
When the keyring contains a private key string: Return an instance that includes the address in the keyring and an instance of
When the keyring contains private key strings: Return an instance that includes the address in the keyring and an instance of
When the keyring contains the different private key strings by role: Return an instance that includes the address in the keyring and an instance of
Encrypts a keyring and returns a keystore v4 standard. For more information, please refer to .
For more information, please refer to .
Encrypts an instance of and returns a keystore v3 standard.
Note that and cannot use encryptV3. In this case, please use with a keystore V4 standard.