小编nov*_*ita的帖子

'string | 类型的参数 未定义' 不可分配给'ArrayBuffer | 类型的参数 共享数组缓冲区'

我已经在节点中实现了一种可以正常工作的加密方法,但由于 typeScript 问题,我在解密时遇到了麻烦。这是我的加密方法,效果很好,我正在遵循的示例

例子

private encryptWifiPassword = (param1: string, password: string) => {

        const ENCRYPTION_KEY = param1.padStart(32, '0'); // Must be 256 bits (32 characters)
        const IV_LENGTH = 16; // For AES, this is always 16

        const iv = crypto.randomBytes(IV_LENGTH);
        const cipher = crypto.createCipheriv('aes-256-gcm', Buffer.from(ENCRYPTION_KEY), iv);
        let encrypted = cipher.update('prefix'+ password);
        encrypted = Buffer.concat([encrypted, cipher.final()]);

        const pskEncripted = iv.toString('base64') + ':' + encrypted.toString('base64')
            return pskEncripted
};

Run Code Online (Sandbox Code Playgroud)

这是我的解密方法,行不通

  private decryptWifiPassword(param1: string, password: string): string {

        const ENCRYPTION_KEY = param1.padStart(32, '0')
        let …
Run Code Online (Sandbox Code Playgroud)

node.js cryptojs typescript

3
推荐指数
1
解决办法
5407
查看次数

Angular MatTable 中没有数据源检测

我的数据源有问题,因为我需要在表的标题中显示一个 selectAll 复选框。

当我尝试 console.log 数据源时,它返回一个空数组,而 dataSource.data-length 返回零。

我需要一个输入,因为该组件是另一个组件的子组件


<image-list [imageList]="imageList"></image-list>


Run Code Online (Sandbox Code Playgroud)

我试图把它放在 ngOnit 中,但它不起作用

import { Component, OnInit, Inject, OnDestroy, Input } from "@angular/core";
import { ImageModel } from "../image.model";
import { MatTableDataSource } from '@angular/material';

export class ImageListComponent implements OnInit, OnDestroy {
  
  @Input() imageList: ImageModel[];
  selection = new SelectionModel(true, [], true);
  selectionModelChanged = new BehaviorSubject([]);
  dataSource = new MatTableDataSource();
  row: any;
  

  constructor(private builderService: BuilderService,
    @Inject(DOCUMENT) private document: any) {
    this._unsubscribeAll = new Subject();
    // this.dataSource = new MatTableDataSource(this.imageList); //it …
Run Code Online (Sandbox Code Playgroud)

typescript angular

2
推荐指数
1
解决办法
73
查看次数

标签 统计

typescript ×2

angular ×1

cryptojs ×1

node.js ×1