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

feat: add republish record to ipns #745

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: add republish record to ipns #745

wants to merge 2 commits into from

Conversation

2color
Copy link
Member

@2color 2color commented Feb 24, 2025

What

Fixes #744

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

@2color 2color requested a review from a team as a code owner February 24, 2025 12:46
@2color 2color requested a review from achingbrain February 25, 2025 11:07
*
* The public key is optional if the record has an embedded public key.
*/
republishRecord(record: IPNSRecord, pubKey?: PublicKey, options?: RepublishRecordOptions): Promise<void>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stick pubKey into RepublishRecordOptions object?

@@ -707,6 +721,33 @@ class DefaultIPNS implements IPNS {

return unmarshalIPNSRecord(record)
}

async republishRecord (record: IPNSRecord, pubKey?: PublicKey, options: RepublishRecordOptions = {}): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Comment on lines +46 to +50
testCid = CID.parse('QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn')
rsaKey = await generateKeyPair('RSA') // RSA will embed the public key in the record
ed25519Key = await generateKeyPair('Ed25519')
rsaRecord = await createIPNSRecord(rsaKey, testCid, 1n, 24 * 60 * 60 * 1000)
ed25519Record = await createIPNSRecord(ed25519Key, testCid, 1n, 24 * 60 * 60 * 1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to create all of these before each test? could we create them in the tests that use them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a nit here, but testCid could probably be moved up into the describe block, and then the records and keys could be moved into individual tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to republish IPNS records without private key
2 participants