패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.0

serverpod_argon2

Zig 표준 라이브러리를 기반으로 한 Argon2 비밀번호 해싱 (argon2id, argon2i, argon2d). Dart 및 Flutter용 사전 빌드된 네이티브 라이브러리와 웹용 WebAssembly 모듈을 제공하여 로컬 툴체인 필요 없음...

AndroidiOSLinuxmacOSWebWindows
30일 다운로드
14.9만
좋아요
3
Pub 점수
140

패키지 설치

flutter pub add serverpod_argon2

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Argon2 알고리즘(argon2id, argon2i, argon2d)을 사용한 안전한 비밀번호 해싱을 위한 Flutter/Dart 패키지입니다. Zig 표준 라이브러리를 기반으로 하며, Android, iOS, Linux, macOS, Windows용 사전 빌드된 네이티브 바이너리와 웹 환경용 WebAssembly 모듈을 제공합니다. 로컬 툴체인 없이도 고성능과 보안을 보장합니다. 강력한 비밀번호 저장 및 인증이 필요한 애플리케이션에 적합합니다.

사용 사례

  • 보안 비밀번호 저장
  • 사용자 인증 시스템
  • 보안 기준 준수
  • 모바일 및 웹 앱에서의 비밀번호 해시
  • 민감한 사용자 자격 증명 보호

주요 기능

  • 모든 Argon2 변형을 지원합니다
  • 모든 플랫폼용 사전 빌드된 네이티브 라이브러리
  • 웹 어셈블리의 웹 지원
  • 로컬 툴체인 필요 없음
  • 고성능 및 보안

적합한 대상

  • 사용자 암호를 처리하는 애플리케이션
  • 보안 중심의 백엔드 서비스
  • 크로스 플랫폼 Flutter 앱
  • 강력한 비밀번호 해싱을 필요로 하는 시스템
  • 설정의 용이성을 우선시하는 개발자

고려 사항

  • Dart 3.0 이상이 필요합니다
  • Argon2 해싱만 가능
  • 외부 Zig 기반 네이티브 코드에 의존합니다
  • 네이티브 바이너리로 인해 앱 크기가 약간 증가할 수 있습니다
  • 비암호 해시 사용 사례에 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

serverpod_argon2

Argon2 password hashing for Dart and Flutter, backed by the Argon2 implementation in the Zig standard library.

  • Native platforms load a prebuilt shared library through build hooks (native assets).
  • The web loads the same code compiled to WebAssembly, embedded in the package. This works with both dart2js and dart2wasm.
  • No toolchain is needed. Prebuilt libraries ship in the package for every supported target.

Usage

import 'package:serverpod_argon2/serverpod_argon2.dart';

final argon2 = await Argon2.load();

// $argon2id$v=19$m=19456,t=2,p=1$<salt>$<hash>
final encoded = argon2.hash('correct horse battery staple');

final ok = argon2.verify('correct horse battery staple', encoded);

hash defaults to Argon2Parameters.owasp (argon2id, 19 MiB, 2 iterations) and a random 16 byte salt. verify accepts PHC strings from any Argon2 implementation, as long as they use version 19. deriveKey returns raw bytes and takes the optional RFC 9106 secret and associatedData inputs.

Hashing runs on the calling thread and is slow by design. On native platforms, move it off the main isolate:

final encoded = await Isolate.run(() => argon2.hash(password));
Parallelism

The library is built single-threaded, so the p lanes are computed one after another. Hashes with p > 1 are still correct and compatible with other implementations, but take p times longer than a multithreaded implementation would. For more throughput, hash on several isolates.

Supported targets

OS Architectures
macOS arm64 (11.0+), x64 (10.15+)
iOS arm64 (13.0+), arm64 and x64 simulators
Android arm64, arm, x64
Linux x64, arm64, arm, riscv64
Windows x64, arm64
Web Any browser with WebAssembly

The libraries are pure Zig and link no libc. On Linux they run on any glibc or musl distribution.

Performance

benchmark/argon2_benchmark.dart compares against the pure Dart implementations in pointycastle and cryptography, after checking all three produce identical output. The file header shows how to run it in each mode. Results on an Intel Mac, argon2id with OWASP parameters, in ms per hash:

Implementation Dart JIT Dart AOT JavaScript (Node)
serverpod_argon2 43 46 40
cryptography 200 183 647
pointycastle 307 274 5996

Developing

A git checkout has no prebuilt libraries, so the build hook compiles from source. That needs the zig version in build.zig.zon (minimum_zig_version), either installed directly or through anyzig.

  • zig build test runs the RFC 9106 vectors against the Zig code.
  • dart test -p vm,chrome runs the Dart tests natively and in the browser.

Publishing

See PUBLISH.md.

카테고리

의존성

의존성 목록 2 개

  • code_assets>=1.2.1 <3.0.0
  • hooks^2.0.0

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.

순위