func CreateOrganisation(v *vault.Vault, orgAddr, fullName string, orgValidations []string, kt bmcrypto.KeyType) {
	s := stepper.New()

	// Setup context for spinner
	spinnerCtx := orgSpinnerContext{
		Args: orgArgs{
			Vault:       v,
			KeyType:     kt,
			Name:        fullName,
			Validations: orgValidations,
			OrgAddrStr:  orgAddr,
			OrgAddrHash: hash.New(orgAddr),
		},
	}
	s.Ctx = context.WithValue(s.Ctx, internal.CtxSpinnerContext, spinnerCtx)

	// Add all the steps from the account creation procedure

	s.AddStep(stepper.Step{
		Title:   "Checking if organisation is already known in the resolver service",
		RunFunc: checkOrganisationInResolver,
	})

	s.AddStep(stepper.Step{
		Title:   "Checking if address is a reserved name",
		RunFunc: checkOrganisationReservedAddress,
	})

	s.AddStep(stepper.Step{
		Title:          "Checking if validations are correct",
		DisplaySpinner: true,
		RunFunc:        checkValidations,
	})

	s.AddStep(stepper.Step{
		Title:   "Checking if the organisation is already present in the vault",
		RunFunc: checkOrganisationInVault,
	})

	s.AddStep(stepper.Step{
		Title:          "Generating organisation public/private keypair",
		DisplaySpinner: true,
		SkipIfFunc:     func(s stepper.Stepper) bool { return getOrganisationContext(s).Organisation == nil },
		RunFunc:        generateOrganisationKeyPair,
	})

	s.AddStep(stepper.Step{
		Title:          fmt.Sprintf("Doing some work to let people know this is not a fake account, %sthis might take a while%s...", stepper.AnsiFgYellow, stepper.AnsiReset),
		DisplaySpinner: true,
		SkipIfFunc:     func(s stepper.Stepper) bool { return getOrganisationContext(s).Organisation == nil },
		RunFunc:        doProofOfWorkOrg,
	})

	s.AddStep(stepper.Step{
		Title:      "Placing your new organisation into the vault",
		SkipIfFunc: func(s stepper.Stepper) bool { return getOrganisationContext(s).Organisation == nil },
		RunFunc:    addOrganisationToVault,
	})

	s.AddStep(stepper.Step{
		Title:          "Checking domains for reservation proof",
		RunFunc:        checkOrganisationReservedDomains,
		SkipIfFunc:     func(s stepper.Stepper) bool { return !getOrganisationContext(s).Reserved },
		DisplaySpinner: true,
	})

	s.AddStep(stepper.Step{
		Title:          "Making your organisation known to the outside world",
		DisplaySpinner: true,
		RunFunc:        uploadOrganisationToResolver,
	})

	// Run the stepper
	s.Run()
	if s.Status == stepper.FAILURE {
		fmt.Println("There was an error while creating the organisation.")
		os.Exit(1)
	}

	kp := getOrganisationContext(*s).Organisation.GetActiveKey().KeyPair
	mnemonic := bminternal.WordWrap(bmcrypto.GetMnemonic(&kp), 78)

	fmt.Println(internal.GenerateFromMnemonicTemplate(internal.OrganisationCreatedTemplate, mnemonic))
}
// CreateOrganisation creates a new organisation locally in the vault and pushes the public key to the resolver
CreateOrganisation creates a new organisation locally in the vault and pushes the public key to the resolver
// CreateOrganisation creates a new organisation locally in the vault and pushes the public key to the resolver
func CreateOrganisation(v *vault.Vault, orgAddr, fullName string, orgValidations []string, kt bmcrypto.KeyType) {
	s := stepper.New()
	spinnerCtx := orgSpinnerContext{
		Args: orgArgs{
			Vault:       v,
			KeyType:     kt,
			Name:        fullName,
			Validations: orgValidations,
			OrgAddrStr:  orgAddr,
			OrgAddrHash: hash.New(orgAddr),
		},
	}
	s.Ctx = context.WithValue(s.Ctx, internal.CtxSpinnerContext, spinnerCtx)
	s.AddStep(stepper.Step{
		Title:   "Checking if organisation is already known in the resolver service",
		RunFunc: checkOrganisationInResolver,
	})
	s.AddStep(stepper.Step{
		Title:   "Checking if address is a reserved name",
		RunFunc: checkOrganisationReservedAddress,
	})
	s.AddStep(stepper.Step{
		Title:          "Checking if validations are correct",
		DisplaySpinner: true,
		RunFunc:        checkValidations,
	})
	s.AddStep(stepper.Step{
		Title:   "Checking if the organisation is already present in the vault",
		RunFunc: checkOrganisationInVault,
	})
	s.AddStep(stepper.Step{
		Title:          "Generating organisation public/private keypair",
		DisplaySpinner: true,
		SkipIfFunc:     func(s stepper.Stepper) bool { return getOrganisationContext(s).Organisation == nil },
		RunFunc:        generateOrganisationKeyPair,
	})
	s.AddStep(stepper.Step{
		Title:          fmt.Sprintf("Doing some work to let people know this is not a fake account, %sthis might take a while%s...", stepper.AnsiFgYellow, stepper.AnsiReset),
		DisplaySpinner: true,
		SkipIfFunc:     func(s stepper.Stepper) bool { return getOrganisationContext(s).Organisation == nil },
		RunFunc:        doProofOfWorkOrg,
	})
	s.AddStep(stepper.Step{
		Title:      "Placing your new organisation into the vault",
		SkipIfFunc: func(s stepper.Stepper) bool { return getOrganisationContext(s).Organisation == nil },
		RunFunc:    addOrganisationToVault,
	})
	s.AddStep(stepper.Step{
		Title:          "Checking domains for reservation proof",
		RunFunc:        checkOrganisationReservedDomains,
		SkipIfFunc:     func(s stepper.Stepper) bool { return !getOrganisationContext(s).Reserved },
		DisplaySpinner: true,
	})
	s.AddStep(stepper.Step{
		Title:          "Making your organisation known to the outside world",
		DisplaySpinner: true,
		RunFunc:        uploadOrganisationToResolver,
	})
	s.Run()
	if s.Status == stepper.FAILURE {
		fmt.Println("There was an error while creating the organisation.")
		os.Exit(1)
	}
	kp := getOrganisationContext(*s).Organisation.GetActiveKey().KeyPair
	mnemonic := bminternal.WordWrap(bmcrypto.GetMnemonic(&kp), 78)
	fmt.Println(internal.GenerateFromMnemonicTemplate(internal.OrganisationCreatedTemplate, mnemonic))
}
func CreateOrganisation ( v * vault . Vault , orgAddr , fullName string , orgValidations [ ] string , kt bmcrypto . KeyType ) { s := stepper . New ( ) spinnerCtx := orgSpinnerContext { Args : orgArgs { Vault : v , KeyType : kt , Name : fullName , Validations : orgValidations , OrgAddrStr : orgAddr , OrgAddrHash : hash . New ( orgAddr ) , } , } s . Ctx = context . WithValue ( s . Ctx , internal . CtxSpinnerContext , spinnerCtx ) s . AddStep ( stepper . Step { Title : " " , RunFunc : checkOrganisationInResolver , } ) s . AddStep ( stepper . Step { Title : " " , RunFunc : checkOrganisationReservedAddress , } ) s . AddStep ( stepper . Step { Title : " " , DisplaySpinner : true , RunFunc : checkValidations , } ) s . AddStep ( stepper . Step { Title : " " , RunFunc : checkOrganisationInVault , } ) s . AddStep ( stepper . Step { Title : " " , DisplaySpinner : true , SkipIfFunc : func ( s stepper . Stepper ) bool { return getOrganisationContext ( s ) . Organisation == nil } , RunFunc : generateOrganisationKeyPair , } ) s . AddStep ( stepper . Step { Title : fmt . Sprintf ( " " , stepper . AnsiFgYellow , stepper . AnsiReset ) , DisplaySpinner : true , SkipIfFunc : func ( s stepper . Stepper ) bool { return getOrganisationContext ( s ) . Organisation == nil } , RunFunc : doProofOfWorkOrg , } ) s . AddStep ( stepper . Step { Title : " " , SkipIfFunc : func ( s stepper . Stepper ) bool { return getOrganisationContext ( s ) . Organisation == nil } , RunFunc : addOrganisationToVault , } ) s . AddStep ( stepper . Step { Title : " " , RunFunc : checkOrganisationReservedDomains , SkipIfFunc : func ( s stepper . Stepper ) bool { return ! getOrganisationContext ( s ) . Reserved } , DisplaySpinner : true , } ) s . AddStep ( stepper . Step { Title : " " , DisplaySpinner : true , RunFunc : uploadOrganisationToResolver , } ) s . Run ( ) if s . Status == stepper . FAILURE { fmt . Println ( " " ) os . Exit ( 1 ) } kp := getOrganisationContext ( * s ) . Organisation . GetActiveKey ( ) . KeyPair mnemonic := bminternal . WordWrap ( bmcrypto . GetMnemonic ( & kp ) , 78 ) fmt . Println ( internal . GenerateFromMnemonicTemplate ( internal . OrganisationCreatedTemplate , mnemonic ) ) }
CreateOrganisation creates a new organisation locally in the vault and pushes the public key to the resolver
CreateOrganisation creates a new organisation locally in the vault and pushes the public key to the resolver
// Setup context for spinner // Add all the steps from the account creation procedure // Run the stepper