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

DID Provider P2P APIs #131

Open
ruffiano89 opened this issue Aug 10, 2022 · 9 comments
Open

DID Provider P2P APIs #131

ruffiano89 opened this issue Aug 10, 2022 · 9 comments
Assignees

Comments

@ruffiano89
Copy link
Collaborator

Required:

  1. Create

  2. Resolve

  3. Update

  4. Create:
    Param (content: object)
    Returns Content: object

const cid = await ipfs.dag.put(content, { storeCodec: 'dag-cbor', hashAlg: 'sha2-512' });
const path = `/ipfs/${cid}`;
await ipfs.name.publish(path, {
                lifetime: lifetime,
                ttl: lifetime,
                key: keyName, // optional
            });
return content
  1. Resolve:
    Param (peerId: string)
    Returns (Content: Object)
const path:any = await all(ipfs.name.resolve(peerId));
console.log('path: ', path)
if(!path) return false
const cidStr = path[0].replace(/^\/ipfs\//, '');
const cid = CID.parse(cidStr)
const { value: content } = await ipfs.dag.get(cid);
return content
  1. Update:
    Call Resolve function and get Content with peerID
    Update previous content with new Content
const cid = await ipfs.dag.put(new_content, { storeCodec: 'dag-cbor', hashAlg: 'sha2-512' });
const path = `/ipfs/${cid}`;
await ipfs.name.publish(path, {
                lifetime: lifetime,
                ttl: lifetime,
                key: keyName, // optional
            });
return new_content
@farhoud
Copy link
Contributor

farhoud commented Aug 10, 2022

@ruffiano89
How to secure Update API?
anybody on the internet can connect to my Blox and update my DID document. and because you use IPNS there is no validation by hash.

@farhoud
Copy link
Contributor

farhoud commented Aug 10, 2022

@ruffiano89
any suggestions for namespace fula.diddoc:
import {create, update, resolve} from "fula.diddoc" ?

@farhoud
Copy link
Contributor

farhoud commented Aug 10, 2022

@ruffiano89
for testing can you please provide a sample Content: object?
or instruction how i can generate it?

@farhoud farhoud transferred this issue from functionland/fula-archived Aug 10, 2022
@farhoud farhoud transferred this issue from functionland/react-native-fula Aug 10, 2022
@farhoud farhoud linked a pull request Aug 10, 2022 that will close this issue
@ruffiano89
Copy link
Collaborator Author

@ruffiano89 any suggestions for namespace fula.diddoc: import {create, update, resolve} from "fula.diddoc" ?

import fulaProvider from 'fula-provider'
const didProvider = fulaProvider(ipfs)
didProvider.create()
didProvider.resolve()
didProvider.update()

@ruffiano89
Copy link
Collaborator Author

@ruffiano89 for testing can you please provide a sample Content: object? or instruction how i can generate it?

I will add source code into fula-sec with test case and you can use as reference. Pls, feel free to ask any question.

@ruffiano89
Copy link
Collaborator Author

@ruffiano89 How to secure Update API? anybody on the internet can connect to my Blox and update my DID document. and because you use IPNS there is no validation by hash.

await ipfs.name.publish(path, {key: keyName,}) we will add here pem key which is temporarily key after publishing we will remove it. key is only belongs to specific user which is owner.

@farhoud
Copy link
Contributor

farhoud commented Aug 11, 2022

@ruffiano89 How to secure Update API? anybody on the internet can connect to my Blox and update my DID document. and because you use IPNS there is no validation by hash.
await ipfs.name.publish(path, {key: keyName,}) we will add here pem key which is temporarily key after publishing we will remove it. key is only belongs to specific user which is owner.

How the owner get the pem key?

@ruffiano89
Copy link
Collaborator Author

ruffiano89 commented Aug 11, 2022

@ruffiano89 How to secure Update API? anybody on the internet can connect to my Blox and update my DID document. and because you use IPNS there is no validation by hash.
await ipfs.name.publish(path, {key: keyName,}) we will add here pem key which is temporarily key after publishing we will remove it. key is only belongs to specific user which is owner.

How the owner get the pem key?

Each time when we publish new content or update user will use encrypted pem key. after all process should be removed, because its temp pem key. we dont need keep always

@farhoud
Copy link
Contributor

farhoud commented Aug 11, 2022

@ruffiano89
How the client (fula) generate pem key?
Is it coming from blox ?
How the blox know this is owner?
How owner can access other to use this API?

@Ruffiano Ruffiano assigned Ruffiano and unassigned ruffiano89 Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants