func NewImmutable(body Immutable, sig interface{}) (ID, error) {
	h, err := blake2b.New(&blake2b.Config{Size: 16})
	if err != nil {
		return ID{}, err
	}

	h.Write([]byte(strconv.Itoa(body.Version())))

	b, err := json.Marshal(body)
	if err != nil {
		return ID{}, err
	}
	h.Write(b)

	b, err = json.Marshal(sig)
	if err != nil {
		return ID{}, err
	}
	h.Write(b)

	id := ID{idVersion, body.Type()}

	copy(id[2:], h.Sum(nil))

	return id, nil
}
// NewImmutable returns a new signed ID for an immutable object.
//
// sig should be a registry.Signature type
NewImmutable returns a new signed ID for an immutable object.

sig should be a registry.Signature type
// NewImmutable returns a new signed ID for an immutable object . // // sig should be a registry . Signature type
func NewImmutable(body Immutable, sig interface{}) (ID, error) {
	h, err := blake2b.New(&blake2b.Config{Size: 16})
	if err != nil {
		return ID{}, err
	}
	h.Write([]byte(strconv.Itoa(body.Version())))
	b, err := json.Marshal(body)
	if err != nil {
		return ID{}, err
	}
	h.Write(b)
	b, err = json.Marshal(sig)
	if err != nil {
		return ID{}, err
	}
	h.Write(b)
	id := ID{idVersion, body.Type()}
	copy(id[2:], h.Sum(nil))
	return id, nil
}
func NewImmutable ( body Immutable , sig interface { } ) ( ID , error ) { h , err := blake2b . New ( & blake2b . Config { Size : 16 } ) if err != nil { return ID { } , err } h . Write ( [ ] byte ( strconv . Itoa ( body . Version ( ) ) ) ) b , err := json . Marshal ( body ) if err != nil { return ID { } , err } h . Write ( b ) b , err = json . Marshal ( sig ) if err != nil { return ID { } , err } h . Write ( b ) id := ID { idVersion , body . Type ( ) } copy ( id [ 2 : ] , h . Sum ( nil ) ) return id , nil }
NewImmutable returns a new signed ID for an immutable object.
NewImmutable returns a new signed ID for an immutable object .