@@ -23,8 +23,8 @@ import (
2323 jwt "github.com/dgrijalva/jwt-go"
2424 "github.com/ethereum/go-ethereum/common/hexutil"
2525 "github.com/ethereum/go-ethereum/crypto"
26- "github.com/hashicorp/vault/logical "
27- "github.com/hashicorp/vault/logical/framework "
26+ "github.com/hashicorp/vault/sdk/framework "
27+ "github.com/hashicorp/vault/sdk/logical "
2828)
2929
3030// Audience is a public key known to vault. A Trustee has an address (Ethereum-compatible)
@@ -33,7 +33,7 @@ type Audience struct {
3333 PublicKey string `json:"public_key"`
3434}
3535
36- func audiencesPaths (b * backend ) []* framework.Path {
36+ func audiencesPaths (b * PluginBackend ) []* framework.Path {
3737 return []* framework.Path {
3838 & framework.Path {
3939 Pattern : "audiences/?" ,
@@ -70,7 +70,7 @@ Creates (or updates) an audience.
7070 }
7171}
7272
73- func (b * backend ) pathAudiencesList (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
73+ func (b * PluginBackend ) pathAudiencesList (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
7474 _ , err := b .configured (ctx , req )
7575 if err != nil {
7676 return nil , err
@@ -82,7 +82,7 @@ func (b *backend) pathAudiencesList(ctx context.Context, req *logical.Request, d
8282 return logical .ListResponse (vals ), nil
8383}
8484
85- func (b * backend ) pathAudiencesCreate (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
85+ func (b * PluginBackend ) pathAudiencesCreate (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
8686 _ , err := b .configured (ctx , req )
8787 if err != nil {
8888 return nil , err
@@ -118,7 +118,7 @@ func (b *backend) pathAudiencesCreate(ctx context.Context, req *logical.Request,
118118 }, nil
119119}
120120
121- func (b * backend ) pathAudiencesRead (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
121+ func (b * PluginBackend ) pathAudiencesRead (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
122122 _ , err := b .configured (ctx , req )
123123 if err != nil {
124124 return nil , err
@@ -142,7 +142,7 @@ func (b *backend) pathAudiencesRead(ctx context.Context, req *logical.Request, d
142142 }, nil
143143}
144144
145- func (b * backend ) readAudience (ctx context.Context , req * logical.Request , name string ) (* Audience , error ) {
145+ func (b * PluginBackend ) readAudience (ctx context.Context , req * logical.Request , name string ) (* Audience , error ) {
146146 path := fmt .Sprintf ("audiences/%s" , name )
147147 entry , err := req .Storage .Get (ctx , path )
148148 if err != nil {
@@ -162,7 +162,7 @@ func (b *backend) readAudience(ctx context.Context, req *logical.Request, name s
162162 return & audience , nil
163163}
164164
165- func (b * backend ) pathAudiencesDelete (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
165+ func (b * PluginBackend ) pathAudiencesDelete (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
166166 _ , err := b .configured (ctx , req )
167167 if err != nil {
168168 return nil , err
@@ -173,7 +173,7 @@ func (b *backend) pathAudiencesDelete(ctx context.Context, req *logical.Request,
173173 return nil , nil
174174}
175175
176- func (b * backend ) pathEncryptForAudience (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
176+ func (b * PluginBackend ) pathEncryptForAudience (ctx context.Context , req * logical.Request , data * framework.FieldData ) (* logical.Response , error ) {
177177 _ , err := b .configured (ctx , req )
178178 if err != nil {
179179 return nil , err
@@ -197,7 +197,7 @@ func (b *backend) pathEncryptForAudience(ctx context.Context, req *logical.Reque
197197
198198}
199199
200- func (b * backend ) encryptForAudience (ctx context.Context , audience * Audience , plaintext string ) (string , error ) {
200+ func (b * PluginBackend ) encryptForAudience (ctx context.Context , audience * Audience , plaintext string ) (string , error ) {
201201
202202 publicKeyBytes , err := hex .DecodeString (audience .PublicKey )
203203 if err != nil {
@@ -220,7 +220,7 @@ func (b *backend) encryptForAudience(ctx context.Context, audience *Audience, pl
220220
221221}
222222
223- func (b * backend ) encryptClaims (ctx context.Context , audience * Audience , claims jwt.MapClaims ) (jwt.MapClaims , error ) {
223+ func (b * PluginBackend ) encryptClaims (ctx context.Context , audience * Audience , claims jwt.MapClaims ) (jwt.MapClaims , error ) {
224224 encryptedClaims := make (jwt.MapClaims )
225225 for key , value := range claims {
226226 ciphertext , err := b .encryptForAudience (ctx , audience , value .(string ))
0 commit comments