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

Issue deleting object with Wallet Connect as the signature generator #530

Open
amlwwalker opened this issue Nov 6, 2023 · 4 comments
Open
Labels
I4 No visible changes question Further information is requested S4 Routine U3 Regular

Comments

@amlwwalker
Copy link

Trying to delete an object for a container while using an intermediary key and signing 'out of band'

    pl, err := m.Pool(false)
    if err != nil {
        log.Println("error retrieving pool ", err)
        return nil, err
    }
    cliSdk, err := pl.RawClient()
    if err != nil {
        log.Println("delete could not get client")
        return nil, err
    }
    gateSigner := user.NewAutoIDSignerRFC6979(m.gateAccount.PrivateKey().PrivateKey)
    netInfo, err := cliSdk.NetworkInfo(context.Background(), client.PrmNetworkInfo{})
    if err != nil {
        return nil, fmt.Errorf("read current network info: %w", err)
    }

    var sessionToken session.Object
    sessionToken.SetAuthKey(gateSigner.Public()) 
    sessionToken.SetID(uuid.New())
    sessionToken.SetIat(netInfo.CurrentEpoch())
    sessionToken.SetNbf(netInfo.CurrentEpoch())
    sessionToken.SetExp(netInfo.CurrentEpoch() + 100) // or particular exp value
    sessionToken.BindContainer(cnrID)
    sessionToken.ForVerb(session.VerbObjectDelete)
    if err := m.TemporarySignObjectTokenWithPrivateKey(&sessionToken); err != nil {
        log.Println("error signing session token to create a object", err)
        return nil, err
    }

    var prmDelete client.PrmObjectDelete
    prmDelete.WithinSession(sessionToken)
    if _, err := pl.ObjectDelete(m.ctx, cnrID, objID, gateSigner, prmDelete); err != nil {
        ...
    }

gives me the error

Object xxxx could not be deleted: status: code = 4096 message = session token not found and could not be deleted: status: code = 4096 message = session token not found map[]

I have this working for creating/listing/downloading objects but for some reason can't get working for deleting. Any obvious mistake I've made here?

@amlwwalker amlwwalker added the question Further information is requested label Nov 6, 2023
@amlwwalker
Copy link
Author

Any progress here by any chance?

@roman-khimov
Copy link
Member

@carpawell, could it be related to nspcc-dev/neofs-node#2261?

@carpawell
Copy link
Member

Hi @amlwwalker, sorry for the huge delay. Can you, please, provide the version you used?

Also, can you, please, provide the exact error message you got? Is Object xxxx could not be deleted from the SDK? session token not found map[] too (especially map[])?

Could you briefly describe what are you trying to do? What does TemporarySignObjectTokenWithPrivateKey do? Could you, please, provide the ACL settings of the container you used (container itself and an eACL policy if set)?

I have this working for creating

The code succeed looks almost the same but ObjectPutInit instead of Delete? What payload size did you use?

@roman-khimov roman-khimov added U3 Regular S4 Routine I4 No visible changes labels Dec 20, 2023
@amlwwalker
Copy link
Author

Hi @carpawell - Apologies, I've been working on the Wallet Connect stuff and haven't looked back at this bug. Once my app is rebuilt I'll get you these answers!

@carpawell carpawell removed their assignment Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I4 No visible changes question Further information is requested S4 Routine U3 Regular
Projects
None yet
Development

No branches or pull requests

3 participants