# Semi Custodial Wallet

postman API collection: <https://documenter.getpostman.com/view/18419720/UzQvt5Kf#e58b4757-05ad-45aa-b8fc-82a0f3a66f88>

## Create Semi Custodial Wallet (Deprecated)

A type of wallet where Shyft holds half of your private keys while the other half is with the client or the end user.

### <mark style="color:blue;">**POST**</mark> /sol/v1/wallet/create\_semi\_wallet

We create a standard Solana wallet using **keypair.generate().** The private key is then encrypted with the provided **password** and random encryption parameters. In order to decrypt the key, we need the same password and the same encryption parameters.

So, password and encryption parameters act as **2 keys to unlock your wallet**.

> Shyft never ever stores or logs your password at any time. This can be confirmed with our open source code.

{% tabs %}
{% tab title="JS" %}

```javascript
const myHeaders = new Headers();
myHeaders.append("x-api-key", "QEbMrBRQEP92ToRo");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "password": "Ishkaran"
});

const requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/wallet/create_semi_wallet/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "success": true,
    "message": "Semi custodial wallet created successfully",
    "result": {
        "wallet_address": "VtkQHQt6GFggoNiWT7Tvafce6cJvCZbzEU8gBTez5rz"
    }
}
```

{% endtab %}
{% endtabs %}

## Decrypt Semi Custodial Wallet (Deprecated)

Decrypt a semi-custodial wallet and get an encrypted private key and decryption key.

You can only get decryption data for semi-custodial wallets created by you.

### <mark style="color:green;">**GET**</mark> /sol/v1/wallet/decrypt\_semi\_wallet

{% tabs %}
{% tab title="JS" %}

```javascript
const myHeaders = new Headers();
myHeaders.append("x-api-key", "QEbMrBRQEP92ToRo");
myHeaders.append("Content-Type", "application/json");

const raw = JSON.stringify({
  "wallet": "VtkQHQt6GFggoNiWT7Tvafce6cJvCZbzEU8gBTez5rz",
  "password": "Ishkaran"
});

const requestOptions = {
  method: 'GET',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/wallet/decrypt_semi_wallet", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Untitled" %}

```json
{
    "success": true,
    "message": "Decryption Data",
    "result": {
        "encryptedPrivateKey": "A9tP2aDsBNwSUojMc2eFF8qakkRRrfrYeUkGvFmZBHtrLPU7s9BNYupRazdMcbGuXtHpAbfW32MZgmGxdM5Z5U8wZrEZ5cNUcnjCSptRE2Hv3jB1zUP8JHKg8U44LM238ZUtHGUvZJcS1",
        "decryptionKey": "{\"salt\":\"8YBdmxT3aoSCAAMBKwYw6V\",\"kdf\":\"pbkdf2\",\"digest\":\"sha256\",\"iterations\":100000,\"nonce\":\"GevsymPUrngEKXxBPWQvTyufrY9XKnsM9\"}"
    }
}
```

{% endtab %}
{% endtabs %}

## Create Semi Custodial Wallet

A type of wallet where Shyft holds half of your private keys while the other half is with the client or the end user.

### <mark style="color:blue;">**POST**</mark> /sol/v1/semi\_wallet/create

We create a standard Solana wallet using **keypair.generate().** The private key is then encrypted with the provided **password** and random encryption parameters. In order to decrypt the key, we need the same password and the same encryption parameters.

So, password and encryption parameters act as **2 keys to unlock your wallet**.

> Shyft never ever stores or logs your password at any time. This can be confirmed with our open source code.

{% tabs %}
{% tab title="JS" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "20CcwuFeQOIcfuHx");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "password": "Qwerrty@z2"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/semi_wallet/create", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "success": true,
    "message": "Semi custodial wallet created successfully",
    "result": {
        "wallet_address": "7pu5mcx2N9bQwqfEe8aQkTzG6zrd9rsFArcvbeY93RkN"
    }
}
```

{% endtab %}
{% endtabs %}

## Decrypt Semi Custodial Wallet

Decrypt a semi-custodial wallet and get an encrypted private key and decryption key.

You can only get decryption data for semi-custodial wallets created by you.

#### Query Params

* **password:** Current password of your wallet
* **wallet:** Wallet address

### <mark style="color:green;">**GET**</mark> /sol/v1/semi\_wallet/decrypt

{% tabs %}
{% tab title="JS" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "20CcwuFeQOIcfuHx");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/semi_wallet/decrypt?password=Qwerrty@z2&wallet=7pu5mcx2N9bQwqfEe8aQkTzG6zrd9rsFArcvbeY93RkN", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "success": true,
    "message": "Decryption Data",
    "result": {
        "encryptedPrivateKey": "pYFpkcU9P4wcSo3xrTzH4cvAZFAPBjEQuc181P5t9UAtym7NgxHpfCYgR6f7ikhZYRJ3x4citPCTA4KKjZFnCtWMUjh5d67gzKbiS2BEmiph4E4raJfnSvR1adzPCn9VGTJZafb3CnMKmD",
        "decryptionKey": "{\"salt\":\"HhXEQgWV8scfSFaKyroKg2\",\"kdf\":\"pbkdf2\",\"digest\":\"sha256\",\"iterations\":100000,\"nonce\":\"ELWuGTCFDCK13jYx9d7pHnJrnthMnxpLo\"}"
    }
}
```

{% endtab %}
{% endtabs %}

## Get Keypair of Semi Custodial Wallet

#### Query Params

* **password:** Current password of your wallet
* **wallet:** Wallet address

### <mark style="color:green;">**GET**</mark> /sol/v1/semi\_wallet/get\_keypair

{% tabs %}
{% tab title="JS" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "20CcwuFeQOIcfuHx");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/semi_wallet/get_keypair?wallet=7pu5mcx2N9bQwqfEe8aQkTzG6zrd9rsFArcvbeY93RkN&password=Qwerrty@z2", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "success": true,
    "message": "Keypair of the wallet",
    "result": {
        "publicKey": "7pu5mcx2N9bQwqfEe8aQkTzG6zrd9rsFArcvbeY93RkN",
        "secretKey": "4Zko3JAtroEL8sKg9HHMBWpiRpGoetAqG4mofRU83tn5XwgC97EiMbxQ8VYXTGrih5bcwmDXRHgUnKgAqM32QN8r"
    }
}
```

{% endtab %}
{% endtabs %}

## Change password of Semi Custodial Wallet

#### BODY (raw)

* current\_passwor&#x64;**:** Current password of your wallet
* new\_password: New password of your wallet
* **wallet:** Wallet address

### <mark style="color:green;">**POST**</mark> /sol/v1/semi\_wallet/change\_password

{% tabs %}
{% tab title="JS" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("x-api-key", "20CcwuFeQOIcfuHx");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "current_password": "Qwerrty@z2",
  "new_password": "nothingto",
  "wallet": "7pu5mcx2N9bQwqfEe8aQkTzG6zrd9rsFArcvbeY93RkN"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/semi_wallet/change_password", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "success": true,
    "message": "Password changed successfully"
}
```

{% endtab %}
{% endtabs %}
