@textile/grpc-authentication
Advanced tools
Comparing version 0.1.4 to 0.2.0-alpha.0
@@ -5,2 +5,20 @@ import { GrpcConnection } from '@textile/grpc-connection'; | ||
/** | ||
* Set the options for authenticating with an API key | ||
*/ | ||
export interface WithKeyInfoOptions extends WithUserAuthOptions { | ||
date?: Date; | ||
} | ||
/** | ||
* Set the options for authenticating with a user auth | ||
*/ | ||
export interface WithUserAuthOptions extends CopyAuthOptions { | ||
host?: string; | ||
} | ||
/** | ||
* Set additional options when copying authentication | ||
*/ | ||
export interface CopyAuthOptions { | ||
debug?: boolean; | ||
} | ||
/** | ||
* Not for external use. Defines the authorization, authentication, and | ||
@@ -26,3 +44,3 @@ * API scoping methods used by gRPC API client classes such as Users and Buckets. | ||
* Copy an authenticated Users api instance to Buckets. | ||
* ```tyepscript | ||
* ```typescript | ||
* import { Buckets, Users } from '@textile/hub' | ||
@@ -38,3 +56,3 @@ * | ||
* Copy an authenticated Buckets api instance to Users. | ||
* ```tyepscript | ||
* ```typescript | ||
* import { Buckets, Users } from '@textile/hub' | ||
@@ -48,3 +66,3 @@ * | ||
*/ | ||
static copyAuth(auth: GrpcAuthentication, debug?: boolean): GrpcAuthentication; | ||
static copyAuth(auth: GrpcAuthentication, options?: CopyAuthOptions): GrpcAuthentication; | ||
/** | ||
@@ -65,3 +83,3 @@ * Creates a new API client instance for accessing the gRPC API | ||
*/ | ||
static withUserAuth(auth: UserAuth | (() => Promise<UserAuth>), host?: string, debug?: boolean): GrpcAuthentication; | ||
static withUserAuth(auth: UserAuth | (() => Promise<UserAuth>), options?: WithUserAuthOptions): GrpcAuthentication; | ||
/** | ||
@@ -87,3 +105,3 @@ * Creates a new API client instance for accessing the gRPC API | ||
*/ | ||
static withKeyInfo(key: KeyInfo, host?: string, debug?: boolean): Promise<GrpcAuthentication>; | ||
static withKeyInfo(key: KeyInfo, options?: WithKeyInfoOptions): Promise<GrpcAuthentication>; | ||
/** | ||
@@ -90,0 +108,0 @@ * Scope future API calls to a specific thread. |
@@ -37,3 +37,3 @@ "use strict"; | ||
* Copy an authenticated Users api instance to Buckets. | ||
* ```tyepscript | ||
* ```typescript | ||
* import { Buckets, Users } from '@textile/hub' | ||
@@ -49,3 +49,3 @@ * | ||
* Copy an authenticated Buckets api instance to Users. | ||
* ```tyepscript | ||
* ```typescript | ||
* import { Buckets, Users } from '@textile/hub' | ||
@@ -59,4 +59,4 @@ * | ||
*/ | ||
static copyAuth(auth, debug = false) { | ||
return new GrpcAuthentication(auth.context, debug); | ||
static copyAuth(auth, options = {}) { | ||
return new GrpcAuthentication(auth.context, options.debug); | ||
} | ||
@@ -78,5 +78,7 @@ /** | ||
*/ | ||
static withUserAuth(auth, host = context_1.defaultHost, debug = false) { | ||
const context = typeof auth === 'object' ? context_1.Context.fromUserAuth(auth, host) : context_1.Context.fromUserAuthCallback(auth, host); | ||
return new GrpcAuthentication(context, debug); | ||
static withUserAuth(auth, options = {}) { | ||
const context = typeof auth === 'object' | ||
? context_1.Context.fromUserAuth(auth, options.host) | ||
: context_1.Context.fromUserAuthCallback(auth, options.host); | ||
return new GrpcAuthentication(context, options.debug); | ||
} | ||
@@ -103,7 +105,7 @@ /** | ||
*/ | ||
static withKeyInfo(key, host = context_1.defaultHost, debug = false) { | ||
static withKeyInfo(key, options = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const context = new context_1.Context(host); | ||
yield context.withKeyInfo(key); | ||
return new GrpcAuthentication(context, debug); | ||
const context = new context_1.Context(options.host); | ||
yield context.withKeyInfo(key, options.date); | ||
return new GrpcAuthentication(context, options.debug); | ||
}); | ||
@@ -110,0 +112,0 @@ } |
{ | ||
"name": "@textile/grpc-authentication", | ||
"version": "0.1.4", | ||
"version": "0.2.0-alpha.0", | ||
"description": "web-gRPC state manager for grpc-connection.", | ||
@@ -34,3 +34,3 @@ "main": "dist/index", | ||
"@textile/grpc-connection": "^0.1.2", | ||
"@textile/hub-threads-client": "^0.4.4", | ||
"@textile/hub-threads-client": "^0.5.0-alpha.0", | ||
"@textile/security": "^0.2.6" | ||
@@ -53,3 +53,3 @@ }, | ||
], | ||
"gitHead": "5e84b1428117c4fdd2cdfd57249550ce1c03fc87" | ||
"gitHead": "a191c5fe51715865640826ee6ad3c8acb6c631ad" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18120
356
1
+ Added@improbable-eng/grpc-web@0.14.1(transitive)
+ Added@textile/hub-grpc@2.0.0(transitive)
+ Added@textile/hub-threads-client@0.5.0(transitive)
+ Added@textile/threads-client@1.0.0-alpha.0(transitive)
+ Added@textile/threads-client-grpc@1.1.5(transitive)
+ Added@textile/users-grpc@2.0.0(transitive)
- Removed@textile/hub-threads-client@0.4.4(transitive)
- Removed@textile/threads-client@0.10.1(transitive)
- Removed@textile/threads-client-grpc@0.1.23(transitive)
- Removed@textile/users-grpc@1.0.14(transitive)