## Apply for Developer Key
Please contact SendingNetwork to apply for developer key
## Login Process
1. Query for existing DIDs associated with current wallet address.
2. Obtain login message by using one of the DIDs or the wallet address if no DID exists.
3. Request for a mesasge signature with the developer key.
4. Request for a message signature with user wallet account.
5. Login by passing the two signatures to SDN server.

## Example
```javascript
import ethers from "ethers";
import crypto from "crypto";
import sdk from "sendingnetwork-js-sdk";
import request from "request";
const login = (base_url) => { // Pass the server URL as input value
const prefix = 'did:pkh:eip155:1:';
var privateKey = '';
if (privateKey == '') {
var id = crypto.randomBytes(32).toString('hex');
privateKey = '0x' + id;
console.log('SAVE BUT DO NOT SHARE THIS:', privateKey);
}
var client = sdk.createClient({
baseUrl: base_url,
request: request,
});
var wallet = new Wallet(privateKey);
const address = wallet.address;
const { data } = await client.getDIDList(`${address}`);
let [did] = data;
if (!did) {
const {
did: newDid,
message: cMessage,
updated: cUpdated,
} = await client.createDID(`${prefix}${address}`);
did = newDid;
let signature = await wallet.signMessage(cMessage);
await client.saveDID(newDid, {
signature,
operation: 'create',
updated: cUpdated,
address: `${prefix}${address}`,
});
}
const { message: lMessage, updated } = await client.preDIDLogin(did);
// request signature with wallet account
let sign = await wallet.signMessage(lMessage);
// request signature with server developer key
let serverSign = await serverSignMessage(lMessage);
let identifier = {
did,
token: sign,
app_token: serverSign,
};
let deviceId = localStorage.getItem('mx_device_id') || null;
let loginParams = {
type: 'm.login.did.identity',
updated,
identifier,
device_id: deviceId,
};
const { access_token, user_id, device_id } = await client.DIDLogin(
loginParams,
);
};
```
## Ethereum ECDSA Signature
example code in golang:
```go
package main
import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
func main() {
// replace with your private key (hex encoding)
keyHex := "81a36f13408b99c59f604e75c2614e6df97c6afb10ba728ad7c7dc423d4b2f4b"
// message to sign
message := "hello"
privateKey, _ := crypto.HexToECDSA(keyHex)
messageHash := accounts.TextHash([]byte(message))
signature, _ := crypto.Sign(messageHash, privateKey)
signatureHex := hexutil.Encode(signature)
println(signatureHex)
}
```