Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: removed previous file and updated packages #43

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 9 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ did:polygon:testnet:0xdce5306fb5f9ba6797546dcd2e11eb5c5201bfeb

Every DID on chain has the same structure, defined as:

```js
struct PolyDID{
address controller;
uint created;
uint updated;
string doc;
}
```

Where,

- controller : the address of the person who creates and manages the DID
Expand All @@ -63,44 +54,33 @@ Where,

## Create

Creating a DID refers to generation of a DID uri, based on either a newly generated wallet or user's existing wallet. Note that the wallet should hold Matic tokens.

Can be invoked using 2 methods

Method 1: With user's personal privateKey and network type(mainnet/testnet)

```js
import { createDID } from 'polygon-did-registrar'
const txHash = await createDID(network, privateKey)
```

Method 2: With only network type(mainnet/testnet)
Creating a createKeyPair refers to generation of a DID uri, based on a newly generated wallet.

```js
import { createDID } from 'polygon-did-registrar'
const txHash = await createDID(network)
import { createKeyPair } from 'polygon-did-registrar'
const keys = await createKeyPair(network)
```

The function returns, address, publicKey (base58 format), privateKey, and DID uri.
The function returns address, privateKey, publicKeyBase58, did

## Register

Register of DID is done by logging the transaction on the polygon-register smart contract, by invoking

```js
import { registerDID } from "polygon-did-registrar";
const txHash = await registerDID(did, privateKey, url?, contractAddress?);
import { create } from 'polygon-did-registrar'
const txHash = await create(did, didDoc)
```

The function returns a txhash and DID uri on successful execution.
The function returns a txnHash and DID and didDoc on successful execution.

## Update

The DID controller requests for the update functionality, if the controller wishes to edit the did doc store on the ledger using :

```js
import { updateDidDoc } from "polygon-did-registrar";
const txHash = await updateDidDoc(did, didDoc, privateKey, url?, contractAddress?);
import { update } from 'polygon-did-registrar'
const txHash = await update(did, didDoc)
```

## Add Resource
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"license": "MIT",
"dependencies": {
"@credo-ts/core": "0.5.3",
"@ayanworks/polygon-did-registry-contract": "2.0.1-alpha.8",
"@ayanworks/polygon-did-resolver": "^0.0.16-alpha.16",
"@ayanworks/polygon-did-registry-contract": "3.0.0",
"@ayanworks/polygon-did-resolver": "1.0.0",
"did-resolver": "^4.1.0",
"@ethersproject/basex": "^5.7.0",
"@ethersproject/signing-key": "^5.7.0",
Expand Down
22 changes: 11 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/config.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export { deleteDidDoc } from './polygon-did-delete'
export { createDID, registerDID } from './polygon-did-registrar'
export { updateDidDoc } from './polygon-did-update'
export {
PolygonDID,
PolygonDidInitOptions,
Expand Down
43 changes: 0 additions & 43 deletions src/polygon-did-delete.ts

This file was deleted.

177 changes: 0 additions & 177 deletions src/polygon-did-registrar.ts

This file was deleted.

Loading
Loading