@textile/users
Advanced tools
Comparing version 3.0.0 to 4.0.0
import { grpc } from '@improbable-eng/grpc-web'; | ||
import { GrpcConnection } from '@textile/grpc-connection'; | ||
import { ContextInterface } from '@textile/context'; | ||
import { ThreadID } from '@textile/threads-id'; | ||
import { GetThreadResponse } from '@textile/hub-threads-client'; | ||
/** | ||
@@ -39,10 +39,2 @@ * Global settings for mailboxes | ||
/** | ||
* The response type from getThread and listThreads | ||
*/ | ||
export interface GetThreadResponse { | ||
isDB: boolean; | ||
name: string; | ||
id: ThreadID; | ||
} | ||
/** | ||
* @deprecated | ||
@@ -64,2 +56,11 @@ */ | ||
} | ||
/** | ||
* GetUsage options | ||
*/ | ||
export interface UsageOptions { | ||
/** | ||
* Public key of the user. Only available when authenticated using an account key. | ||
*/ | ||
dependentUserKey?: string; | ||
} | ||
export interface Period { | ||
@@ -170,2 +171,2 @@ unixStart: number; | ||
*/ | ||
export declare function getUsage(api: GrpcConnection, ctx?: ContextInterface): Promise<GetUsageResponse>; | ||
export declare function getUsage(api: GrpcConnection, options?: UsageOptions, ctx?: ContextInterface): Promise<GetUsageResponse>; |
@@ -69,5 +69,5 @@ "use strict"; | ||
return { | ||
isDB: value.getIsDb(), | ||
isDb: value.getIsDb(), | ||
name: value.getName(), | ||
id: threads_id_1.ThreadID.fromBytes(value.getId_asU8()), | ||
id: threads_id_1.ThreadID.fromBytes(value.getId_asU8()).toString(), | ||
}; | ||
@@ -88,5 +88,5 @@ }); | ||
return { | ||
isDB: res.getIsDb(), | ||
isDb: res.getIsDb(), | ||
name: res.getName(), | ||
id: threads_id_1.ThreadID.fromBytes(res.getId_asU8()), | ||
id: threads_id_1.ThreadID.fromBytes(res.getId_asU8()).toString(), | ||
}; | ||
@@ -266,6 +266,9 @@ }); | ||
*/ | ||
function getUsage(api, ctx) { | ||
function getUsage(api, options, ctx) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
logger.debug('get usage request'); | ||
const req = new usersd_pb_1.GetUsageRequest(); | ||
if (options && options.dependentUserKey) { | ||
req.setKey(options.dependentUserKey); | ||
} | ||
const res = yield api.unary(usersd_pb_service_1.APIService.GetUsage, req, ctx); | ||
@@ -272,0 +275,0 @@ const usage = res.toObject(); |
export * from './api'; | ||
export * from './users'; | ||
export { SetupMailboxRequest, SetupMailboxResponse, ListThreadsRequest, ListThreadsResponse, GetThreadResponse, GetThreadRequest, SendMessageRequest, SendMessageResponse, ListInboxMessagesRequest, ListInboxMessagesResponse, ListSentboxMessagesRequest, ListSentboxMessagesResponse, ReadInboxMessageRequest, ReadInboxMessageResponse, DeleteInboxMessageRequest, DeleteInboxMessageResponse, DeleteSentboxMessageRequest, DeleteSentboxMessageResponse, } from '@textile/users-grpc/api/usersd/pb/usersd_pb'; | ||
export { GetThreadResponse } from '@textile/hub-threads-client'; | ||
export { SetupMailboxRequest, SetupMailboxResponse, ListThreadsRequest, GetThreadRequest, SendMessageRequest, SendMessageResponse, ListInboxMessagesRequest, ListInboxMessagesResponse, ListSentboxMessagesRequest, ListSentboxMessagesResponse, ReadInboxMessageRequest, ReadInboxMessageResponse, DeleteInboxMessageRequest, DeleteInboxMessageResponse, DeleteSentboxMessageRequest, DeleteSentboxMessageResponse, } from '@textile/users-grpc/api/usersd/pb/usersd_pb'; |
@@ -20,4 +20,2 @@ "use strict"; | ||
Object.defineProperty(exports, "ListThreadsRequest", { enumerable: true, get: function () { return usersd_pb_1.ListThreadsRequest; } }); | ||
Object.defineProperty(exports, "ListThreadsResponse", { enumerable: true, get: function () { return usersd_pb_1.ListThreadsResponse; } }); | ||
Object.defineProperty(exports, "GetThreadResponse", { enumerable: true, get: function () { return usersd_pb_1.GetThreadResponse; } }); | ||
Object.defineProperty(exports, "GetThreadRequest", { enumerable: true, get: function () { return usersd_pb_1.GetThreadRequest; } }); | ||
@@ -24,0 +22,0 @@ Object.defineProperty(exports, "SendMessageRequest", { enumerable: true, get: function () { return usersd_pb_1.SendMessageRequest; } }); |
@@ -12,5 +12,1 @@ import * as pb from '@textile/hub-grpc/api/hubd/pb/hubd_pb'; | ||
}>; | ||
export declare const createAPISig: (secret: string, date?: Date) => Promise<{ | ||
sig: string; | ||
msg: string; | ||
}>; |
@@ -34,7 +34,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createAPISig = exports.signUp = exports.createKey = exports.confirmEmail = exports.createEmail = exports.createUsername = void 0; | ||
exports.signUp = exports.createKey = exports.confirmEmail = exports.createEmail = exports.createUsername = void 0; | ||
const axios_1 = __importDefault(require("axios")); | ||
const delay_1 = __importDefault(require("delay")); | ||
const fast_sha256_1 = require("fast-sha256"); | ||
const multibase_1 = __importDefault(require("multibase")); | ||
const pb = __importStar(require("@textile/hub-grpc/api/hubd/pb/hubd_pb")); | ||
@@ -92,10 +90,2 @@ const hubd_pb_service_1 = require("@textile/hub-grpc/api/hubd/pb/hubd_pb_service"); | ||
}; | ||
exports.createAPISig = (secret, date = new Date(Date.now() + 1000 * 60)) => __awaiter(void 0, void 0, void 0, function* () { | ||
const sec = multibase_1.default.decode(secret); | ||
const msg = (date !== null && date !== void 0 ? date : new Date()).toISOString(); | ||
const hash = new fast_sha256_1.HMAC(sec); | ||
const mac = hash.update(Buffer.from(msg)).digest(); | ||
const sig = multibase_1.default.encode('base32', Buffer.from(mac)).toString(); | ||
return { sig, msg }; | ||
}); | ||
//# sourceMappingURL=spec.util.js.map |
@@ -5,3 +5,4 @@ import { grpc } from '@improbable-eng/grpc-web'; | ||
import { UserAuth, KeyInfo } from '@textile/security'; | ||
import { InboxListOptions, SentboxListOptions, GetThreadResponse, UserMessage, MailboxEvent, GetUsageResponse } from './api'; | ||
import { GetThreadResponse } from '@textile/hub-threads-client'; | ||
import { InboxListOptions, SentboxListOptions, UserMessage, MailboxEvent, GetUsageResponse, UsageOptions } from './api'; | ||
/** | ||
@@ -143,2 +144,6 @@ * Users a client wrapper for interacting with the Textile Users API. | ||
/** | ||
* {@inheritDoc @textile/hub#GrpcAuthentication.getToken} | ||
*/ | ||
setToken(token: string): Promise<void>; | ||
/** | ||
* {@inheritDoc @textile/hub#GrpcAuthentication.getTokenChallenge} | ||
@@ -177,3 +182,3 @@ * | ||
*/ | ||
getUsage(): Promise<GetUsageResponse>; | ||
getUsage(options?: UsageOptions): Promise<GetUsageResponse>; | ||
/** | ||
@@ -180,0 +185,0 @@ * Lists a users existing threads. This method |
@@ -179,2 +179,8 @@ "use strict"; | ||
/** | ||
* {@inheritDoc @textile/hub#GrpcAuthentication.getToken} | ||
*/ | ||
setToken(token) { | ||
return super.setToken(token); | ||
} | ||
/** | ||
* {@inheritDoc @textile/hub#GrpcAuthentication.getTokenChallenge} | ||
@@ -220,5 +226,5 @@ * | ||
*/ | ||
getUsage() { | ||
getUsage(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return api_1.getUsage(this); | ||
return api_1.getUsage(this, options); | ||
}); | ||
@@ -225,0 +231,0 @@ } |
{ | ||
"name": "@textile/users", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "web-gRPC wrapper client for managing Textile Users.", | ||
@@ -33,13 +33,13 @@ "main": "dist/index", | ||
"@improbable-eng/grpc-web": "^0.13.0", | ||
"@textile/buckets-grpc": "2.2.0", | ||
"@textile/buckets-grpc": "2.2.2", | ||
"@textile/context": "^0.9.2", | ||
"@textile/crypto": "^2.0.0", | ||
"@textile/grpc-authentication": "^2.0.0", | ||
"@textile/grpc-connection": "^2.0.0", | ||
"@textile/grpc-transport": "^0.1.0", | ||
"@textile/hub-grpc": "2.2.0", | ||
"@textile/hub-threads-client": "^3.0.0", | ||
"@textile/grpc-authentication": "^2.1.0", | ||
"@textile/grpc-connection": "^2.1.0", | ||
"@textile/grpc-transport": "^0.2.1", | ||
"@textile/hub-grpc": "2.2.2", | ||
"@textile/hub-threads-client": "^4.0.0", | ||
"@textile/security": "^0.6.2", | ||
"@textile/threads-id": "^0.2.0", | ||
"@textile/users-grpc": "2.2.0", | ||
"@textile/threads-id": "^0.3.1", | ||
"@textile/users-grpc": "2.2.2", | ||
"event-iterator": "^2.0.0", | ||
@@ -70,3 +70,3 @@ "loglevel": "^1.7.0" | ||
], | ||
"gitHead": "2b40323e1c55b0c041ba6b8b0b6fcdb0fe9bbe0c" | ||
"gitHead": "6c8b4a0522d6caa6ff96856e695bb141457ad62a" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
70139
+ Added@textile/buckets-grpc@2.2.2(transitive)
- Removed@textile/buckets-grpc@2.2.0(transitive)
- Removed@textile/grpc-transport@0.1.0(transitive)
- Removed@textile/hub-grpc@2.2.0(transitive)
- Removed@textile/hub-threads-client@3.0.0(transitive)
- Removed@textile/threads-id@0.2.0(transitive)
- Removed@textile/users-grpc@2.2.0(transitive)
Updated@textile/buckets-grpc@2.2.2
Updated@textile/hub-grpc@2.2.2
Updated@textile/threads-id@^0.3.1
Updated@textile/users-grpc@2.2.2