Exemple #1
0
// Expects address in base58 form
func NewRegularKeyFromAddress(s string) (*RegularKey, error) {
	hash, err := crypto.NewRippleHashCheck(s, crypto.RIPPLE_ACCOUNT_ID)
	if err != nil {
		return nil, err
	}
	var regKey RegularKey
	copy(regKey[:], hash.Payload())
	return &regKey, nil
}
Exemple #2
0
// Expects address in base58 form
func NewSeedFromAddress(s string) (*Seed, error) {
	hash, err := crypto.NewRippleHashCheck(s, crypto.RIPPLE_FAMILY_SEED)
	if err != nil {
		return nil, err
	}
	var seed Seed
	copy(seed[:], hash.Payload())
	return &seed, nil
}
Exemple #3
0
// Expects address in base58 form
func NewAccountFromAddress(s string) (*Account, error) {
	hash, err := crypto.NewRippleHashCheck(s, crypto.RIPPLE_ACCOUNT_ID)
	if err != nil {
		return nil, err
	}
	var account Account
	copy(account[:], hash.Payload())
	return &account, nil
}
Exemple #4
0
func common(c *cli.Context) error {
	if c.GlobalString("seed") == "" {
		return fmt.Errorf("No seed specified")
	}
	seed, err := crypto.NewRippleHashCheck(c.GlobalString("seed"), crypto.RIPPLE_FAMILY_SEED)
	if err != nil {
		return err
	}
	if c.GlobalBool("ed25519") {
		key, err = crypto.NewEd25519Key(seed.Payload())
	} else {
		key, err = crypto.NewECDSAKey(seed.Payload())
		seq := uint32(0)
		keySequence = &seq
	}
	return err
}