func RandTestBogusIdentity() (testutil.Identity, error) { k, err := RandTestBogusPrivateKey() if err != nil { return nil, err } id, err := peer.IDFromPrivateKey(k) if err != nil { return nil, err } return &identity{ k: k, id: id, a: testutil.RandLocalTCPAddress(), }, nil }
func loadPrivateKey(cfg *config.Identity, id peer.ID) (ic.PrivKey, error) { sk, err := cfg.DecodePrivateKey("passphrase todo!") if err != nil { return nil, err } id2, err := peer.IDFromPrivateKey(sk) if err != nil { return nil, err } if id2 != id { return nil, fmt.Errorf("private key in config does not match id: %s != %s", id, id2) } return sk, nil }
// PublishWithEOL is a temporary stand in for the ipns records implementation // see here for more details: https://github.com/ipfs/specs/tree/master/records func (p *ipnsPublisher) PublishWithEOL(ctx context.Context, k ci.PrivKey, value path.Path, eol time.Time) error { id, err := peer.IDFromPrivateKey(k) if err != nil { return err } _, ipnskey := IpnsKeysForID(id) // get previous records sequence number seqnum, err := p.getPreviousSeqNo(ctx, ipnskey) if err != nil { return err } // increment it seqnum++ return PutRecordToRouting(ctx, k, value, seqnum, eol, p.routing, id) }